index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <template>
  2. <div class="cutInAndOutAnalysis">
  3. <div class="cutInAndOutAnalysis_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 :class="tabIndex === val.id ? 'active' : ''" v-for="val in tabOptions" :key="val.id"><span>{{
  20. val.name
  21. }}</span></div>
  22. </div> -->
  23. <!-- <div class="station">
  24. 场站:
  25. <el-select
  26. size="mini"
  27. v-model="stationVal"
  28. placeholder="请选择"
  29. clearable
  30. @change="changeStation"
  31. >
  32. <el-option
  33. v-for="item in stationOptions"
  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. <div class="">
  44. <el-date-picker
  45. size="mini"
  46. v-model="pickerTimer"
  47. type="date"
  48. value-format="YYYY-MM-DD"
  49. placeholder="选择日期"
  50. popper-class="date-select"
  51. >
  52. </el-date-picker>
  53. </div>
  54. </div>
  55. <div class="but">
  56. <el-button round size="mini" class="buttons" @click="seachData"
  57. >搜 索</el-button
  58. >
  59. <el-button round size="mini" class="buttons" @click="downXlsxFn"
  60. >导出</el-button
  61. >
  62. </div>
  63. </div>
  64. <div
  65. style="
  66. background: rgba(0, 0, 0, 0.4);
  67. height: calc(100% - 43px);
  68. padding-bottom: 15px;
  69. "
  70. >
  71. <div class="cutInAndOut_title clearfix">
  72. <div class="leftContent floatLeft"><span>切入切出分析</span></div>
  73. </div>
  74. <div class="economicTable1">
  75. <el-table
  76. :data="cutInAndOutAnalysisData"
  77. stripe
  78. size="mini"
  79. height="calc(100% - 60px)"
  80. ref="cutInAndOut_table"
  81. style="width: 100%"
  82. >
  83. <el-table-column
  84. align="center"
  85. prop="wtcode"
  86. label="风机"
  87. width="150"
  88. fixed="left"
  89. >
  90. </el-table-column>
  91. <el-table-column
  92. v-for="(item, index) in tableHeader"
  93. :key="index"
  94. sortable
  95. :prop="item.code"
  96. :label="item.title"
  97. header-align="center"
  98. align="center"
  99. >
  100. <template #header="scope">
  101. <div
  102. v-for="(item, index) in headerArr(scope.column.label)"
  103. :key="index"
  104. >
  105. {{ item }}
  106. </div>
  107. </template>
  108. </el-table-column>
  109. <el-table-column
  110. align="center"
  111. prop="windturbineId"
  112. label="操作"
  113. width="70"
  114. fixed="right"
  115. >
  116. <template #default="scope">
  117. <!-- <el-button class="historyBtn" @click="seachHistoryData(scope.row)">历史</el-button> -->
  118. <span class="historyBtn1" @click="seachHistoryData(scope.row)"
  119. >历史</span
  120. >
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. <el-pagination
  125. @current-change="handleCurrentChange"
  126. :current-page="page.currentPage"
  127. :page-size="page.pagesize"
  128. @size-change="handleSizeChange"
  129. :page-sizes="[20, 50, 100, 200, 500]"
  130. layout="total, sizes, prev, pager, next, jumper"
  131. :total="page.total"
  132. >
  133. </el-pagination>
  134. </div>
  135. </div>
  136. <el-dialog
  137. v-model="dialogVisible"
  138. width="100%"
  139. custom-class="modal"
  140. fullscreen
  141. :close-on-click-modal="false"
  142. >
  143. <template #title>
  144. <div class="dialog-title">
  145. <div class="title">历史数据查询</div>
  146. </div>
  147. </template>
  148. <div style="height: 100%">
  149. <history-detail
  150. ref="historyDetail"
  151. :historyCompanyOptions="companyOptions"
  152. :historyStationOptions="stationOptions"
  153. :tableHeader="tableHeader"
  154. >
  155. </history-detail>
  156. </div>
  157. </el-dialog>
  158. </div>
  159. </template>
  160. <script>
  161. import {
  162. getApicompanyslist,
  163. getApiwpByCplistlist,
  164. getApioutputSpeedlist,
  165. } from "@/api/monthlyPerformanceAnalysis";
  166. import HistoryDetail from "./historyDetail.vue";
  167. import utils from "@/utills/downXlsx";
  168. import dayjs from "dayjs";
  169. import dataJson from "./dataJson.json";
  170. export default {
  171. name: "CutInAndOutAnalysis", //切入切出分析
  172. components: {
  173. HistoryDetail,
  174. },
  175. data() {
  176. return {
  177. companyVal: "",
  178. companyOptions: [],
  179. stationVal: "NX_FGS_HA_FDC_STA",
  180. stationOptions: [],
  181. pickerTimer: "",
  182. cutInAndOutAnalysisData: [],
  183. showBtn: true,
  184. tabIndex: -1,
  185. tabOptions: [
  186. { id: -1, name: "风电" },
  187. { id: -2, name: "光伏" },
  188. ],
  189. tableHeader: [
  190. { title: "总小风切入(m/s)", code: "inputSmall" },
  191. { title: "总大风切入(m/s)", code: "inputBig" },
  192. { title: "总小风切出(m/s)", code: "outputSmall" },
  193. { title: "总大风切出(m/s)", code: "outputBig" },
  194. { title: "日小风切入(m/s)", code: "dayInputSmall" },
  195. { title: "日小风切入合格率", code: "dayInputSmallRatio" },
  196. { title: "日小风切出(m/s)", code: "dayOutputSmall" },
  197. { title: "日小风切出合格率", code: "dayOutputSmallRatio" },
  198. { title: "日大风切入(m/s)", code: "dayInputBig" },
  199. { title: "日大风切入合格率", code: "dayInputBigRatio" },
  200. { title: "日大风切出(m/s)", code: "dayOutputBig" },
  201. { title: "日大风切出合格率", code: "dayOutputBigRatio" },
  202. { title: "月小风切入(m/s)", code: "monthInputSmall" },
  203. { title: "月小风切入合格率", code: "monthInputSmallRatio" },
  204. { title: "月大风切入(m/s)", code: "monthInputBig" },
  205. { title: "月大风切入合格率", code: "monthInputBigRatio" },
  206. { title: "月小风切出(m/s)", code: "monthOutputSmall" },
  207. { title: "月小风切出合格率", code: "monthOutputSmallRatio" },
  208. { title: "月大风切出(m/s)", code: "monthOutputBig" },
  209. { title: "月大风切出合格率", code: "monthOutputBigRatio" },
  210. { title: "年小风切入(m/s)", code: "yearInputSmall" },
  211. { title: "年小风切入合格率", code: "yearInputSmallRatio" },
  212. { title: "年大风切入(m/s)", code: "yearInputBig" },
  213. { title: "年大风切入合格率", code: "yearInputBigRatio" },
  214. { title: "年小风切出(m/s)", code: "yearOutputSmall" },
  215. { title: "年小风切出合格率", code: "yearOutputSmallRatio" },
  216. { title: "年大风切出(m/s)", code: "yearOutputBig" },
  217. { title: "年大风切出合格率", code: "yearOutputBigRatio" },
  218. ],
  219. page: {
  220. pagesize: 20,
  221. currentPage: 1,
  222. total: 0,
  223. },
  224. dialogTitle: "",
  225. dialogVisible: false,
  226. isFullScreen: false,
  227. };
  228. },
  229. created() {
  230. const clientHeight =
  231. document.documentElement.clientHeight || document.body.clientHeight;
  232. if (clientHeight === 1080) {
  233. this.isFullScreen = true;
  234. } else {
  235. this.isFullScreen = false;
  236. }
  237. // this.cutInAndOutAnalysisData = dataJson.data.data.records;
  238. // this.page.total = dataJson.data.data.total;
  239. this.getCompanyData();
  240. },
  241. mounted() {
  242. window.onresize = () => {
  243. const clientHeight =
  244. document.documentElement.clientHeight || document.body.clientHeight;
  245. this.isFullScreen = window.screen.height == clientHeight;
  246. this.getTableData();
  247. };
  248. },
  249. computed: {
  250. pageHeight() {
  251. return {
  252. height: document.documentElement.clientHeight - 130 + "px",
  253. };
  254. },
  255. },
  256. methods: {
  257. headerArr(label) {
  258. let arr = [];
  259. let num = 0;
  260. if (label.length > 2) {
  261. if (label.indexOf("风") > 0) {
  262. arr.push(label.substring(0, label.indexOf("风") + 1));
  263. num = label.indexOf("风");
  264. }
  265. if (label.indexOf("入") > 0 || label.indexOf("出") > 0) {
  266. if (label.indexOf("入") > 0) {
  267. arr.push(label.substring(num + 1, label.indexOf("入") + 1));
  268. num = label.indexOf("入");
  269. } else {
  270. arr.push(label.substring(num + 1, label.indexOf("出") + 1));
  271. num = label.indexOf("出");
  272. }
  273. }
  274. arr.push(label.substring(num + 1, label.length));
  275. } else {
  276. arr.push(label);
  277. }
  278. return arr;
  279. },
  280. // 获取公司列表
  281. async getCompanyData() {
  282. this.companyOptions = [];
  283. this.pickerTimer = dayjs().subtract(1, "day").format("YYYY-MM-DD");
  284. const { data: datas } = await getApicompanyslist();
  285. this.companyOptions = datas.data;
  286. this.companyVal = datas.data[0]?.id;
  287. this.getStationData(this.companyVal);
  288. },
  289. changeCompan(val) {
  290. this.companyVal = val;
  291. this.stationVal = "";
  292. this.getStationData();
  293. },
  294. // changeBtn(id) {
  295. // this.tabIndex = id;
  296. // this.stationVal = "";
  297. // this.getStationData();
  298. // },
  299. async getStationData() {
  300. this.stationOptions = [];
  301. let params = {
  302. type: this.tabIndex,
  303. companyid: this.companyVal,
  304. };
  305. const { data: datas } = await getApiwpByCplistlist(params);
  306. this.stationOptions = datas.data;
  307. this.stationVal = datas.data[0].id;
  308. this.getTableData();
  309. },
  310. changeStation(val) {
  311. this.stationVal = val;
  312. this.getTableData();
  313. },
  314. seachData() {
  315. this.getTableData();
  316. },
  317. async getTableData() {
  318. let params = {
  319. cmId: this.companyVal,
  320. type: this.tabIndex,
  321. pageNum: this.page.currentPage,
  322. pageSize: this.page.pagesize,
  323. recorddate: this.pickerTimer,
  324. wpId: this.stationVal,
  325. };
  326. const { data: datas } = await getApioutputSpeedlist(params);
  327. this.cutInAndOutAnalysisData = datas.data.records;
  328. this.page.total = datas.data.total;
  329. },
  330. handleSizeChange(val) {
  331. this.page.currentPage = 1;
  332. this.page.pagesize = val;
  333. this.getTableData();
  334. },
  335. handleCurrentChange(val) {
  336. this.page.currentPage = val;
  337. this.getTableData();
  338. },
  339. //转换时间
  340. getchangeTime(date) {
  341. var y = date.getFullYear();
  342. var m = date.getMonth() + 1;
  343. m = m < 10 ? "0" + m : m;
  344. var d = date.getDate();
  345. d = d < 10 ? "0" + d : d;
  346. return y + "-" + m + "-" + d;
  347. },
  348. seachHistoryData(row) {
  349. this.dialogVisible = true;
  350. this.$nextTick(() => {
  351. let startT =
  352. new Date(this.pickerTimer).getTime() - 10 * 24 * 60 * 60 * 1000;
  353. this.$refs.historyDetail.pickerTimer = [
  354. this.getchangeTime(new Date(startT)),
  355. this.pickerTimer,
  356. ];
  357. this.$refs.historyDetail.init(row);
  358. });
  359. },
  360. downXlsxFn() {
  361. let header = [];
  362. this.tableHeader.forEach((it) => {
  363. if (it.title !== "操作") {
  364. header.push(it.title);
  365. }
  366. });
  367. if (this.cutInAndOutAnalysisData.length > 0) {
  368. utils.exportExcel(
  369. this.$refs["cutInAndOut_table"].$el,
  370. header,
  371. "切入切出分析"
  372. );
  373. }
  374. },
  375. },
  376. };
  377. </script>
  378. <style lang="less">
  379. .cutInAndOutAnalysis {
  380. padding: 0 10px;
  381. height: 100%;
  382. .cutInAndOut_title {
  383. .leftContent {
  384. width: 242px;
  385. height: 41px;
  386. line-height: 41px;
  387. background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
  388. span {
  389. font-size: 16px;
  390. font-family: Microsoft YaHei;
  391. font-weight: 400;
  392. color: #05bb4c;
  393. margin-left: 25px;
  394. }
  395. }
  396. .floatLeft {
  397. float: left;
  398. }
  399. .floatRight {
  400. float: right;
  401. }
  402. .rightContent {
  403. width: 212px;
  404. height: 28px;
  405. margin-top: 13px;
  406. background: url("../../../../assets/imgs/title_right_bg.png");
  407. }
  408. }
  409. .clearfix::after {
  410. content: "";
  411. clear: both;
  412. height: 0;
  413. line-height: 0;
  414. visibility: hidden;
  415. display: block;
  416. }
  417. .clearfix {
  418. zoom: 1;
  419. }
  420. .cutInAndOutAnalysis_top {
  421. display: flex;
  422. flex-direction: row;
  423. align-items: center;
  424. margin-top: 10px;
  425. margin-bottom: 10px;
  426. .station {
  427. display: flex;
  428. flex-direction: row;
  429. align-items: center;
  430. font-size: 14px;
  431. font-family: Microsoft YaHei;
  432. font-weight: 400;
  433. color: #b3b3b3;
  434. margin-right: 10px;
  435. margin-left: 10px;
  436. }
  437. .tabCut {
  438. display: inline-block;
  439. margin: 0 10px;
  440. div {
  441. display: inline-block;
  442. width: 60px;
  443. height: 27px;
  444. border: 1px solid #274934;
  445. text-align: center;
  446. line-height: 25px;
  447. cursor: pointer;
  448. }
  449. div:nth-child(1) {
  450. border-radius: 13px 0px 0px 13px;
  451. }
  452. div:nth-child(2) {
  453. border-radius: 0px 13px 13px 0px;
  454. cursor: not-allowed;
  455. }
  456. .active {
  457. background-color: rgba(5, 187, 76, 0.9);
  458. color: #fff;
  459. }
  460. }
  461. .search-input {
  462. margin-left: 10px;
  463. .el-input__inner {
  464. width: 175px;
  465. }
  466. .el-input__suffix {
  467. right: -50px;
  468. }
  469. }
  470. .but {
  471. display: flex;
  472. flex-direction: row;
  473. align-content: center;
  474. margin-left: 20px;
  475. .buttons {
  476. background-color: rgba(5, 187, 76, 0.2);
  477. border: 1px solid #3b6c53;
  478. color: #b3b3b3;
  479. font-size: 14px;
  480. &:hover,
  481. &.active {
  482. background-color: rgba(5, 187, 76, 0.5);
  483. color: #ffffff;
  484. }
  485. }
  486. }
  487. }
  488. .economicTable1 {
  489. height: calc(100% - 30px);
  490. .el-pagination {
  491. display: flex;
  492. justify-content: flex-end;
  493. padding-right: 40px;
  494. padding-top: 20px;
  495. .el-pagination__total,
  496. .el-pagination__jump {
  497. color: #fff;
  498. }
  499. }
  500. .el-table__fixed,
  501. .el-table__fixed-right {
  502. background: rgba(0, 0, 0, 1);
  503. border-left: 2px solid #000;
  504. height: calc(100% - 15px) !important;
  505. }
  506. .el-table__fixed::before {
  507. background-color: #2a2a2a;
  508. }
  509. .el-table__fixed-right::before {
  510. background-color: #2a2a2a;
  511. }
  512. }
  513. .el-overlay {
  514. .el-overlay-dialog {
  515. overflow-y: hidden !important;
  516. .el-dialog {
  517. margin-top: 0 !important;
  518. .el-dialog__body {
  519. height: calc(100% - 51px - 32px);
  520. }
  521. }
  522. }
  523. }
  524. .el-picker__popper .el-date-range-picker__header .el-picker-panel__icon-btn {
  525. color: #fff;
  526. }
  527. .el-picker__popper .el-date-table .in-range div {
  528. background: #43516b;
  529. }
  530. }
  531. .historyBtn1 {
  532. cursor: pointer;
  533. color: #67b9ff;
  534. }
  535. </style>
  536. <style lang="less" scoped>
  537. ::v-deep .el-table__body-wrapper {
  538. background: #142446 !important;
  539. }
  540. ::v-deep .el-table__fixed-body-wrapper {
  541. padding-bottom: 10px !important;
  542. background: #142446 !important;
  543. }
  544. </style>