Decision1.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <div class="decision-page-1">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item">
  6. <div class="lable">场站:</div>
  7. <div class="search-input">
  8. <el-select
  9. v-model="value1"
  10. @change="ChangZhanChange(value1)"
  11. clearable
  12. placeholder="请选择"
  13. popper-class="select"
  14. >
  15. <el-option
  16. v-for="item in ChangZhan"
  17. :key="item.id"
  18. :value="item.id"
  19. :label="item.name"
  20. >
  21. </el-option>
  22. </el-select>
  23. </div>
  24. </div>
  25. <div class="query-item">
  26. <div class="lable">项目:</div>
  27. <div class="search-input">
  28. <el-select
  29. v-model="value2"
  30. @change="XiangMuChange(value2)"
  31. multiple
  32. collapse-tags
  33. placeholder="请选择"
  34. popper-class="select"
  35. >
  36. <el-option
  37. v-for="item in XiangMu"
  38. :key="item.id"
  39. :value="item.id"
  40. :label="item.name"
  41. >
  42. </el-option>
  43. </el-select>
  44. </div>
  45. </div>
  46. <div class="query-item">
  47. <div class="lable">线路:</div>
  48. <div class="search-input">
  49. <el-select
  50. v-model="value3"
  51. @change="XianLuChange(value3)"
  52. multiple
  53. collapse-tags
  54. placeholder="请选择"
  55. popper-class="select"
  56. >
  57. <el-option
  58. v-for="item in XianLu"
  59. :key="item.id"
  60. :label="item.name"
  61. :value="item.id"
  62. >
  63. </el-option>
  64. </el-select>
  65. </div>
  66. </div>
  67. <div class="query-item">
  68. <div class="lable">开始日期:</div>
  69. <div class="search-input">
  70. <el-date-picker
  71. v-model="value4"
  72. @change="BeginChange(value4)"
  73. type="date"
  74. value-format="YYYY-MM-DD"
  75. placeholder="选择日期"
  76. popper-class="date-select"
  77. >
  78. </el-date-picker>
  79. </div>
  80. </div>
  81. <div class="query-item">
  82. <div class="lable">结束日期:</div>
  83. <div class="search-input">
  84. <el-date-picker
  85. v-model="value5"
  86. @change="EndChange(value5)"
  87. type="date"
  88. value-format="YYYY-MM-DD"
  89. placeholder="选择日期"
  90. popper-class="date-select"
  91. >
  92. </el-date-picker>
  93. <div class="unit svg-icon svg-icon-gray">
  94. <svg-icon :svgid="''" />
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="query-actions" style="margin-left: 0px">
  100. <button class="btn green" @click="AjaxCommon()">搜索</button>
  101. <button class="btn" @click="mxClick()">明细信息</button>
  102. <button class="btn" @click="exportExcel()">导出</button>
  103. </div>
  104. </div>
  105. <div class="actions mg-b-8">
  106. <button
  107. class="btn"
  108. :class="TypeClass == 1 ? 'green' : ''"
  109. @click="TypeClick(1)"
  110. >
  111. 风场
  112. </button>
  113. <button
  114. class="btn"
  115. :class="TypeClass == 2 ? 'green' : ''"
  116. @click="TypeClick(2)"
  117. >
  118. 项目
  119. </button>
  120. <button
  121. class="btn"
  122. :class="TypeClass == 3 ? 'green' : ''"
  123. @click="TypeClick(3)"
  124. >
  125. 集电线路
  126. </button>
  127. </div>
  128. <el-row :type="'flex'" class="content">
  129. <el-col :span="12" class="pd-r-8">
  130. <toolbar-panel title="风机绩效榜 (万kWh)" :showLine="false">
  131. <bar-line-chart
  132. :height="'calc(100vh - 180px)'"
  133. :bardata="bardata"
  134. :lineData="lineData"
  135. :color="barColor"
  136. lineName="理论发电量"
  137. />
  138. </toolbar-panel>
  139. </el-col>
  140. <el-col :span="12" class="pd-l-8">
  141. <panel :title="'项目列表'" :showLine="false">
  142. <div class="project-table">
  143. <!-- 分页Table -->
  144. <Table :data="tableData" :height="'calc(80vh - 50px)'">
  145. <template v-slot:tr v-if="tableData.data.length > 0">
  146. <tr>
  147. <td style="width: 50px">
  148. {{ tableDataEnd.index }}
  149. </td>
  150. <td style="width: 150px">
  151. {{ tableDataEnd.name }}
  152. </td>
  153. <td>
  154. {{ tableDataEnd.llfdl }}
  155. </td>
  156. <td>
  157. {{ tableDataEnd.sjfdl }}
  158. </td>
  159. <td>
  160. {{ tableDataEnd.speed }}
  161. </td>
  162. <td>
  163. {{ tableDataEnd.fjhjx }}
  164. </td>
  165. <td>
  166. {{ tableDataEnd.jhjx }}
  167. </td>
  168. <td style="width: 80px">
  169. {{ tableDataEnd.sl }}
  170. </td>
  171. <td>
  172. {{ tableDataEnd.xd }}
  173. </td>
  174. <td>
  175. {{ tableDataEnd.xn }}
  176. </td>
  177. <td>
  178. {{ tableDataEnd.fnlly }}
  179. </td>
  180. </tr>
  181. </template>
  182. </Table>
  183. <!-- <Table :data="tableData"></Table> -->
  184. </div>
  185. </panel>
  186. </el-col>
  187. </el-row>
  188. </div>
  189. </template>
  190. <script>
  191. import BarLineChart from "../../components/chart/combination/bar-line-chart.vue";
  192. import Panel from "../../components/coms/panel/panel.vue";
  193. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  194. import ToolbarPanel from "../../components/coms/panel/toolbar-panel.vue";
  195. import Table from "./table.vue";
  196. import partten from "@/helper/partten.js";
  197. import api from "@api/economic/index.js";
  198. export default {
  199. components: {
  200. ToolbarPanel,
  201. BarLineChart,
  202. Panel,
  203. Table,
  204. partten,
  205. SvgIcon,
  206. },
  207. data() {
  208. return {
  209. tableData: {
  210. column: [
  211. {
  212. name: "",
  213. field: "index",
  214. is_num: false,
  215. is_light: false,
  216. width: "50px",
  217. },
  218. {
  219. name: "名称",
  220. field: "name",
  221. width: "150px",
  222. is_num: false,
  223. is_light: false,
  224. },
  225. {
  226. name: "理论发电量(万kWh)",
  227. field: "llfdl",
  228. is_num: false,
  229. is_light: false,
  230. sortable: true,
  231. },
  232. {
  233. name: "SCADA发电量(万kWh)",
  234. field: "sjfdl",
  235. is_num: false,
  236. is_light: false,
  237. sortable: true,
  238. },
  239. {
  240. name: "风速(m/s)",
  241. field: "speed",
  242. is_num: false,
  243. is_light: false,
  244. sortable: true,
  245. },
  246. {
  247. name: "非计划检修(万kWh)",
  248. field: "fjhjx",
  249. is_num: false,
  250. is_light: false,
  251. sortable: true,
  252. },
  253. {
  254. name: "计划检修(万kWh)",
  255. field: "jhjx",
  256. is_num: false,
  257. is_light: false,
  258. sortable: true,
  259. },
  260. {
  261. name: "受累(万kWh)",
  262. field: "sl",
  263. width: "80px",
  264. is_num: false,
  265. is_light: false,
  266. sortable: true,
  267. },
  268. {
  269. name: "限电(万kWh)",
  270. field: "xd",
  271. is_num: false,
  272. is_light: false,
  273. sortable: true,
  274. },
  275. {
  276. name: "性能(万kWh)",
  277. field: "xn",
  278. is_num: false,
  279. is_light: false,
  280. sortable: true,
  281. },
  282. {
  283. name: "风能利用率(%)",
  284. field: "fnlly",
  285. is_num: false,
  286. is_light: false,
  287. sortable: true,
  288. },
  289. ],
  290. data: [],
  291. },
  292. tableDataEnd: [], //合计
  293. ChangZhan: [], //场站
  294. XiangMu: [], //项目
  295. XianLu: [], //线路
  296. value1: [],
  297. value2: [],
  298. value3: [],
  299. value4: "",
  300. value5: "",
  301. barColor: [
  302. "#05bb4c",
  303. "#e17e23",
  304. "#ba3237",
  305. "#c531c7",
  306. "#ccf0d3",
  307. "#4b55ae",
  308. ],
  309. TypeClass: 1, //风场,项目,集电线路 的按钮颜色,默认第一个
  310. bardata: [],
  311. lineData: [],
  312. };
  313. },
  314. created() {
  315. this.ChangZhanVal();
  316. this.value4 = this.getTime(1);
  317. this.value5 = this.getTime(2);
  318. this.AjaxCommon();
  319. },
  320. methods: {
  321. ChangZhanVal() {
  322. api.benchmarkingWplist({}).then((res) => {
  323. this.ChangZhan = res.data;
  324. });
  325. // var that = this;
  326. // that.API.requestData({
  327. // method: "GET",
  328. // baseURL: "http://10.83.66.220:8020/",
  329. // subUrl: "/consumer/benchmarking/wplist",
  330. // success(res) {
  331. // that.ChangZhan = res.data;
  332. // },
  333. // });
  334. },
  335. ChangZhanChange(val) {
  336. this.TypeClass = "";
  337. this.value1 = val;
  338. this.value2 = [];
  339. this.value3 = [];
  340. this.AjaxCommon();
  341. this.XiangMuVal(val);
  342. },
  343. XiangMuVal(val) {
  344. api
  345. .benchmarkingProjectList({
  346. wpids: val,
  347. })
  348. .then((res) => {
  349. this.XiangMu = res.data;
  350. });
  351. // var that = this;
  352. // that.API.requestData({
  353. // method: "GET",
  354. // baseURL: "http://10.83.66.220:8020/",
  355. // subUrl: "/consumer/benchmarking/projectList",
  356. // data: {
  357. // wpids: val,
  358. // },
  359. // success(res) {
  360. // that.XiangMu = res.data;
  361. // },
  362. // });
  363. },
  364. XiangMuChange(val) {
  365. this.TypeClass = "";
  366. this.value2 = val;
  367. this.value3 = [];
  368. this.AjaxCommon();
  369. this.XianLuVal(val);
  370. },
  371. XianLuVal(val) {
  372. api
  373. .benchmarkingLineList({
  374. projects: val,
  375. })
  376. .then((res) => {
  377. this.XianLu = res.data;
  378. });
  379. // var that = this;
  380. // that.API.requestData({
  381. // method: "GET",
  382. // baseURL: "http://10.83.66.220:8020/",
  383. // subUrl: "/consumer/benchmarking/lineList",
  384. // data: {
  385. // projects: val,
  386. // },
  387. // success(res) {
  388. // that.XianLu = res.data;
  389. // },
  390. // });
  391. },
  392. XianLuChange(val) {
  393. this.TypeClass = "";
  394. this.value3 = val;
  395. this.AjaxCommon();
  396. },
  397. BeginChange(val) {
  398. this.value4 = val;
  399. this.AjaxCommon();
  400. },
  401. EndChange(val) {
  402. this.value5 = val;
  403. this.AjaxCommon();
  404. },
  405. TypeClick(val) {
  406. this.TypeClass = val;
  407. // 重置状态start
  408. this.value1 = "";
  409. this.value2 = [];
  410. this.value3 = [];
  411. // this.value4 = this.getTime(1);
  412. // this.value5 = this.getTime(2);
  413. this.AjaxCommon();
  414. // 重置状态end
  415. },
  416. getTime(val) {
  417. //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  418. var date = new Date();
  419. var year = date.getFullYear(),
  420. month = date.getMonth() + 1,
  421. day = date.getDate();
  422. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  423. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  424. var begin = year + "-" + month + "-01";
  425. var end = year + "-" + month + "-" + day;
  426. if (val == 1) {
  427. return begin;
  428. } else if (val == 2) {
  429. return end;
  430. }
  431. },
  432. AjaxCommon() {
  433. api
  434. .benchmarking({
  435. wpids: this.value1,
  436. projectids: this.value2,
  437. lineids: this.value3,
  438. beginDate: this.value4,
  439. endDate: this.value5,
  440. type: this.TypeClass,
  441. target: "",
  442. sort: "",
  443. })
  444. .then((res) => {
  445. if (res) {
  446. var name = [],
  447. data = [],
  448. llfdl = [],
  449. legend = [
  450. "实际电量",
  451. "计划检修损失",
  452. "非计划检修损失",
  453. "限电损失",
  454. "受累损失",
  455. "性能损失",
  456. ],
  457. data2 = []; //项目列表
  458. res.data.forEach((item, index) => {
  459. name.push(item.name);
  460. data.push([
  461. item.sjfdl,
  462. item.jhjx,
  463. item.fjhjx,
  464. item.xd,
  465. item.sl,
  466. item.xn,
  467. ]);
  468. llfdl.push(item.llfdl);
  469. data2.push({
  470. index: index + 1,
  471. name: item.name,
  472. llfdl: item.llfdl,
  473. sjfdl: item.sjfdl,
  474. speed: item.speed,
  475. fjhjx: item.fjhjx,
  476. jhjx: item.jhjx,
  477. sl: item.sl,
  478. xd: item.xd,
  479. xn: item.xn,
  480. fnlly: item.fnlly,
  481. is_light: false,
  482. });
  483. });
  484. name.pop();
  485. data.pop();
  486. llfdl.pop();
  487. if (data.length > 0) {
  488. let arr1 = [];
  489. const length = data[0].length;
  490. for (var i = 0; i < length; i++) {
  491. let arr2 = [];
  492. data.forEach((ele) => {
  493. arr2.push(ele[i]);
  494. });
  495. arr1.push(arr2);
  496. }
  497. this.lineData = llfdl;
  498. this.bardata = {
  499. area: name,
  500. legend: legend,
  501. data: arr1,
  502. };
  503. }
  504. this.tableDataEnd = data2[data2.length - 1];
  505. data2.pop();
  506. this.tableData.data = data2;
  507. }
  508. });
  509. // var that = this;
  510. // that.API.requestData({
  511. // method: "GET",
  512. // baseURL: process.env.VUE_APP_API,
  513. // subUrl: "consumer/benchmarking/fjjxb",
  514. // data: {
  515. // wpids: that.value1,
  516. // projectids: that.value2,
  517. // lineids: that.value3,
  518. // beginDate: that.value4,
  519. // endDate: that.value5,
  520. // type: that.TypeClass,
  521. // target: "",
  522. // sort: "",
  523. // },
  524. // success(res) {
  525. // var name = [],
  526. // data = [],
  527. // llfdl = [],
  528. // legend = [
  529. // "实际电量",
  530. // "计划检修损失",
  531. // "非计划检修损失",
  532. // "限电损失",
  533. // "受累损失",
  534. // "性能损失",
  535. // ],
  536. // data2 = []; //项目列表
  537. // res.data.forEach((item, index) => {
  538. // name.push(item.name);
  539. // data.push([
  540. // item.sjfdl,
  541. // item.jhjx,
  542. // item.fjhjx,
  543. // item.xd,
  544. // item.sl,
  545. // item.xn,
  546. // ]);
  547. // llfdl.push(item.llfdl);
  548. // data2.push({
  549. // index: index + 1,
  550. // name: item.name,
  551. // llfdl: item.llfdl,
  552. // sjfdl: item.sjfdl,
  553. // speed: item.speed,
  554. // fjhjx: item.fjhjx,
  555. // jhjx: item.jhjx,
  556. // sl: item.sl,
  557. // xd: item.xd,
  558. // xn: item.xn,
  559. // fnlly: item.fnlly,
  560. // is_light: false,
  561. // });
  562. // });
  563. // name.pop();
  564. // data.pop();
  565. // llfdl.pop();
  566. // if (data.length > 0) {
  567. // let arr1 = [];
  568. // const length = data[0].length;
  569. // for (var i = 0; i < length; i++) {
  570. // let arr2 = [];
  571. // data.forEach((ele) => {
  572. // arr2.push(ele[i]);
  573. // });
  574. // arr1.push(arr2);
  575. // }
  576. // that.lineData = llfdl;
  577. // that.bardata = {
  578. // area: name,
  579. // legend: legend,
  580. // data: arr1,
  581. // };
  582. // }
  583. // that.tableDataEnd = data2[data2.length - 1];
  584. // data2.pop();
  585. // that.tableData.data = data2;
  586. // },
  587. // });
  588. },
  589. mxClick() {
  590. this.$router.push("/decision/decision1Mx");
  591. },
  592. formatJson(filterVal, jsonData) {
  593. return jsonData.map((v) => filterVal.map((j) => v[j]));
  594. },
  595. exportExcel() {
  596. let that = this;
  597. const { export_json_to_excel } = require("@tools/excel/Export2Excel.js"); // 注意这个Export2Excel路径
  598. let tHeader = []; // 上面设置Excel的表格第一行的标题
  599. let filterVal = []; // 上面的index、nickName、name是tableData里对象的属性key值
  600. that.tableData.column.forEach((ele) => {
  601. tHeader.push(ele.name);
  602. filterVal.push(ele.field);
  603. });
  604. var list = [];
  605. that.tableData.data.forEach((i, index) => {
  606. list.push(i);
  607. });
  608. list.push(that.tableDataEnd);
  609. const data = that.formatJson(filterVal, list);
  610. export_json_to_excel(tHeader, data, "风机绩效榜"); // 最后一个是表名字
  611. },
  612. },
  613. };
  614. </script>
  615. <style lang="less">
  616. .decision-page-1 {
  617. .com-panel .panel-title {
  618. line-height: 3.4259vh;
  619. }
  620. .tools {
  621. display: flex;
  622. line-height: 3.4259vh;
  623. .tool-block {
  624. display: flex;
  625. align-items: center;
  626. margin-left: 0.741vh;
  627. .legend {
  628. flex: auto;
  629. width: 0.741vh;
  630. height: 0.741vh;
  631. margin-right: 0.741vh;
  632. &.long {
  633. width: 2.963vh;
  634. height: 0.37vh;
  635. }
  636. }
  637. .legend-text {
  638. color: @gray-l;
  639. font-size: @fontsize-s;
  640. }
  641. }
  642. }
  643. .project-table {
  644. overflow: auto;
  645. tbody {
  646. height: calc(100vh - 24.5vh);
  647. }
  648. td {
  649. color: #b2bdc0;
  650. }
  651. }
  652. .contentMx {
  653. width: 100%;
  654. overflow-x: auto;
  655. }
  656. .activeMx {
  657. width: 150%;
  658. }
  659. }
  660. </style>