index.vue 15 KB

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