Decision1.vue 17 KB

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