historyDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. <template>
  2. <div class="historysingleMachine">
  3. <div class="historysingleMachine_top">
  4. <!-- <el-select size="mini" v-model="hiscompanyVal" placeholder="请选择">
  5. <el-option
  6. v-for="item in historyCompanyOptions"
  7. :key="item.id"
  8. :label="item.aname"
  9. :value="item.id"
  10. >
  11. </el-option>
  12. </el-select>
  13. <div class="tabCut">
  14. <div
  15. @click="changeBtn(val.id)"
  16. :class="tabIndex === val.id ? 'active' : ''"
  17. v-for="val in tabOptions"
  18. :key="val.id"
  19. >
  20. <span>{{ val.name }}</span>
  21. </div>
  22. </div>
  23. <div class="station">
  24. 场站:
  25. <el-select
  26. size="mini"
  27. v-model="hisstationVal"
  28. placeholder="请选择"
  29. clearable
  30. @change="changeStation"
  31. >
  32. <el-option
  33. v-for="item in historyStationOptions"
  34. :key="item.id"
  35. :label="item.name"
  36. :value="item.id"
  37. >
  38. </el-option>
  39. </el-select>
  40. </div>
  41. <div class="station">
  42. 机组:
  43. <el-select
  44. size="mini"
  45. v-model="hiswindVal"
  46. placeholder="请选择"
  47. clearable
  48. @change="changeWind"
  49. >
  50. <el-option
  51. v-for="item in hisWindOptions"
  52. :key="item.id"
  53. :label="item.aname"
  54. :value="item.id"
  55. >
  56. </el-option>
  57. </el-select>
  58. </div>-->
  59. <div class="stationsv">
  60. <span class="timeaa">时间:</span>
  61. <el-date-picker
  62. v-model="pickerTimer"
  63. type="daterange"
  64. range-separator="To"
  65. start-placeholder="开始时间"
  66. end-placeholder="结束时间"
  67. size="mini"
  68. format="YYYY/MM/DD"
  69. value-format="YYYY-MM-DD"
  70. />
  71. </div>
  72. <div class="but">
  73. <el-button round size="mini" class="buttons" @click="seachData"
  74. >搜索</el-button
  75. >
  76. <el-button round size="mini" class="buttons" @click="downXlsxFn"
  77. >导出</el-button
  78. >
  79. </div>
  80. </div>
  81. <div class="economicTable1">
  82. <el-table
  83. :data="historysingleMachineData"
  84. stripe
  85. size="mini"
  86. height="80vh"
  87. ref="historysingleTable"
  88. style="width: 100%"
  89. >
  90. <el-table-column
  91. align="center"
  92. :label="tabIndex === -1 ? '风机' : '逆变器'"
  93. width="130"
  94. fixed="left"
  95. >
  96. <template #default="{ row }">
  97. <span>{{ tabIndex === -1 ? row.wtcode : row.wtname }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. align="center"
  102. prop="recordDate"
  103. label="日期"
  104. width="150"
  105. fixed="left"
  106. >
  107. <template #default="scope">
  108. <span>{{ dateTimeFn(scope.row) }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column
  112. v-for="(item, index) in tabIndex === -1 ? tableHeader : tableHeaderGf"
  113. :key="index"
  114. sortable
  115. :prop="item.code"
  116. :label="item.title"
  117. show-overflow-tooltip
  118. align="center"
  119. >
  120. <template #header="scope">
  121. <div>{{ scope.column.label }}</div>
  122. </template>
  123. </el-table-column>
  124. </el-table>
  125. <el-pagination
  126. @current-change="handleCurrentChange"
  127. :current-page="page.currentPage"
  128. :page-size="page.pagesize"
  129. layout="total, prev, pager, next, jumper"
  130. :total="page.total"
  131. >
  132. </el-pagination>
  133. </div>
  134. </div>
  135. </template>
  136. <script>
  137. import {
  138. getApihistorywindturbinegoodnesslist,
  139. getApihistorywindturbinegoodnesslistGf,
  140. getApiequipmentListByWp,
  141. } from "@/api/monthlyPerformanceAnalysis";
  142. import utils from "@/utills/downXlsx";
  143. export default {
  144. props: {
  145. // historyCompanyOptions: {
  146. // type: Array,
  147. // default: () => [],
  148. // },
  149. tabIndex: { type: Number, required: true },
  150. historyStationOptions: {
  151. type: Array,
  152. default: () => [],
  153. },
  154. },
  155. data() {
  156. return {
  157. // hiscompanyVal: "",
  158. hisstationVal: "",
  159. hiswindVal: "",
  160. pickerTimer: [],
  161. historysingleMachineData: [],
  162. hisWindOptions: [],
  163. showBtn: true,
  164. page: {
  165. pagesize: 11,
  166. currentPage: 1,
  167. total: 0,
  168. },
  169. // tabIndex: -1,
  170. // tabOptions: [
  171. // { id: -1, name: "风电" },
  172. // { id: -2, name: "光伏" },
  173. // ],
  174. tableHeader: [
  175. { title: "日发电量", code: "rfdl" },
  176. { title: "月发电量", code: "yfdl" },
  177. { title: "年发电量", code: "nfdl" },
  178. { title: "日应发电量", code: "ryfdl" },
  179. { title: "月应发电量", code: "yyfdl" },
  180. { title: "年应发电量", code: "nyfdl" },
  181. { title: "日平均功率", code: "rpjgl" },
  182. { title: "月平均功率", code: "ypjgl" },
  183. { title: "年平均功率", code: "npjgl" },
  184. { title: "日平均风速", code: "rpjfs" },
  185. { title: "月平均风速", code: "ypjfs" },
  186. { title: "年平均风速", code: "npjfs" },
  187. { title: "日运行小时", code: "ryxxs" },
  188. { title: "月运行小时", code: "yyxxs" },
  189. { title: "年运行小时", code: "nyxxs" },
  190. { title: "日待机小时", code: "rdjxs" },
  191. { title: "月待机小时", code: "ydjxs" },
  192. { title: "年待机小时", code: "ndjxs" },
  193. { title: "日故障小时", code: "rgzxs" },
  194. { title: "月故障小时", code: "ygzxs" },
  195. { title: "年故障小时", code: "ngzxs" },
  196. { title: "日检修小时", code: "rjxxs" },
  197. { title: "月检修小时", code: "yjxxs" },
  198. { title: "年检修小时", code: "njxxs" },
  199. { title: "日中断小时", code: "rzdxs" },
  200. { title: "月中断小时", code: "yzdxs" },
  201. { title: "年中断小时", code: "nzdxs" },
  202. { title: "日有效风时", code: "ryxfs" },
  203. { title: "月有效风时", code: "yyxfs" },
  204. { title: "年有效风时", code: "nyxfs" },
  205. { title: "日损失电量", code: "rssdl" },
  206. { title: "月损失电量", code: "yssdl" },
  207. { title: "年损失电量", code: "nssdl" },
  208. { title: "日报警次数", code: "rbjcs" },
  209. { title: "月报警次数", code: "ybjcs" },
  210. { title: "年报警次数", code: "nbjcs" },
  211. { title: "日停机次数", code: "rtjcs" },
  212. { title: "月停机次数", code: "ytjcs" },
  213. { title: "年停机数", code: "ntjcs" },
  214. { title: "日不饱和数", code: "rbbhcs" },
  215. { title: "月不饱和数", code: "ybbhcs" },
  216. { title: "年不饱和数", code: "nbbhcs" },
  217. { title: "日可利用率", code: "rsbklyl" },
  218. { title: "月可利用率", code: "ysbklyl" },
  219. { title: "年可利用率", code: "nsbklyl" },
  220. { title: "日平均温度", code: "rpjwd" },
  221. { title: "月平均温度", code: "ypjwd" },
  222. { title: "年平均温度", code: "npjwd" },
  223. { title: "日平均湿度", code: "rpjsd" },
  224. { title: "月平均湿度", code: "ypjsd" },
  225. { title: "年平均湿度", code: "npjsd" },
  226. { title: "日平均压强", code: "rpjyq" },
  227. { title: "月平均压强", code: "ypjyq" },
  228. { title: "年平均压强", code: "npjyq" },
  229. { title: "日拟合优度", code: "rnhyd" },
  230. { title: "月拟合优度", code: "ynhyd" },
  231. { title: "年拟合优度", code: "nnhyd" },
  232. { title: "日实际/保证", code: "rsjbz" },
  233. { title: "月实际/保证", code: "ysjbz" },
  234. { title: "年实际/保正", code: "nsjbz" },
  235. ],
  236. tableHeaderGf: [
  237. { title: "型号", code: "model" },
  238. { title: "日系统效率", code: "rxtxl" },
  239. { title: "日离散率", code: "rlsl" },
  240. { title: "日转换效率", code: "rzhxl" },
  241. { title: "月系统效率", code: "yxtxl" },
  242. { title: "月离散率", code: "ylsl" },
  243. { title: "月转换效率", code: "yzhxl" },
  244. { title: "年系统效率", code: "nxtxl" },
  245. { title: "年离散率", code: "nlsl" },
  246. { title: "年转换效率", code: "nzhxl" },
  247. ],
  248. };
  249. },
  250. // watch: {
  251. // tabIndex(val) {
  252. // this.tableHeader = this.tableHeader.map((item) => {
  253. // if (val == -2) {
  254. // if (item.code == "rpjfs") {
  255. // item.title = "日平均光照";
  256. // }
  257. // if (item.code == "ypjfs") {
  258. // item.title = "月平均光照";
  259. // }
  260. // if (item.code == "npjfs") {
  261. // item.title = "年平均光照";
  262. // }
  263. // } else {
  264. // if (item.code == "rpjfs") {
  265. // item.title = "日平均风速";
  266. // }
  267. // if (item.code == "ypjfs") {
  268. // item.title = "月平均风速";
  269. // }
  270. // if (item.code == "npjfs") {
  271. // item.title = "年平均风速";
  272. // }
  273. // }
  274. // return { ...item };
  275. // });
  276. // },
  277. // },
  278. methods: {
  279. init(row) {
  280. // this.hiscompanyVal = row.companyId;
  281. this.hisstationVal = row.windtpowerstationId;
  282. this.hiswindVal = row.windturbineId || row.wtid;
  283. this.getTableData();
  284. },
  285. dateTimeFn(row) {
  286. return row.recordDate
  287. ? row.recordDate.substring(0, row.recordDate.indexOf("T"))
  288. : row.date.substring(0, row.date.indexOf("T"));
  289. },
  290. headerArr(label) {
  291. let arr = label.split("");
  292. let Newarr = [];
  293. let num = 0;
  294. let str = "";
  295. arr.forEach((it, index) => {
  296. num++;
  297. str += it;
  298. if (label.indexOf(it) + 1 !== label.length) {
  299. if (num % 2 === 0) {
  300. Newarr.push(str);
  301. str = "";
  302. }
  303. } else {
  304. Newarr.push(str);
  305. }
  306. });
  307. return Newarr;
  308. },
  309. async getWindPowerStation() {
  310. const { data } = await getApiequipmentListByWp({
  311. wpid: this.hisstationVal,
  312. });
  313. this.hisWindOptions = data.data;
  314. if (!this.hiswindVal && data.data.length) {
  315. this.hiswindVal = data.data[0].id;
  316. }
  317. },
  318. // changeBtn(id) {
  319. // this.tabIndex = id;
  320. // this.$emit("getHisStationOptions", this.tabIndex, this.hiscompanyVal);
  321. // this.getTableData();
  322. // },
  323. changeStation(val) {
  324. this.hisstationVal = val;
  325. this.hiswindVal = "";
  326. this.getWindPowerStation();
  327. },
  328. changeWind(val) {
  329. this.hiswindVal = val;
  330. this.getTableData();
  331. },
  332. seachData() {
  333. this.getTableData();
  334. },
  335. async getTableData() {
  336. let params = {
  337. type: this.tabIndex,
  338. pageNum: this.page.currentPage,
  339. pageSize: this.page.pagesize,
  340. beginDate: this.pickerTimer[0],
  341. endDate: this.pickerTimer[1],
  342. wpId: this.hisstationVal,
  343. wtId: this.hiswindVal,
  344. };
  345. let datas = {};
  346. if (this.tabIndex == -1) {
  347. datas = await getApihistorywindturbinegoodnesslist(params);
  348. this.historysingleMachineData = datas.data.data.records;
  349. this.page.total = datas.data.data.total;
  350. } else {
  351. datas = await getApihistorywindturbinegoodnesslistGf(params);
  352. this.historysingleMachineData = datas.data.data;
  353. this.page.total = datas.data.data.length;
  354. }
  355. },
  356. handleSizeChange(val) {
  357. this.page.pagesize = val;
  358. this.getTableData();
  359. },
  360. handleCurrentChange(val) {
  361. this.page.currentPage = val;
  362. this.getTableData();
  363. },
  364. //转换时间
  365. getchangeTime(date) {
  366. var y = date.getFullYear();
  367. var m = date.getMonth() + 1;
  368. m = m < 10 ? "0" + m : m;
  369. var d = date.getDate();
  370. d = d < 10 ? "0" + d : d;
  371. return y + "-" + m + "-" + d;
  372. },
  373. downXlsxFn() {
  374. let header = ["风机", "日期"];
  375. this.tableHeader.forEach((it) => {
  376. header.push(it.title);
  377. });
  378. utils.exportExcel(
  379. this.$refs["historysingleTable"].$el,
  380. header,
  381. "单机性能历史分析数据"
  382. );
  383. },
  384. },
  385. };
  386. </script>
  387. <style lang="less">
  388. .historysingleMachine {
  389. padding: 0 23px;
  390. .historysingleMachine_top {
  391. display: flex;
  392. flex-direction: row;
  393. align-items: center;
  394. margin-top: 10px;
  395. margin-bottom: 10px;
  396. .station {
  397. display: flex;
  398. flex-direction: row;
  399. align-items: center;
  400. font-size: 14px;
  401. font-family: Microsoft YaHei;
  402. font-weight: 400;
  403. color: #b3b3b3;
  404. margin-right: 10px;
  405. margin-left: 10px;
  406. }
  407. .stationsv {
  408. .timeaa {
  409. font-size: 14px;
  410. font-family: Microsoft YaHei;
  411. font-weight: 400;
  412. color: #b3b3b3;
  413. margin-right: 10px;
  414. margin-left: 10px;
  415. }
  416. }
  417. .tabCut {
  418. display: inline-block;
  419. margin: 0 10px;
  420. div {
  421. display: inline-block;
  422. width: 60px;
  423. height: 27px;
  424. border: 1px solid #274934;
  425. text-align: center;
  426. line-height: 25px;
  427. cursor: pointer;
  428. }
  429. div:nth-child(1) {
  430. border-radius: 13px 0px 0px 13px;
  431. }
  432. div:nth-child(2) {
  433. border-radius: 0px 13px 13px 0px;
  434. }
  435. .active {
  436. background-color: rgba(5, 187, 76, 0.9);
  437. color: #fff;
  438. }
  439. }
  440. .search-input {
  441. margin-left: 10px;
  442. .el-input__inner {
  443. width: 175px;
  444. }
  445. .el-input__suffix {
  446. right: -50px;
  447. }
  448. }
  449. .but {
  450. display: flex;
  451. flex-direction: row;
  452. align-content: center;
  453. margin-left: 20px;
  454. .buttons:nth-child(1) {
  455. background: rgba(5, 187, 76, 0.6);
  456. border: 1px solid #3b6c53;
  457. border-radius: 13px;
  458. color: #fff;
  459. &:hover {
  460. background: rgba(5, 187, 76, 0.9);
  461. border-radius: 13px;
  462. color: #fff;
  463. }
  464. }
  465. .buttons:nth-child(2) {
  466. background: rgba(67, 81, 107, 0.3);
  467. border: 1px solid #3b6c53;
  468. border-radius: 13px;
  469. font-size: 14px;
  470. color: #b3b3b3;
  471. }
  472. }
  473. .el-date-editor--daterange {
  474. background: transparent;
  475. border: 1px solid #2a374f;
  476. border-radius: 30px;
  477. height: 25px;
  478. .el-range-input {
  479. background: transparent;
  480. color: #fff;
  481. }
  482. .el-range-separator {
  483. width: 10%;
  484. color: #fff;
  485. position: relative;
  486. }
  487. }
  488. }
  489. // .historysingleMachine_Table {
  490. // padding: 5px;
  491. // padding-bottom: 10px;
  492. // background: rgba(0, 0, 0, 0.4);
  493. // .el-table--mini {
  494. // margin: 5px;
  495. // .el-table__header-wrapper {
  496. // tr {
  497. // background: rgba(83, 89, 104, 0.3) !important;
  498. // th {
  499. // vertical-align: top !important;
  500. // }
  501. // .cell {
  502. // color: #b3b3b3;
  503. // font-family: MicrosoftYaHei;
  504. // font-size: 14px;
  505. // }
  506. // }
  507. // }
  508. // .el-table__body-wrapper {
  509. // tr {
  510. // &:nth-child(2n) {
  511. // background: rgba(83, 89, 104, 0.05) !important;
  512. // }
  513. // .cell {
  514. // color: #d8d8d9;
  515. // font-family: ArialMT;
  516. // font-size: 13px;
  517. // height: 25px !important;
  518. // }
  519. // }
  520. // }
  521. // }
  522. // }
  523. }
  524. // .el-pagination {
  525. // display: flex;
  526. // justify-content: flex-end;
  527. // margin-right: 40px;
  528. // margin-top: 20px;
  529. // .btn-prev,
  530. // .btn-next,
  531. // .btn-quickprev,
  532. // .btn-quicknext,
  533. // .el-pager,
  534. // .number {
  535. // background: rgba(58, 63, 75, 0.4) !important;
  536. // color: #fff;
  537. // border-radius: 2px;
  538. // }
  539. // .el-pager .active {
  540. // background: #083c94;
  541. // color: #fff;
  542. // border-radius: 2px;
  543. // }
  544. // .el-pagination__total,
  545. // .el-pagination__jump {
  546. // color: #fff;
  547. // .el-input__inner {
  548. // background: rgba(58, 63, 75, 0.2);
  549. // border: 1px solid #3e4349;
  550. // color: #fff;
  551. // border-radius: 2px;
  552. // }
  553. // }
  554. // }
  555. // .historyBtn {
  556. // background: #43516b;
  557. // border-radius: 15px;
  558. // margin-top: 5px;
  559. // border: 1px solid #43516b;
  560. // span {
  561. // color: #fff;
  562. // }
  563. // }
  564. </style>