index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. <template>
  2. <div class="singleMachine">
  3. <div class="singleMachine_top">
  4. <el-select
  5. size="mini"
  6. v-model="companyVal"
  7. placeholder="请选择"
  8. @change="changeCompan"
  9. >
  10. <el-option
  11. v-for="item in companyOptions"
  12. :key="item.id"
  13. :label="item.aname"
  14. :value="item.id"
  15. >
  16. </el-option>
  17. </el-select>
  18. <div class="tabCut">
  19. <div
  20. @click="changeBtn(val.id)"
  21. :class="tabIndex === val.id ? 'active' : ''"
  22. v-for="val in tabOptions"
  23. :key="val.id"
  24. >
  25. <span>{{ val.name }}</span>
  26. </div>
  27. </div>
  28. <div class="station">
  29. 场站:
  30. <el-select
  31. size="mini"
  32. v-model="stationVal"
  33. placeholder="请选择"
  34. @change="changeStation"
  35. clearable
  36. >
  37. <el-option
  38. v-for="item in stationOptions"
  39. :key="item.id"
  40. :label="item.name"
  41. :value="item.id"
  42. >
  43. </el-option>
  44. </el-select>
  45. </div>
  46. <div class="station">
  47. 时间:
  48. <div>
  49. <el-date-picker
  50. v-model="pickerTimer"
  51. type="date"
  52. value-format="YYYY-MM-DD"
  53. placeholder="选择日期"
  54. popper-class="date-select"
  55. >
  56. </el-date-picker>
  57. </div>
  58. </div>
  59. <div class="but">
  60. <el-button round size="mini" class="buttons" @click="seachData"
  61. >搜索</el-button
  62. >
  63. <el-button round size="mini" class="buttons" @click="downXlsxFn"
  64. >导出</el-button
  65. >
  66. </div>
  67. </div>
  68. <div class="singleMachine_content">
  69. <div class="singleMachine_title clearfix">
  70. <div class="leftContent floatLeft"><span>单机性能分析</span></div>
  71. <div class="rightContent floatRight"></div>
  72. </div>
  73. <div class="economicTable1">
  74. <el-table
  75. :data="singleMachineData"
  76. size="mini"
  77. stripe
  78. ref="stand_table"
  79. height="calc(100% - 40px)"
  80. style="width: 100%"
  81. >
  82. <el-table-column
  83. v-for="(item, index) in tabIndex === -1
  84. ? tableHeader
  85. : tableHeaderGf"
  86. :key="index"
  87. sortable
  88. :prop="item.code"
  89. :label="item.title"
  90. show-overflow-tooltip
  91. align="center"
  92. :width="item.title === '操作' ? '200' : ''"
  93. >
  94. <template #header="scope">
  95. <div v-if="scope.column.label.indexOf('(') > 0">
  96. <div>
  97. {{
  98. scope.column.label.slice(0, scope.column.label.indexOf("("))
  99. }}
  100. </div>
  101. <div>
  102. {{
  103. scope.column.label.slice(scope.column.label.indexOf("("))
  104. }}
  105. </div>
  106. </div>
  107. <div v-else>{{ scope.column.label }}</div>
  108. </template>
  109. <template #default="scope" v-if="item.title === '操作'">
  110. <span class="historyBtn" @click="seachDetail(scope.row)"
  111. >详情</span
  112. >
  113. <span class="historyBtn" @click="seachHistoryData(scope.row)"
  114. >历史</span
  115. >
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <el-pagination
  120. @current-change="handleCurrentChange"
  121. :current-page="page.currentPage"
  122. :page-size="page.pagesize"
  123. layout="total, prev, pager, next, jumper"
  124. :total="page.total"
  125. >
  126. </el-pagination>
  127. </div>
  128. </div>
  129. <el-dialog
  130. v-model="dialogVisible"
  131. width="100%"
  132. custom-class="windhistoryDetailModel"
  133. :close-on-click-modal="false"
  134. fullscreen
  135. >
  136. <template #title>
  137. <div class="dialog-title">
  138. <img class="dialog-title-img" src="@assets/imgs/dialog-title.png" />
  139. <div class="title">{{ dialogTitle }}</div>
  140. </div>
  141. </template>
  142. <div style="height: 100%">
  143. <history-detail
  144. ref="windhistoryDetail"
  145. :tabIndex="tabIndex"
  146. :historyStationOptions="stationOptions"
  147. >
  148. </history-detail>
  149. </div>
  150. </el-dialog>
  151. <el-dialog
  152. v-model="dialogDetail"
  153. width="100%"
  154. custom-class="windDetailmodal"
  155. :close-on-click-modal="false"
  156. fullscreen
  157. >
  158. <template #title>
  159. <div class="dialog-title">
  160. <img class="dialog-title-img" src="@assets/imgs/dialog-title.png" />
  161. <div class="title">详情</div>
  162. </div>
  163. </template>
  164. <div style="height: 100%">
  165. <wind-detail-dialog
  166. ref="windDetail"
  167. :wpArray="stationOptions"
  168. ></wind-detail-dialog>
  169. </div>
  170. </el-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. import {
  175. getApicompanyslist,
  176. getApiwpByCplistlist,
  177. getApiwindturbinegoodnesslist,
  178. getApiwindturbinegoodnesslistGf,
  179. } from "@/api/monthlyPerformanceAnalysis";
  180. import historyDetail from "./historyDetail.vue";
  181. import WindDetailDialog from "./windDetailDialog.vue";
  182. import utils from "@/utills/downXlsx";
  183. import dayjs from "dayjs";
  184. export default {
  185. name: "standAloneAnalyse", //单机性能分析
  186. components: {
  187. historyDetail,
  188. WindDetailDialog,
  189. },
  190. data() {
  191. return {
  192. companyVal: "",
  193. companyOptions: [],
  194. stationVal: "",
  195. stationOptions: [],
  196. pickerTimer: "",
  197. singleMachineData: [],
  198. showBtn: true,
  199. dialogTitle: "",
  200. tabIndex: -1,
  201. tabOptions: [
  202. { id: -1, name: "风电" },
  203. { id: -2, name: "光伏" },
  204. ],
  205. tableHeader: [
  206. { title: "风机", code: "wtcode" },
  207. { title: "型号", code: "modelId" },
  208. { title: "日排行榜", code: "dayTop" },
  209. { title: "日拟合优度(%)", code: "dayGoodness" },
  210. { title: "日风速(m/s)", code: "daySpeed" },
  211. { title: "月排行榜", code: "monthTop" },
  212. { title: "月拟合优度(%)", code: "monthGoodness" },
  213. { title: "月风速(m/s)", code: "monthSpeed" },
  214. { title: "年排行榜", code: "yearTop" },
  215. { title: "年拟合优度(%)", code: "yearGoodness" },
  216. { title: "年风速(m/s)", code: "yearSpeed" },
  217. { title: "操作" },
  218. ],
  219. tableHeaderGf: [
  220. { title: "逆变器", code: "wtname" },
  221. { title: "型号", code: "model" },
  222. { title: "日系统效率", code: "rxtxl" },
  223. { title: "日离散率", code: "rlsl" },
  224. { title: "日转换效率", code: "rzhxl" },
  225. { title: "月系统效率", code: "yxtxl" },
  226. { title: "月离散率", code: "ylsl" },
  227. { title: "月转换效率", code: "yzhxl" },
  228. { title: "年系统效率", code: "nxtxl" },
  229. { title: "年离散率", code: "nlsl" },
  230. { title: "年转换效率", code: "nzhxl" },
  231. { title: "操作" },
  232. ],
  233. page: {
  234. pagesize: 21,
  235. currentPage: 1,
  236. total: 0,
  237. },
  238. dialogVisible: false,
  239. dialogDetail: false,
  240. isFullScreen: false,
  241. };
  242. },
  243. created() {
  244. const clientHeight =
  245. document.documentElement.clientHeight || document.body.clientHeight;
  246. if (clientHeight === 1080) {
  247. this.isFullScreen = true;
  248. } else {
  249. this.isFullScreen = false;
  250. }
  251. this.getCompanyData();
  252. },
  253. mounted() {
  254. window.onresize = () => {
  255. const clientHeight =
  256. document.documentElement.clientHeight || document.body.clientHeight;
  257. this.isFullScreen = window.screen.height == clientHeight;
  258. this.getTableData();
  259. };
  260. },
  261. computed: {
  262. pageHeight() {
  263. return {
  264. height: document.documentElement.clientHeight - 130 + "px",
  265. };
  266. },
  267. pagewindHeight() {
  268. return {
  269. height: document.documentElement.clientHeight - 100 + "px",
  270. };
  271. },
  272. },
  273. methods: {
  274. // 获取公司列表
  275. async getCompanyData() {
  276. this.companyOptions = [];
  277. this.pickerTimer = dayjs(new Date().getTime() - 86400000).format(
  278. "YYYY-MM-DD"
  279. );
  280. // this.pickerTimer = "2023-8-29";
  281. const { data: datas } = await getApicompanyslist();
  282. this.companyOptions = datas.data;
  283. this.companyVal = datas.data[0]?.id;
  284. this.getStationData(this.companyVal);
  285. },
  286. changeBtn(id) {
  287. this.tabIndex = id;
  288. this.stationVal = "";
  289. this.singleMachineData = [];
  290. this.getStationData(this.companyVal);
  291. },
  292. changeCompan(val) {
  293. this.companyVal = val;
  294. this.stationVal = "";
  295. this.singleMachineData = [];
  296. this.getStationData(this.companyVal);
  297. },
  298. // 获取场站
  299. async getStationData(companyVal) {
  300. this.stationOptions = [];
  301. let params = {
  302. type: this.tabIndex,
  303. companyid: companyVal,
  304. };
  305. const { data } = await getApiwpByCplistlist(params);
  306. if (data.data.length) {
  307. this.stationOptions = data.data;
  308. this.stationVal = data.data[0].id || "";
  309. } else {
  310. this.stationOptions = [];
  311. this.stationVal = "";
  312. }
  313. this.getTableData();
  314. },
  315. changeStation(val) {
  316. this.stationVal = val;
  317. this.getTableData();
  318. },
  319. seachData() {
  320. this.getTableData();
  321. },
  322. async getTableData() {
  323. let params = {
  324. cmId: this.companyVal,
  325. type: this.tabIndex,
  326. pageNum: this.page.currentPage,
  327. pageSize: this.page.pagesize,
  328. recorddate: this.pickerTimer,
  329. wpId: this.stationVal,
  330. };
  331. let datas = {};
  332. if (this.tabIndex == -2) {
  333. datas = await getApiwindturbinegoodnesslistGf(params);
  334. this.singleMachineData = datas.data.data;
  335. this.page.total = datas.data.data.length;
  336. } else {
  337. datas = await getApiwindturbinegoodnesslist(params);
  338. this.singleMachineData = datas.data.data.records;
  339. this.page.total = datas.data.data.total;
  340. }
  341. },
  342. handleSizeChange(val) {
  343. this.page.pagesize = val;
  344. this.getTableData();
  345. },
  346. handleCurrentChange(val) {
  347. this.page.currentPage = val;
  348. this.getTableData();
  349. },
  350. //转换时间
  351. getchangeTime(date) {
  352. var y = date.getFullYear();
  353. var m = date.getMonth() + 1;
  354. m = m < 10 ? "0" + m : m;
  355. var d = date.getDate();
  356. d = d < 10 ? "0" + d : d;
  357. return y + "-" + m + "-" + d;
  358. },
  359. seachDetail(row) {
  360. this.dialogDetail = true;
  361. this.$nextTick(() => {
  362. this.$refs.windDetail.recorddate = this.pickerTimer;
  363. this.$refs.windDetail.init(row);
  364. });
  365. },
  366. seachHistoryData(row) {
  367. this.dialogVisible = true;
  368. this.dialogTitle = "历史数据查询";
  369. this.$nextTick(() => {
  370. let startT =
  371. new Date(this.pickerTimer).getTime() - 10 * 24 * 60 * 60 * 1000;
  372. this.$refs.windhistoryDetail.pickerTimer = [
  373. this.getchangeTime(new Date(startT)),
  374. this.pickerTimer,
  375. ];
  376. if (this.tabIndex == -1) {
  377. this.$refs.windhistoryDetail.init(row);
  378. } else {
  379. row.windtpowerstationId = this.stationVal;
  380. this.$refs.windhistoryDetail.init(row);
  381. }
  382. this.$refs.windhistoryDetail.getWindPowerStation();
  383. });
  384. },
  385. downXlsxFn() {
  386. let header = [];
  387. this.tableHeader.forEach((it) => {
  388. if (it.title !== "操作") {
  389. header.push(it.title);
  390. }
  391. });
  392. if (this.singleMachineData.length > 0) {
  393. utils.exportExcel(
  394. this.$refs["stand_table"].$el,
  395. header,
  396. "单机性能分析"
  397. );
  398. }
  399. },
  400. },
  401. };
  402. </script>
  403. <style lang="less">
  404. .singleMachine {
  405. height: 100%;
  406. padding: 0 30px;
  407. .singleMachine_title {
  408. .leftContent {
  409. width: 242px;
  410. height: 41px;
  411. line-height: 41px;
  412. background: url("../../../../assets/imgs/title_left_bg.png");
  413. span {
  414. font-size: 16px;
  415. font-family: Microsoft YaHei;
  416. font-weight: 400;
  417. color: #ffffff;
  418. margin-left: 25px;
  419. }
  420. }
  421. .floatLeft {
  422. float: left;
  423. }
  424. .floatRight {
  425. float: right;
  426. }
  427. .rightContent {
  428. width: 212px;
  429. height: 28px;
  430. margin-top: 13px;
  431. background: url("../../../../assets/imgs/title_right_bg.png");
  432. }
  433. }
  434. .singleMachine_content {
  435. background: rgba(0, 0, 0, 0.45);
  436. height: calc(100% - 58px);
  437. padding-bottom: 20px;
  438. }
  439. .clearfix::after {
  440. content: "";
  441. clear: both;
  442. height: 0;
  443. line-height: 0;
  444. visibility: hidden;
  445. display: block;
  446. }
  447. .clearfix {
  448. zoom: 1;
  449. }
  450. .singleMachine_top {
  451. display: flex;
  452. flex-direction: row;
  453. align-items: center;
  454. padding-top: 10px;
  455. margin-bottom: 10px;
  456. .station {
  457. display: flex;
  458. flex-direction: row;
  459. align-items: center;
  460. font-size: 14px;
  461. font-family: Microsoft YaHei;
  462. font-weight: 400;
  463. color: #b3b3b3;
  464. margin-right: 10px;
  465. margin-left: 10px;
  466. }
  467. .tabCut {
  468. display: inline-block;
  469. margin: 0 10px;
  470. div {
  471. display: inline-block;
  472. width: 60px;
  473. height: 27px;
  474. border: 1px solid #274934;
  475. text-align: center;
  476. line-height: 25px;
  477. cursor: pointer;
  478. }
  479. div:nth-child(1) {
  480. border-radius: 13px 0px 0px 13px;
  481. border-right-width: 0;
  482. }
  483. div:nth-child(2) {
  484. border-radius: 0px 13px 13px 0px;
  485. }
  486. .active {
  487. background-color: rgba(5, 187, 76, 0.9);
  488. color: #fff;
  489. }
  490. }
  491. .search-input {
  492. margin-left: 10px;
  493. .el-input__inner {
  494. width: 175px;
  495. }
  496. .el-input__suffix {
  497. right: -50px;
  498. }
  499. }
  500. .but {
  501. display: flex;
  502. flex-direction: row;
  503. align-content: center;
  504. margin-left: 20px;
  505. .buttons:nth-child(1) {
  506. background: rgba(5, 187, 76, 0.6);
  507. border: 1px solid #3b6c53;
  508. border-radius: 13px;
  509. color: #fff;
  510. &:hover {
  511. background: rgba(5, 187, 76, 0.9);
  512. border-radius: 13px;
  513. color: #fff;
  514. }
  515. }
  516. .buttons:nth-child(2) {
  517. background: rgba(67, 81, 107, 0.3);
  518. border: 1px solid #3b6c53;
  519. border-radius: 13px;
  520. font-size: 14px;
  521. color: #b3b3b3;
  522. }
  523. }
  524. }
  525. .economicTable1 {
  526. height: calc(100% - 42px);
  527. // .el-table--mini {
  528. // margin: 5px;
  529. // .el-table__header-wrapper {
  530. // tr {
  531. // background: rgba(83, 89, 104, 0.3) !important;
  532. // th {
  533. // vertical-align: top !important;
  534. // }
  535. // .cell {
  536. // color: #b3b3b3;
  537. // font-family: MicrosoftYaHei;
  538. // font-size: 14px;
  539. // }
  540. // }
  541. // }
  542. // .el-table__body-wrapper {
  543. // tr {
  544. // &:nth-child(2n) {
  545. // background: rgba(83, 89, 104, 0.05) !important;
  546. // }
  547. // .cell {
  548. // color: #d8d8d9;
  549. // font-family: ArialMT;
  550. // font-size: 13px;
  551. // height: 25px !important;
  552. // }
  553. // }
  554. // }
  555. // }
  556. .el-table__fixed,
  557. .el-table__fixed-right {
  558. background: rgba(0, 0, 0, 1);
  559. border-left: 2px solid #000;
  560. height: calc(100% - 15px) !important;
  561. }
  562. .el-table__fixed::before {
  563. background-color: #2a2a2a;
  564. }
  565. .el-table__fixed-right::before {
  566. background-color: #2a2a2a;
  567. }
  568. .el-pagination {
  569. display: flex;
  570. justify-content: flex-end;
  571. margin-right: 40px;
  572. margin-top: 20px;
  573. // .btn-prev,
  574. // .btn-next,
  575. // .btn-quickprev,
  576. // .btn-quicknext,
  577. // .el-pager,
  578. // .number {
  579. // background: rgba(58, 63, 75, 0.4);
  580. // color: #fff;
  581. // border-radius: 2px;
  582. // }
  583. // .el-pager .active {
  584. // background: #05bb4c;
  585. // color: #fff;
  586. // border-radius: 2px;
  587. // }
  588. .el-pagination__total,
  589. .el-pagination__jump {
  590. color: #fff;
  591. // .el-input__inner {
  592. // background: rgba(58, 63, 75, 0.2);
  593. // border: 1px solid #3e4349;
  594. // color: #fff;
  595. // border-radius: 2px;
  596. // }
  597. }
  598. }
  599. .historyBtn {
  600. cursor: pointer;
  601. color: #05bb4c;
  602. margin-right: 15px;
  603. }
  604. }
  605. .el-overlay {
  606. .el-overlay-dialog {
  607. overflow-y: hidden !important;
  608. .windhistoryDetailModel,
  609. .windDetailmodal {
  610. margin-top: 0 !important;
  611. .el-dialog__body {
  612. padding: 10px 20px 20px 20px;
  613. height: calc(100% - 80px);
  614. }
  615. }
  616. }
  617. }
  618. .el-picker__popper .el-date-range-picker__header .el-picker-panel__icon-btn {
  619. color: #fff;
  620. }
  621. .el-picker__popper .el-date-table .in-range div {
  622. background: #43516b;
  623. }
  624. }
  625. </style>