index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  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% - 40px - 20px)"
  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="right"
  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" :data-type="$store.state.moreSty" @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="[21, 50, 100, 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: "",
  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: "总小风切入", code: "inputSmall" },
  191. { title: "总大风切入", code: "inputBig" },
  192. { title: "总小风切出", code: "outputSmall" },
  193. { title: "总大风切出", code: "outputBig" },
  194. { title: "日小风切入", code: "dayInputSmall" },
  195. { title: "日小风切入合格率", code: "dayInputSmallRatio" },
  196. { title: "日小风切出", code: "dayOutputSmall" },
  197. { title: "日小风切出合格率", code: "dayOutputSmallRatio" },
  198. { title: "日大风切入", code: "dayInputBig" },
  199. { title: "日大风切入合格率", code: "dayInputBigRatio" },
  200. { title: "日大风切出", code: "dayOutputBig" },
  201. { title: "日大风切出合格率", code: "dayOutputBigRatio" },
  202. { title: "月小风切入", code: "monthInputSmall" },
  203. { title: "月小风切入合格率", code: "monthInputSmallRatio" },
  204. { title: "月大风切入", code: "monthInputBig" },
  205. { title: "月大风切入合格率", code: "monthInputBigRatio" },
  206. { title: "月小风切出", code: "monthOutputSmall" },
  207. { title: "月小风切出合格率", code: "monthOutputSmallRatio" },
  208. { title: "月大风切出", code: "monthOutputBig" },
  209. { title: "月大风切出合格率", code: "monthOutputBigRatio" },
  210. { title: "年小风切入", code: "yearInputSmall" },
  211. { title: "年小风切入合格率", code: "yearInputSmallRatio" },
  212. { title: "年大风切入", code: "yearInputBig" },
  213. { title: "年大风切入合格率", code: "yearInputBigRatio" },
  214. { title: "年小风切出", code: "yearOutputSmall" },
  215. { title: "年小风切出合格率", code: "yearOutputSmallRatio" },
  216. { title: "年大风切出", code: "yearOutputBig" },
  217. { title: "年大风切出合格率", code: "yearOutputBigRatio" },
  218. ],
  219. page: {
  220. pagesize: 21,
  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(new Date().getTime() - 86400000).format(
  284. "YYYY-MM-DD"
  285. );
  286. const { data: datas } = await getApicompanyslist();
  287. this.companyOptions = datas.data;
  288. this.companyVal = datas.data[0]?.id;
  289. this.getStationData(this.companyVal);
  290. },
  291. changeCompan(val) {
  292. this.companyVal = val;
  293. this.stationVal = "";
  294. this.getStationData();
  295. },
  296. // changeBtn(id) {
  297. // this.tabIndex = id;
  298. // this.stationVal = "";
  299. // this.getStationData();
  300. // },
  301. async getStationData() {
  302. this.stationOptions = [];
  303. let params = {
  304. type: this.tabIndex,
  305. companyid: this.companyVal,
  306. };
  307. const { data: datas } = await getApiwpByCplistlist(params);
  308. this.stationOptions = datas.data;
  309. this.stationVal = datas.data[0].id;
  310. this.getTableData();
  311. },
  312. changeStation(val) {
  313. this.stationVal = val;
  314. this.getTableData();
  315. },
  316. seachData() {
  317. this.getTableData();
  318. },
  319. async getTableData() {
  320. let params = {
  321. cmId: this.companyVal,
  322. type: this.tabIndex,
  323. pageNum: this.page.currentPage,
  324. pageSize: this.page.pagesize,
  325. recorddate: this.pickerTimer,
  326. wpId: this.stationVal,
  327. };
  328. const { data: datas } = await getApioutputSpeedlist(params);
  329. this.cutInAndOutAnalysisData = datas.data.records;
  330. this.page.total = datas.data.total;
  331. },
  332. handleSizeChange(val) {
  333. this.page.currentPage = 1;
  334. this.page.pagesize = val;
  335. this.getTableData();
  336. },
  337. handleCurrentChange(val) {
  338. this.page.currentPage = val;
  339. this.getTableData();
  340. },
  341. //转换时间
  342. getchangeTime(date) {
  343. var y = date.getFullYear();
  344. var m = date.getMonth() + 1;
  345. m = m < 10 ? "0" + m : m;
  346. var d = date.getDate();
  347. d = d < 10 ? "0" + d : d;
  348. return y + "-" + m + "-" + d;
  349. },
  350. seachHistoryData(row) {
  351. this.dialogVisible = true;
  352. this.$nextTick(() => {
  353. let startT =
  354. new Date(this.pickerTimer).getTime() - 10 * 24 * 60 * 60 * 1000;
  355. this.$refs.historyDetail.pickerTimer = [
  356. this.getchangeTime(new Date(startT)),
  357. this.pickerTimer,
  358. ];
  359. this.$refs.historyDetail.init(row);
  360. });
  361. },
  362. downXlsxFn() {
  363. let header = [];
  364. this.tableHeader.forEach((it) => {
  365. if (it.title !== "操作") {
  366. header.push(it.title);
  367. }
  368. });
  369. if (this.cutInAndOutAnalysisData.length > 0) {
  370. utils.exportExcel(
  371. this.$refs["cutInAndOut_table"].$el,
  372. header,
  373. "切入切出分析"
  374. );
  375. }
  376. },
  377. },
  378. };
  379. </script>
  380. <style lang="less">
  381. .cutInAndOutAnalysis {
  382. padding: 0 20px;
  383. height: 100%;
  384. .cutInAndOut_title {
  385. .leftContent {
  386. width: 242px;
  387. height: 41px;
  388. line-height: 41px;
  389. background: url("~@/assets/imgs/title_left_bg1.png") no-repeat;
  390. span {
  391. font-size: 16px;
  392. font-family: Microsoft YaHei;
  393. font-weight: 400;
  394. color: #05bb4c;
  395. margin-left: 25px;
  396. }
  397. }
  398. .floatLeft {
  399. float: left;
  400. }
  401. .floatRight {
  402. float: right;
  403. }
  404. .rightContent {
  405. width: 212px;
  406. height: 28px;
  407. margin-top: 13px;
  408. background: url("../../../../assets/imgs/title_right_bg.png");
  409. }
  410. }
  411. .clearfix::after {
  412. content: "";
  413. clear: both;
  414. height: 0;
  415. line-height: 0;
  416. visibility: hidden;
  417. display: block;
  418. }
  419. .clearfix {
  420. zoom: 1;
  421. }
  422. .cutInAndOutAnalysis_top {
  423. display: flex;
  424. flex-direction: row;
  425. align-items: center;
  426. margin-top: 10px;
  427. margin-bottom: 10px;
  428. .station {
  429. display: flex;
  430. flex-direction: row;
  431. align-items: center;
  432. font-size: 14px;
  433. font-family: Microsoft YaHei;
  434. font-weight: 400;
  435. color: #b3b3b3;
  436. margin-right: 10px;
  437. margin-left: 10px;
  438. }
  439. .tabCut {
  440. display: inline-block;
  441. margin: 0 10px;
  442. div {
  443. display: inline-block;
  444. width: 60px;
  445. height: 27px;
  446. border: 1px solid #274934;
  447. text-align: center;
  448. line-height: 25px;
  449. cursor: pointer;
  450. }
  451. div:nth-child(1) {
  452. border-radius: 13px 0px 0px 13px;
  453. }
  454. div:nth-child(2) {
  455. border-radius: 0px 13px 13px 0px;
  456. cursor: not-allowed;
  457. }
  458. .active {
  459. background-color: rgba(5, 187, 76, 0.9);
  460. color: #fff;
  461. }
  462. }
  463. .search-input {
  464. margin-left: 10px;
  465. .el-input__inner {
  466. width: 175px;
  467. }
  468. .el-input__suffix {
  469. right: -50px;
  470. }
  471. }
  472. .but {
  473. display: flex;
  474. flex-direction: row;
  475. align-content: center;
  476. margin-left: 20px;
  477. .buttons {
  478. background-color: rgba(5, 187, 76, 0.2);
  479. border: 1px solid #3b6c53;
  480. color: #b3b3b3;
  481. font-size: 14px;
  482. &:hover,
  483. &.active {
  484. background-color: rgba(5, 187, 76, 0.5);
  485. color: #ffffff;
  486. }
  487. }
  488. }
  489. }
  490. .economicTable1 {
  491. height: calc(100% - 32px);
  492. .el-pagination {
  493. display: flex;
  494. justify-content: flex-end;
  495. padding-right: 40px;
  496. padding-top: 20px;
  497. .el-pagination__total,
  498. .el-pagination__jump {
  499. color: #fff;
  500. }
  501. }
  502. .el-table__fixed,
  503. .el-table__fixed-right {
  504. background: rgba(0, 0, 0, 1);
  505. border-left: 2px solid #000;
  506. height: calc(100% - 15px) !important;
  507. }
  508. .el-table__fixed::before {
  509. background-color: #2a2a2a;
  510. }
  511. .el-table__fixed-right::before {
  512. background-color: #2a2a2a;
  513. }
  514. }
  515. .el-overlay {
  516. .el-overlay-dialog {
  517. overflow-y: hidden !important;
  518. .el-dialog {
  519. margin-top: 0 !important;
  520. .el-dialog__body {
  521. height: calc(100% - 51px - 32px);
  522. }
  523. }
  524. }
  525. }
  526. .el-picker__popper .el-date-range-picker__header .el-picker-panel__icon-btn {
  527. color: #fff;
  528. }
  529. .el-picker__popper .el-date-table .in-range div {
  530. background: #43516b;
  531. }
  532. }
  533. .historyBtn1[data-type~="greenSty"] {
  534. color: @green;
  535. }
  536. .historyBtn1[data-type~="blueSty"] {
  537. color: @darkBlue;
  538. }
  539. .historyBtn1 {
  540. cursor: pointer;
  541. }
  542. </style>