index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div style="height: 100%; padding: 10px 10px">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div
  6. class="newspan"
  7. v-for="(item, index) of optionData"
  8. :key="index"
  9. :class="{ active: cur == index }"
  10. @click="handleOpen(item, index)"
  11. >
  12. {{ item }}
  13. </div>
  14. </div>
  15. </div>
  16. <div class="query mg-b-8">
  17. <div class="query-items">
  18. <!-- <div class="query-item">
  19. <div class="lable">场站:</div>
  20. <div class="search-input">
  21. <el-select
  22. size="mini"
  23. v-model="value1"
  24. clearable
  25. placeholder="请选择"
  26. popper-class="select"
  27. >
  28. <el-option
  29. v-for="item in ChangZhan"
  30. :key="item.id"
  31. :value="item.id"
  32. :label="item.name"
  33. >
  34. </el-option>
  35. </el-select>
  36. </div>
  37. </div> -->
  38. <div class="query-item">
  39. <div class="lable">日期:</div>
  40. <div class="search-input">
  41. <el-date-picker
  42. size="mini"
  43. v-model="date"
  44. :type="cur ? 'date' : 'month'"
  45. placeholder="选择日期"
  46. popper-class="date-select"
  47. :value-format="cur ? 'YYYY-MM-DD' : 'YYYY-MM'"
  48. >
  49. </el-date-picker>
  50. </div>
  51. </div>
  52. <div class="query-actions">
  53. <el-button size="mini" round class="searchColor" @click="getTable"
  54. >查 询</el-button
  55. >
  56. </div>
  57. </div>
  58. </div>
  59. <div class="table-box">
  60. <div class="leftContent">
  61. <span>{{ showTitle }}</span>
  62. </div>
  63. <!-- <ComTable
  64. :data="tableData"
  65. :pageSize="20"
  66. v-loading="tableLoading"
  67. element-loading-text="拼命加载中.."
  68. element-loading-background="rgba(0, 0, 0, 0.8)"
  69. ></ComTable> -->
  70. <el-table
  71. size="mini"
  72. :data="tableData.data"
  73. style="width: 100%"
  74. max-height="830px"
  75. stripe
  76. >
  77. <el-table-column
  78. v-for="item in tableData.column"
  79. :label="item.name"
  80. :prop="item.field"
  81. :key="item.field"
  82. header-align="center"
  83. align="center"
  84. />
  85. </el-table>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import ComTable from "@/components/coms/table/table-qc.vue";
  91. import thermometerVue from "../../../../components/chart/bar/thermometer.vue";
  92. import api1 from "@api/economic/index.js";
  93. import api from "@api/wisdomOverhaul/energy/index.js";
  94. import dataJson from "./dataJson.json";
  95. import dayjs from "dayjs";
  96. export default {
  97. name: "Qxpclfx",
  98. components: { ComTable },
  99. data() {
  100. return {
  101. cur: 0,
  102. optionData: ["月曲线偏差率分析", "日曲线偏差率分析"],
  103. ChangZhan: [],
  104. value1: "NX_FGS_HA_FDC_STA",
  105. date: "",
  106. showTitle: "月曲线偏差率分析",
  107. tableLoading: true,
  108. tableData: {
  109. column: dataJson.data.column,
  110. data: [],
  111. },
  112. tableId: "",
  113. };
  114. },
  115. created() {
  116. this.ChangZhanVal();
  117. this.date = dayjs().format("YYYY-MM-DD");
  118. },
  119. methods: {
  120. // 获取表格数据
  121. getTable() {
  122. this.tableLoading = true;
  123. const url = this.cur
  124. ? "getCurvefittingmainList"
  125. : "getCurvefittingmonthmainList";
  126. const param = {
  127. isAsc: "asc",
  128. wpId: this.value1,
  129. pageNum: 1,
  130. pageSize: 1000,
  131. };
  132. if (this.cur) {
  133. param.recorddate = this.date;
  134. } else {
  135. param.year = parseInt(this.date?.split("-")[0]);
  136. param.month = parseInt(this.date?.split("-")[1]);
  137. }
  138. api[url](param).then((res) => {
  139. this.dataChange(res);
  140. });
  141. },
  142. dataChange(res) {
  143. this.tableLoading = false;
  144. if (res.code === 200) {
  145. res.data.forEach((ele) => {
  146. ele.curIndex = this.cur;
  147. ele.recordDate = this.date;
  148. });
  149. this.tableData.data = res.data || [];
  150. } else {
  151. res.data.forEach((ele) => {
  152. ele.curIndex = this.cur;
  153. ele.recordDate = this.date;
  154. });
  155. this.tableData.data = res.data || [];
  156. }
  157. },
  158. // tab
  159. handleOpen(vl, index) {
  160. this.cur = index;
  161. this.showTitle = vl;
  162. this.date = new Date().formatDate(`yyyy-MM${index ? "-dd" : ""}`);
  163. this.getTable();
  164. },
  165. // 场站
  166. ChangZhanVal() {
  167. // this.tableData = dataJson.data
  168. // this.dataChange(dataJson.data)
  169. api1
  170. .getWpList({
  171. type: "-1",
  172. })
  173. .then((res) => {
  174. if (res.data.code === 200) {
  175. this.ChangZhan = res.data.data;
  176. this.value1 = res.data.data[0].id;
  177. this.getTable();
  178. }
  179. });
  180. },
  181. },
  182. };
  183. </script>
  184. <style scoped lang="less">
  185. .table-box {
  186. height: calc(100% - 80px);
  187. .leftContent {
  188. width: 242px;
  189. height: 45px;
  190. line-height: 45px;
  191. background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
  192. span {
  193. font-size: 16px;
  194. font-family: Microsoft YaHei;
  195. font-weight: 400;
  196. color: #05bb4c;
  197. margin-left: 25px;
  198. }
  199. }
  200. }
  201. .query-actions {
  202. margin-left: 0 !important;
  203. }
  204. button {
  205. margin-left: 10px;
  206. background: rgba(67, 81, 107, 0.3);
  207. border: 1px solid #274934;
  208. color: #b3b3b3;
  209. }
  210. .searchColor {
  211. background-color: rgba(5, 187, 76, 0.2);
  212. border: 1px solid #3b6c53;
  213. color: #b3b3b3;
  214. font-size: 14px;
  215. &:hover {
  216. background-color: rgba(5, 187, 76, 0.5);
  217. color: #ffffff;
  218. }
  219. }
  220. .newspan {
  221. line-height: 30px;
  222. cursor: pointer;
  223. padding: 0 1vw;
  224. margin: 0 2px;
  225. color: #9ca5a8;
  226. transition: color 0.2s ease-in-out;
  227. position: relative;
  228. }
  229. .newspan:hover {
  230. background: linear-gradient(
  231. to top,
  232. rgba(5, 187, 76, 0.5),
  233. rgba(5, 187, 76, 0)
  234. );
  235. color: white;
  236. position: relative;
  237. }
  238. .newspan:hover::after {
  239. content: "";
  240. position: absolute;
  241. width: 100%;
  242. height: 0.463vh;
  243. border: 0.093vh solid #05bb4c;
  244. border-top: 0;
  245. left: 0;
  246. bottom: 0;
  247. box-sizing: border-box;
  248. }
  249. .active {
  250. background: linear-gradient(
  251. to top,
  252. rgba(5, 187, 76, 0.5),
  253. rgba(5, 187, 76, 0)
  254. );
  255. color: white;
  256. position: relative;
  257. }
  258. .active::after {
  259. content: "";
  260. position: absolute;
  261. width: 100%;
  262. height: 4px;
  263. border: 1px solid #05bb4c;
  264. border-top: 0;
  265. left: 0;
  266. bottom: 0;
  267. box-sizing: border-box;
  268. }
  269. .title {
  270. background: rgba(255, 255, 255, 0.1);
  271. margin-bottom: 8px;
  272. padding: 8px;
  273. }
  274. </style>