Decision1.vue 14 KB

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