index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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>
  72. <div class="economicTable1">
  73. <el-table
  74. :data="singleMachineData"
  75. size="mini"
  76. stripe
  77. ref="stand_table"
  78. height="calc(100% - 40px)"
  79. style="width: 100%"
  80. >
  81. <el-table-column
  82. align="center"
  83. prop="wtcode"
  84. :label="tabIndex == -1 ? '风机' : '逆变器'"
  85. show-overflow-tooltip
  86. width="80"
  87. sortable
  88. >
  89. <template #default="scope">
  90. <span
  91. @click="seachDetail(scope.row)"
  92. style="cursor: pointer; color: #05bb4c"
  93. >{{ scope.row.wtcode }}</span
  94. >
  95. </template>
  96. </el-table-column>
  97. <el-table-column
  98. v-for="(item, index) in tabIndex === -1
  99. ? tableHeader
  100. : tableHeaderGf"
  101. :key="index"
  102. sortable
  103. :prop="item.code"
  104. :label="item.title"
  105. show-overflow-tooltip
  106. align="center"
  107. >
  108. <!-- <template #header="scope">
  109. <div v-if="scope.column.label.indexOf('(') > 0">
  110. <div>
  111. {{
  112. scope.column.label.slice(0, scope.column.label.indexOf("("))
  113. }}
  114. </div>
  115. <div>
  116. {{
  117. scope.column.label.slice(scope.column.label.indexOf("("))
  118. }}
  119. </div>
  120. </div>
  121. <div v-else>{{ scope.column.label }}</div>
  122. </template> -->
  123. <template #default="scope">
  124. <span>{{ scope.row[item.code] }}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="操作" align="center" width="80">
  128. <template #default="scope">
  129. <span class="historyBtn" @click="seachHistoryData(scope.row)"
  130. >历史</span
  131. >
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <el-pagination
  136. @current-change="handleCurrentChange"
  137. :current-page="page.currentPage"
  138. :page-size="page.pagesize"
  139. @size-change="handleSizeChange"
  140. :page-sizes="[23, 50, 100, 500]"
  141. layout="total, sizes, prev, pager, next, jumper"
  142. :total="page.total"
  143. >
  144. </el-pagination>
  145. </div>
  146. </div>
  147. <el-dialog
  148. v-model="dialogVisible"
  149. width="100%"
  150. custom-class="windhistoryDetailModel"
  151. destroy-on-close
  152. fullscreen
  153. >
  154. <template #title>
  155. <div class="dialog-title">
  156. <div class="title">{{ dialogTitle }}</div>
  157. </div>
  158. </template>
  159. <div style="height: 100%">
  160. <history-detail
  161. ref="windhistoryDetail"
  162. :tabIndex="tabIndex"
  163. :historyStationOptions="stationOptions"
  164. >
  165. </history-detail>
  166. </div>
  167. </el-dialog>
  168. <el-dialog
  169. v-model="dialogDetail"
  170. width="100%"
  171. custom-class="windDetailmodal"
  172. fullscreen
  173. destroy-on-close
  174. >
  175. <template #title>
  176. <div class="dialog-title">
  177. <div class="title">详情</div>
  178. </div>
  179. </template>
  180. <div style="height: 100%">
  181. <wind-detail-dialog
  182. ref="windDetail"
  183. :wpArray="stationOptions"
  184. ></wind-detail-dialog>
  185. </div>
  186. </el-dialog>
  187. </div>
  188. </template>
  189. <script>
  190. import {
  191. getApicompanyslist,
  192. getApiwpByCplistlist,
  193. getApiwindturbinegoodnesslist,
  194. getApiwindturbinegoodnesslistGf,
  195. } from "@/api/monthlyPerformanceAnalysis";
  196. import historyDetail from "./historyDetail.vue";
  197. import WindDetailDialog from "./windDetailDialog.vue";
  198. import utils from "@/utills/downXlsx";
  199. import dayjs from "dayjs";
  200. export default {
  201. name: "SingleWindAnasyle", //单机性能分析
  202. components: {
  203. historyDetail,
  204. WindDetailDialog,
  205. },
  206. data() {
  207. return {
  208. companyVal: "",
  209. companyOptions: [],
  210. stationVal: "",
  211. stationOptions: [],
  212. pickerTimer: "",
  213. singleMachineData: [],
  214. showBtn: true,
  215. dialogTitle: "",
  216. tabIndex: -1,
  217. tabOptions: [
  218. { id: -1, name: "风电" },
  219. { id: -2, name: "光伏" },
  220. ],
  221. tableHeader: [
  222. // { title: "风机", code: "wtcode" },
  223. { title: "型号", code: "modelId" },
  224. { title: "日排行榜", code: "dayTop" },
  225. { title: "日拟合优度(%)", code: "dayGoodness" },
  226. { title: "日风速(m/s)", code: "daySpeed" },
  227. { title: "月排行榜", code: "monthTop" },
  228. { title: "月拟合优度(%)", code: "monthGoodness" },
  229. { title: "月风速(m/s)", code: "monthSpeed" },
  230. { title: "年排行榜", code: "yearTop" },
  231. { title: "年拟合优度(%)", code: "yearGoodness" },
  232. { title: "年风速(m/s)", code: "yearSpeed" },
  233. // { title: "操作" },
  234. ],
  235. tableHeaderGf: [
  236. { title: "逆变器", code: "wtname" },
  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. // { title: "操作" },
  248. ],
  249. page: {
  250. pagesize: 23,
  251. currentPage: 1,
  252. total: 0,
  253. },
  254. dialogVisible: false,
  255. dialogDetail: false,
  256. isFullScreen: false,
  257. };
  258. },
  259. created() {
  260. this.pickerTimer = dayjs().add(-1, "day").format("YYYY-MM-DD");
  261. this.getCompanyData();
  262. },
  263. mounted() {},
  264. computed: {
  265. pageHeight() {
  266. return {
  267. height: document.documentElement.clientHeight - 130 + "px",
  268. };
  269. },
  270. pagewindHeight() {
  271. return {
  272. height: document.documentElement.clientHeight - 100 + "px",
  273. };
  274. },
  275. },
  276. methods: {
  277. // 获取公司列表
  278. async getCompanyData() {
  279. this.companyOptions = [];
  280. const { data: datas } = await getApicompanyslist();
  281. this.companyOptions = datas.data;
  282. this.companyVal = datas.data[0]?.id;
  283. this.getStationData(this.companyVal);
  284. },
  285. changeBtn(id) {
  286. this.tabIndex = id;
  287. this.stationVal = "";
  288. this.singleMachineData = [];
  289. this.getStationData(this.companyVal);
  290. },
  291. changeCompan(val) {
  292. this.companyVal = val;
  293. this.stationVal = "";
  294. this.singleMachineData = [];
  295. this.getStationData(this.companyVal);
  296. },
  297. // 获取场站
  298. async getStationData(companyVal) {
  299. this.stationOptions = [];
  300. let params = {
  301. type: this.tabIndex,
  302. companyid: companyVal,
  303. };
  304. const { data } = await getApiwpByCplistlist(params);
  305. if (data.data.length) {
  306. this.stationOptions = data.data;
  307. this.stationVal = data.data[0].id || "";
  308. } else {
  309. this.stationOptions = [];
  310. this.stationVal = "";
  311. }
  312. this.getTableData();
  313. },
  314. changeStation(val) {
  315. this.stationVal = val;
  316. this.getTableData();
  317. },
  318. seachData() {
  319. this.getTableData();
  320. },
  321. async getTableData() {
  322. let params = {
  323. cmId: this.companyVal,
  324. type: this.tabIndex,
  325. pageNum: this.page.currentPage,
  326. pageSize: this.page.pagesize,
  327. recorddate: this.pickerTimer,
  328. wpId: this.stationVal,
  329. };
  330. let datas = {};
  331. if (this.tabIndex == -2) {
  332. datas = await getApiwindturbinegoodnesslistGf(params);
  333. this.singleMachineData = datas.data.data;
  334. this.page.total = datas.data.data.length;
  335. } else {
  336. datas = await getApiwindturbinegoodnesslist(params);
  337. this.singleMachineData = datas.data.data.records;
  338. this.page.total = datas.data.data.total;
  339. }
  340. },
  341. handleSizeChange(val) {
  342. this.page.currentPage = 1;
  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 = dayjs(this.pickerTimer)
  371. .add(-10, "day")
  372. .format("YYYY-MM-DD");
  373. this.$refs.windhistoryDetail.pickerTimer = [startT, this.pickerTimer];
  374. if (this.tabIndex == -1) {
  375. this.$refs.windhistoryDetail.init(row);
  376. } else {
  377. row.windtpowerstationId = this.stationVal;
  378. this.$refs.windhistoryDetail.init(row);
  379. }
  380. // this.$refs.windhistoryDetail.getWindPowerStation();
  381. });
  382. },
  383. downXlsxFn() {
  384. let header = [];
  385. this.tableHeader.forEach((it) => {
  386. if (it.title !== "操作") {
  387. header.push(it.title);
  388. }
  389. });
  390. if (this.singleMachineData.length > 0) {
  391. utils.exportExcel(
  392. this.$refs["stand_table"].$el,
  393. header,
  394. "单机性能分析"
  395. );
  396. }
  397. },
  398. },
  399. };
  400. </script>
  401. <style lang="less">
  402. .singleMachine {
  403. height: 100%;
  404. padding: 0 20px;
  405. .singleMachine_title {
  406. .leftContent {
  407. width: 242px;
  408. height: 41px;
  409. line-height: 41px;
  410. background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  411. span {
  412. font-size: 16px;
  413. font-family: Microsoft YaHei;
  414. font-weight: 400;
  415. color: #05bb4c;
  416. margin-left: 25px;
  417. }
  418. }
  419. .floatLeft {
  420. float: left;
  421. }
  422. .floatRight {
  423. float: right;
  424. }
  425. }
  426. .singleMachine_content {
  427. background: rgba(0, 0, 0, 0.45);
  428. height: calc(100% - 48px);
  429. }
  430. .clearfix::after {
  431. content: "";
  432. clear: both;
  433. height: 0;
  434. line-height: 0;
  435. visibility: hidden;
  436. display: block;
  437. }
  438. .clearfix {
  439. zoom: 1;
  440. }
  441. .singleMachine_top {
  442. display: flex;
  443. flex-direction: row;
  444. align-items: center;
  445. padding-top: 5px;
  446. padding-bottom: 5px;
  447. .station {
  448. display: flex;
  449. flex-direction: row;
  450. align-items: center;
  451. font-size: 14px;
  452. font-family: Microsoft YaHei;
  453. font-weight: 400;
  454. color: #b3b3b3;
  455. margin-right: 10px;
  456. margin-left: 10px;
  457. }
  458. .tabCut {
  459. display: inline-block;
  460. margin: 0 10px;
  461. div {
  462. display: inline-block;
  463. width: 60px;
  464. height: 27px;
  465. border: 1px solid #274934;
  466. text-align: center;
  467. line-height: 25px;
  468. cursor: pointer;
  469. }
  470. div:nth-child(1) {
  471. border-radius: 13px 0px 0px 13px;
  472. border-right-width: 0;
  473. }
  474. div:nth-child(2) {
  475. border-radius: 0px 13px 13px 0px;
  476. }
  477. .active {
  478. background-color: rgba(5, 187, 76, 0.9);
  479. color: #fff;
  480. }
  481. }
  482. .search-input {
  483. margin-left: 10px;
  484. .el-input__inner {
  485. width: 175px;
  486. }
  487. .el-input__suffix {
  488. right: -50px;
  489. }
  490. }
  491. .but {
  492. display: flex;
  493. flex-direction: row;
  494. align-content: center;
  495. margin-left: 20px;
  496. .buttons {
  497. background-color: rgba(5, 187, 76, 0.2);
  498. border: 1px solid #3b6c53;
  499. color: #b3b3b3;
  500. font-size: 14px;
  501. &:hover,
  502. &.active {
  503. background-color: rgba(5, 187, 76, 0.5);
  504. color: #ffffff;
  505. }
  506. }
  507. }
  508. }
  509. .economicTable1 {
  510. height: calc(100% - 42px);
  511. .el-table__fixed,
  512. .el-table__fixed-right {
  513. background: rgba(0, 0, 0, 1);
  514. border-left: 2px solid #000;
  515. height: calc(100% - 15px) !important;
  516. }
  517. .el-table__fixed::before {
  518. background-color: #2a2a2a;
  519. }
  520. .el-table__fixed-right::before {
  521. background-color: #2a2a2a;
  522. }
  523. .el-pagination {
  524. display: flex;
  525. justify-content: flex-end;
  526. padding-top: 5px;
  527. .el-pagination__total,
  528. .el-pagination__jump {
  529. color: #fff;
  530. }
  531. }
  532. .historyBtn {
  533. cursor: pointer;
  534. color: #05bb4c;
  535. margin-right: 15px;
  536. }
  537. }
  538. .el-overlay {
  539. .el-overlay-dialog {
  540. overflow-y: hidden !important;
  541. .windhistoryDetailModel,
  542. .windDetailmodal {
  543. margin-top: 0 !important;
  544. .el-dialog__body {
  545. padding: 10px 20px 20px 20px;
  546. height: calc(100% - 80px);
  547. }
  548. }
  549. }
  550. }
  551. }
  552. </style>