fnlyl.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <template>
  2. <div class="ztfx">
  3. <div class="action-bar">
  4. <div class="query mg-b-16">
  5. <div class="query-items">
  6. <div class="query-item">
  7. <div class="lable">日期:</div>
  8. <div class="search-input">
  9. <el-date-picker
  10. v-model="monthValue"
  11. type="year"
  12. placeholder="选择年份"
  13. popper-class="date-select"
  14. :clearable="false"
  15. >
  16. </el-date-picker>
  17. </div>
  18. </div>
  19. <div class="query-item">
  20. <div class="search-input select-btn">
  21. <button class="btn green" @click="onClickSearch">搜索</button>
  22. </div>
  23. <div class="search-input select-btn">
  24. <button class="btn green" @click="exportPDF">导出</button>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <el-row :gutter="20" class="table-panel pdfDom">
  31. <el-col :span="24">
  32. <!-- <panel :title="'月度'" :showLine="false"> -->
  33. <div class="table">
  34. <table style="width: 100%" border="0" cellspacing="0">
  35. <thead>
  36. <tr>
  37. <th rowspan="2" class="type1" style="width: 4vh"></th>
  38. <template v-for="m of monthData" :key="m">
  39. <th style="width: 6vh" class="type1" rowspan="2">{{ m }}</th>
  40. </template>
  41. </tr>
  42. </thead>
  43. </table>
  44. <div style="">
  45. <table
  46. style="width: 100%; text-align: center"
  47. border="0"
  48. cellspacing="0"
  49. >
  50. <tbody>
  51. <tr>
  52. <td style="width: 4vh"></td>
  53. <template v-for="(x, i) of GsList" :key="i">
  54. <td style="width: 3vh">本期</td>
  55. <td style="width: 3vh">同期</td>
  56. </template>
  57. </tr>
  58. <tr v-for="(items,key,index) in stations" :key="index">
  59. <td class="td-item" style="width: 4vh">{{items.name}}</td>
  60. <template v-for="(item, index) of items.children" :key="index">
  61. <td style="width: 3vh">
  62. {{ item.current }}
  63. <template v-if="item.compare === -1">
  64. <span class="svg-icon svg-icon-yellow">
  65. <svg-icon svgid="svg-arrow-dpwn-1" />
  66. </span>
  67. </template>
  68. <template v-if="item.compare === 1">
  69. <span class="svg-icon svg-icon-green">
  70. <svg-icon svgid="svg-arrow-up-1" />
  71. </span>
  72. </template>
  73. </td>
  74. <td style="width: 3vh">
  75. {{ item.sameperiod }}
  76. </td>
  77. </template>
  78. </tr>
  79. <!-- <tr>
  80. <td class="td-item" style="width: 4vh">牛首山</td>
  81. <template v-for="(item, index) of NshList" :key="index">
  82. <td style="width: 3vh">
  83. {{ item.current }}
  84. <template v-if="item.compare === -1">
  85. <span class="svg-icon svg-icon-yellow">
  86. <svg-icon svgid="svg-arrow-dpwn-1" />
  87. </span>
  88. </template>
  89. <template v-if="item.compare === 1">
  90. <span class="svg-icon svg-icon-green">
  91. <svg-icon svgid="svg-arrow-up-1" />
  92. </span>
  93. </template>
  94. </td>
  95. <td style="width: 3vh">
  96. {{ item.sameperiod }}
  97. </td>
  98. </template>
  99. </tr>
  100. <tr>
  101. <td class="td-item" style="width: 4vh">青山</td>
  102. <template v-for="(item, index) of QshList" :key="index">
  103. <td style="width: 3vh">
  104. {{ item.current }}
  105. <template v-if="item.compare === -1">
  106. <span class="svg-icon svg-icon-yellow">
  107. <svg-icon svgid="svg-arrow-dpwn-1" />
  108. </span>
  109. </template>
  110. <template v-if="item.compare === 1">
  111. <span class="svg-icon svg-icon-green">
  112. <svg-icon svgid="svg-arrow-up-1" />
  113. </span>
  114. </template>
  115. </td>
  116. <td style="width: 3vh">
  117. {{ item.sameperiod }}
  118. </td>
  119. </template>
  120. </tr>
  121. <tr>
  122. <td class="td-item" style="width: 4vh">石板泉</td>
  123. <template v-for="(item, index) of SbaqList" :key="index">
  124. <td style="width: 3vh">
  125. {{ item.current }}
  126. <template v-if="item.compare === -1">
  127. <span class="svg-icon svg-icon-yellow">
  128. <svg-icon svgid="svg-arrow-dpwn-1" />
  129. </span>
  130. </template>
  131. <template v-if="item.compare === 1">
  132. <span class="svg-icon svg-icon-green">
  133. <svg-icon svgid="svg-arrow-up-1" />
  134. </span>
  135. </template>
  136. </td>
  137. <td style="width: 3vh">
  138. {{ item.sameperiod }}
  139. </td>
  140. </template>
  141. </tr>
  142. <tr>
  143. <td class="td-item" style="width: 4vh">香山</td>
  144. <template v-for="(item, index) of XshList" :key="index">
  145. <td style="width: 3vh">
  146. {{ item.current }}
  147. <template v-if="item.compare === -1">
  148. <span class="svg-icon svg-icon-yellow">
  149. <svg-icon svgid="svg-arrow-dpwn-1" />
  150. </span>
  151. </template>
  152. <template v-if="item.compare === 1">
  153. <span class="svg-icon svg-icon-green">
  154. <svg-icon svgid="svg-arrow-up-1" />
  155. </span>
  156. </template>
  157. </td>
  158. <td style="width: 3vh">
  159. {{ item.sameperiod }}
  160. </td>
  161. </template>
  162. </tr>
  163. <tr>
  164. <td class="td-item" style="width: 4vh">公司</td>
  165. <template v-for="(item, index) of GsList" :key="index">
  166. <td style="width: 3vh">
  167. {{ item.current }}
  168. <template v-if="item.compare === -1">
  169. <span class="svg-icon svg-icon-yellow">
  170. <svg-icon svgid="svg-arrow-dpwn-1" />
  171. </span>
  172. </template>
  173. <template v-if="item.compare === 1">
  174. <span class="svg-icon svg-icon-green">
  175. <svg-icon svgid="svg-arrow-up-1" />
  176. </span>
  177. </template>
  178. </td>
  179. <td style="width: 3vh">
  180. {{ item.sameperiod }}
  181. </td>
  182. </template>
  183. </tr> -->
  184. </tbody>
  185. </table>
  186. </div>
  187. <!-- </el-scrollbar> -->
  188. </div>
  189. </el-col>
  190. </el-row>
  191. <el-row :gutter="20" class="table-panel">
  192. <el-col :span="24">
  193. <!-- <panel title="公司可利用率分析" :showLine="false"> -->
  194. <panel title="风能利用率分析" :showLine="false">
  195. <!-- <vertival-bar-line-chart
  196. :height="'360px'"
  197. :units="units"
  198. :bardata="bardata"
  199. :lineData="lineData"
  200. /> -->
  201. <MultipleLineChart
  202. :list="DayPower.value"
  203. :units="DayPower.units"
  204. height="40vh"
  205. :showLegend="true"
  206. />
  207. <!-- :units="units"
  208. :bardata="bardata"
  209. :lineData="lineData" -->
  210. </panel>
  211. </el-col>
  212. </el-row>
  213. </div>
  214. </template>
  215. <script>
  216. // import VertivalBarLineChart from "../../components/chart/combination/vertival-bar-line-chart.vue";
  217. // import VertivalBarLineChart from "../../components/chart/bar/list-bar-chart.vue";
  218. import MultipleLineChart from "../../components/chart/bar/multiple-bar-chart.vue";
  219. import Panel from "../../components/coms/panel/panel.vue";
  220. import DualPieChart from "../../components/chart/pie/dual-pie-chart.vue";
  221. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  222. import Get_PDF from "@tools/htmlToPdf";
  223. import api from "@api/economic/index.js";
  224. export default {
  225. setup() {},
  226. components: {
  227. Panel,
  228. DualPieChart,
  229. SvgIcon,
  230. // VertivalBarLineChart,
  231. MultipleLineChart,
  232. },
  233. data() {
  234. return {
  235. monthData: [],
  236. MhsLists: [],
  237. NshList: [],
  238. QshList: [],
  239. SbaqList: [],
  240. XshList: [],
  241. GsList: [],
  242. units: [],
  243. stations:{},
  244. nowCurrent: 1,
  245. months: new Date().getMonth() + 1,
  246. pickerOptions: {},
  247. bardata: { area: [], legend: [], data: [] }, // 损失电量分析echart数值
  248. lineData: [],
  249. timmer: null,
  250. monthValue: this.getmonthValue(),
  251. list: [],
  252. DayPower: {
  253. // 图表所用单位
  254. units: [""],
  255. value: [
  256. {
  257. title: "",
  258. yAxisIndex: 0, // 使用单位
  259. value: [],
  260. },
  261. ],
  262. },
  263. };
  264. },
  265. created() {
  266. let _this = this;
  267. // _this.$nextTick(() => {
  268. _this.getLists(false);
  269. // _this.timmer = setInterval(() => {
  270. // _this.getLists(false)
  271. // }, _this.$store.state.websocketTimeSec);
  272. // });
  273. },
  274. unmounted() {
  275. clearInterval(this.timmer);
  276. this.timmer = null;
  277. },
  278. mounted() {},
  279. methods: {
  280. exportPDF(name) {
  281. this.BASE.showMsg({
  282. type: "success",
  283. msg: "正在导出...请稍后...",
  284. });
  285. Get_PDF.downloadPDF(document.querySelector(".pdfDom"), "风能利用率");
  286. },
  287. getmonthValue() {
  288. let year = new Date().getFullYear().toString();
  289. return year;
  290. },
  291. onClickSearch() {
  292. this.getLists(false);
  293. },
  294. monthChange(data) {
  295. let year = data.getFullYear().toString();
  296. return year;
  297. },
  298. isNumber(val) {
  299. return typeof val === "number" && !isNaN(val);
  300. },
  301. getLists(showLoading) {
  302. let MhsLists = [];
  303. let NshList = [];
  304. let QshList = [];
  305. let SbaqList = [];
  306. let XshList = [];
  307. let GsList = [];
  308. let _this = this;
  309. let year = "";
  310. if (typeof this.monthValue === "string") {
  311. year = this.monthValue;
  312. } else {
  313. year = this.monthChange(this.monthValue);
  314. }
  315. const site = ["compare", "year", "month"];
  316. api.specificFnlylList({
  317. year: year,
  318. }).then((res) => {
  319. let stations = {}
  320. let company ={
  321. id:'0',
  322. name:'公司',
  323. children: []
  324. }
  325. this.list = res.data.map((item) => {
  326. for (let key in item) {
  327. if (!site.includes(key)) {
  328. if (this.isNumber(item[key])) {
  329. item[key] = item[key].toFixed(2);
  330. } else if (!item[key]) {
  331. item[key] = 0;
  332. item[key] = item[key].toFixed(2);
  333. }
  334. }
  335. }
  336. if(item.wpid === "0"){
  337. company.children.push(item)
  338. }
  339. if(!stations[item.wpid] && item.wpid !== "0" ){
  340. stations[item.wpid] = {
  341. id:item.wpid,
  342. name:item.wpname||'',
  343. children: []
  344. }
  345. }
  346. stations[item.wpid]?.children.push(item)
  347. if (item.wpid === "0") {
  348. GsList.push(item);
  349. }
  350. });
  351. stations.company = company
  352. for (const item in stations) {
  353. stations[item].children = stations[item].children.sort(this.compare("month"));
  354. }
  355. console.log(stations);
  356. this.stations = stations
  357. this.MhsLists = MhsLists.sort(this.compare("month"));
  358. this.NshList = NshList.sort(this.compare("month"));
  359. this.QshList = QshList.sort(this.compare("month"));
  360. this.SbaqList = SbaqList.sort(this.compare("month"));
  361. this.XshList = XshList.sort(this.compare("month"));
  362. this.GsList = GsList.sort(this.compare("month"));
  363. let nowCureent = [];
  364. let sameCureent = [];
  365. let monthData = [];
  366. let monthsAll = [];
  367. this.GsList.map((item) => {
  368. let objs = {};
  369. let obj = {};
  370. monthsAll.push(item.month);
  371. if (item.month > 10) {
  372. objs.text = item.month.toString();
  373. obj.text = item.month.toString();
  374. } else {
  375. item.text = "0" + item.month;
  376. objs.text = item.text;
  377. obj.text = item.text;
  378. }
  379. for (let key in item) {
  380. if (key === "current") {
  381. objs.value = item.current;
  382. nowCureent.push(objs);
  383. } else if (key === "sameperiod") {
  384. obj.value = item.sameperiod;
  385. sameCureent.push(obj);
  386. }
  387. }
  388. });
  389. this.monthData = monthsAll;
  390. this.DayPower = {
  391. // 图表所用单位
  392. units: [""],
  393. value: [
  394. {
  395. title: "本期",
  396. yAxisIndex: 0, // 使用单位
  397. value: nowCureent,
  398. // nowCureent
  399. },
  400. {
  401. title: "同期",
  402. yAxisIndex: 0, // 使用单位
  403. value: sameCureent,
  404. // sameCureent
  405. },
  406. ],
  407. };
  408. });
  409. // _this.API.requestData({
  410. // showLoading,
  411. // method: "GET",
  412. // baseURL: "http://10.155.32.4:8034",
  413. // subUrl: "/specific/fnlylList",
  414. // data: {
  415. // year: year,
  416. // },
  417. // success(res) {
  418. // _this.list = res.data.map((item) => {
  419. // for (let key in item) {
  420. // if (!site.includes(key)) {
  421. // if (_this.isNumber(item[key])) {
  422. // item[key] = item[key].toFixed(2);
  423. // } else if (!item[key]) {
  424. // item[key] = 0;
  425. // item[key] = item[key].toFixed(2);
  426. // }
  427. // }
  428. // }
  429. // if (item.wpid === "MHS_FDC") {
  430. // MhsLists.push(item);
  431. // } else if (item.wpid === "NSS_FDC") {
  432. // NshList.push(item);
  433. // } else if (item.wpid === "QS_FDC") {
  434. // QshList.push(item);
  435. // } else if (item.wpid === "NSS_FDC") {
  436. // NshList.push(item);
  437. // } else if (item.wpid === "SBQ_FDC") {
  438. // SbaqList.push(item);
  439. // } else if (item.wpid === "XS_FDC") {
  440. // XshList.push(item);
  441. // } else {
  442. // GsList.push(item);
  443. // }
  444. // });
  445. // _this.MhsLists = MhsLists.sort(_this.compare("month"));
  446. // _this.NshList = NshList.sort(_this.compare("month"));
  447. // _this.QshList = QshList.sort(_this.compare("month"));
  448. // _this.SbaqList = SbaqList.sort(_this.compare("month"));
  449. // _this.XshList = XshList.sort(_this.compare("month"));
  450. // _this.GsList = GsList.sort(_this.compare("month"));
  451. // let nowCureent = [];
  452. // let sameCureent = [];
  453. // let monthData = [];
  454. // let monthsAll = [];
  455. // _this.GsList.map((item) => {
  456. // let objs = {};
  457. // let obj = {};
  458. // monthsAll.push(item.month);
  459. // if (item.month > 10) {
  460. // objs.text = item.month.toString();
  461. // obj.text = item.month.toString();
  462. // } else {
  463. // item.text = "0" + item.month;
  464. // objs.text = item.text;
  465. // obj.text = item.text;
  466. // }
  467. // for (let key in item) {
  468. // if (key === "current") {
  469. // objs.value = item.current;
  470. // nowCureent.push(objs);
  471. // } else if (key === "sameperiod") {
  472. // obj.value = item.sameperiod;
  473. // sameCureent.push(obj);
  474. // }
  475. // }
  476. // });
  477. // _this.monthData = monthsAll;
  478. // _this.DayPower = {
  479. // // 图表所用单位
  480. // units: [""],
  481. // value: [
  482. // {
  483. // title: "本期",
  484. // yAxisIndex: 0, // 使用单位
  485. // value: nowCureent,
  486. // // nowCureent
  487. // },
  488. // {
  489. // title: "同期",
  490. // yAxisIndex: 0, // 使用单位
  491. // value: sameCureent,
  492. // // sameCureent
  493. // },
  494. // ],
  495. // };
  496. // _this.DayPower = {
  497. // // 图表所用单位
  498. // units: [""],
  499. // value: [
  500. // {
  501. // title: "本期",
  502. // yAxisIndex: 0, // 使用单位
  503. // value: [],
  504. // },
  505. // {
  506. // title: "同期",
  507. // yAxisIndex: 0, // 使用单位
  508. // value: [],
  509. // },
  510. // ],
  511. // },
  512. // _this.bardata.legend = ["本期", "同期"]
  513. // _this.lineData = [];
  514. // _this.bardata.area = monthData;
  515. // _this.bardata.data[0] = sameCureent;
  516. // _this.bardata.data[1] = nowCureent;
  517. // },
  518. // });
  519. },
  520. compare(property) {
  521. return (a, b) => {
  522. let val1 = a[property];
  523. let val2 = b[property];
  524. return val1 - val2;
  525. };
  526. },
  527. },
  528. };
  529. </script>
  530. <style lang="less">
  531. .ztfx {
  532. font-size: 12px;
  533. .select-btn {
  534. width: 92px;
  535. }
  536. .com-panel {
  537. border: 1px solid #6067697d;
  538. }
  539. .table-complex {
  540. margin-top: 10px;
  541. .table {
  542. border: 1px solid #6067697d;
  543. tbody {
  544. tr:nth-child(2n) td {
  545. background-color: fade(@gray, 20%);
  546. &.item {
  547. background-color: transparent;
  548. }
  549. }
  550. }
  551. th {
  552. background: fade(@gray, 40);
  553. font-size: 12px;
  554. font-weight: 400;
  555. line-height: 24px;
  556. color: @gray-l;
  557. &.type1 {
  558. border-left: 0;
  559. border-right: 0;
  560. }
  561. }
  562. td {
  563. color: @gray-l;
  564. text-align: center;
  565. height: 26px;
  566. line-height: 26px;
  567. // &.item {
  568. // width: 100px;
  569. // }
  570. }
  571. svg {
  572. height: 1.222vh;
  573. }
  574. }
  575. }
  576. .table-panel {
  577. margin-top: 10px;
  578. .panel-header {
  579. text-align: center;
  580. }
  581. .table {
  582. border: 1px solid #6067697d;
  583. tbody {
  584. tr:nth-child(2n) td {
  585. background-color: fade(@gray, 20%);
  586. &.item {
  587. background-color: transparent;
  588. }
  589. }
  590. }
  591. .td-item {
  592. width: 6vh;
  593. }
  594. th {
  595. background: fade(@gray, 40);
  596. font-size: 12px;
  597. font-weight: 400;
  598. line-height: 24px;
  599. color: @gray-l;
  600. &.type1 {
  601. border-left: 0;
  602. border-right: 0;
  603. height: 4vh;
  604. }
  605. }
  606. td {
  607. color: @gray-l;
  608. text-align: center;
  609. height: 46px;
  610. line-height: 46px;
  611. &.item {
  612. width: 100px;
  613. }
  614. }
  615. svg {
  616. height: 1.222vh;
  617. }
  618. }
  619. }
  620. .pie-chart-panel {
  621. margin-top: 10px;
  622. .line {
  623. border: none;
  624. }
  625. }
  626. }
  627. </style>