index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <div class="gftimeTransition">
  3. <div class="Evaluation_topall">
  4. <div class="Evaluation_top">
  5. <el-select
  6. size="mini"
  7. v-model="companyVal"
  8. placeholder="请选择"
  9. @change="changeCompan"
  10. >
  11. <el-option
  12. v-for="item in companyOptions"
  13. :key="item.id"
  14. :label="item.aname"
  15. :value="item.id"
  16. >
  17. </el-option>
  18. </el-select>
  19. <div class="station">
  20. 场站:
  21. <el-select
  22. size="mini"
  23. v-model="stationVal"
  24. placeholder="请选择"
  25. clearable
  26. @change="changeStation"
  27. >
  28. <el-option
  29. v-for="item in stationOptions"
  30. :key="item.id"
  31. :label="item.aname"
  32. :value="item.id"
  33. >
  34. </el-option>
  35. </el-select>
  36. </div>
  37. <div class="station">
  38. 时间:
  39. <el-date-picker
  40. v-model="pickerTimer"
  41. type="date"
  42. size="mini"
  43. popper-class="date-select"
  44. />
  45. </div>
  46. <div class="but">
  47. <el-button round size="mini" class="buttons" @click="seachData"
  48. >搜 索</el-button
  49. >
  50. </div>
  51. </div>
  52. </div>
  53. <div
  54. style="
  55. background: rgba(0, 0, 0, 0.4);
  56. height: calc(100% - 52px);
  57. padding-bottom: 15px;
  58. "
  59. >
  60. <div class="Evaluation_title clearfix">
  61. <div class="leftContent floatLeft"><span>状态转换分析</span></div>
  62. </div>
  63. <div class="economicTable1">
  64. <el-table
  65. :data="EvaluationData"
  66. stripe
  67. size="mini"
  68. height="calc(100% - 40px)"
  69. ref="Eval_table"
  70. style="width: 100%"
  71. >
  72. <el-table-column
  73. prop="stationId"
  74. label="场站"
  75. align="center"
  76. width="100"
  77. >
  78. <template #default="{ row }">
  79. <span>{{ "#" + row.stationId }}</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="状态">
  83. <template #default="{ row }">
  84. <div style="width: 100%">
  85. <span
  86. v-for="(it, index) in row.data"
  87. :key="index"
  88. class="comStr"
  89. :style="{
  90. width: `${
  91. Number(it.time / (timeCount / 1000).toFixed(2)) * 100
  92. }%`,
  93. }"
  94. :title="`${it.equipmentId}在${getTimedate(
  95. it.startTime
  96. )}至${getTimedate(it.endTime)}是${eventData(it.event)}状态`"
  97. :class="rowState(it)"
  98. ></span>
  99. </div>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. <div style="text-align: right">
  104. <el-pagination
  105. @size-change="handleSizeChange"
  106. :page-sizes="[20, 50, 100, 200, 500]"
  107. layout="total, sizes, prev, pager, next, jumper"
  108. @current-change="handlePageChange"
  109. :current-page="page.currentPage"
  110. :page-size="page.pagesize"
  111. :total="page.total"
  112. >
  113. </el-pagination>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. import {
  121. getApiphotovoltaicTimelist,
  122. getApicompanyslist,
  123. getApiwpByCplistlist,
  124. } from "@/api/monthlyPerformanceAnalysis";
  125. import dayjs from "dayjs";
  126. export default {
  127. name: "PerformanceAssess",
  128. data() {
  129. return {
  130. companyVal: "",
  131. companyOptions: [],
  132. stationVal: "",
  133. stationOptions: [],
  134. pickerTimer: "",
  135. EvaluationData: [],
  136. page: {
  137. currentPage: 1,
  138. pagesize: 20,
  139. total: 0,
  140. },
  141. timeCount: 0,
  142. };
  143. },
  144. mounted() {
  145. this.getCompanyData();
  146. this.pickerTimer = dayjs().add(-1, "day").startOf("date");
  147. },
  148. computed: {
  149. pageHeight() {
  150. return {
  151. height: document.documentElement.clientHeight - 130 + "px",
  152. };
  153. },
  154. },
  155. methods: {
  156. getTimedate(time) {
  157. return dayjs(time).format("YYYY-MM-DD HH:mm:ss");
  158. },
  159. eventData(event) {
  160. let showStr = "";
  161. if (event === 0) {
  162. showStr = "待机";
  163. } else if (event === 1) {
  164. showStr = "并网";
  165. } else if (event === 2) {
  166. showStr = "故障";
  167. } else if (event === 3) {
  168. showStr = "检修";
  169. } else if (event === 4) {
  170. showStr = "限电";
  171. } else if (event === 5) {
  172. showStr = "受累";
  173. } else if (event === 6) {
  174. showStr = "离线";
  175. }
  176. return showStr;
  177. },
  178. handleSizeChange(val) {
  179. this.page.currentPage = 1;
  180. this.page.pagesize = val;
  181. this.seachData();
  182. },
  183. handlePageChange(val) {
  184. this.page.currentPage = val;
  185. this.seachData();
  186. },
  187. // 获取公司列表
  188. async getCompanyData() {
  189. this.companyOptions = [];
  190. const { data: datas } = await getApicompanyslist();
  191. this.companyOptions = datas.data;
  192. this.companyVal = datas.data[0]?.id;
  193. this.getStationData();
  194. },
  195. changeCompan(val) {
  196. this.companyVal = val;
  197. this.stationOptions = [];
  198. this.stationVal = "";
  199. this.getStationData();
  200. },
  201. // 获取场站列表
  202. async getStationData() {
  203. this.stationOptions = [];
  204. let params = {
  205. type: -1,
  206. companyid: this.companyVal,
  207. };
  208. const { data: datas } = await getApiwpByCplistlist(params);
  209. this.stationOptions = datas.data;
  210. this.stationVal = datas.data[0].id;
  211. this.getTableData();
  212. },
  213. changeStation(val) {
  214. this.stationVal = val;
  215. this.getTableData();
  216. },
  217. rowState(row) {
  218. let showStr = "";
  219. if (row.event === 0) {
  220. showStr = "daijiStr";
  221. } else if (row.event === 1) {
  222. showStr = "bingwangStr";
  223. } else if (row.event === 2) {
  224. showStr = "guzhangStr";
  225. } else if (row.event === 3) {
  226. showStr = "jianxiuStr";
  227. } else if (row.event === 4) {
  228. showStr = "xiandianStr";
  229. } else if (row.event === 5) {
  230. showStr = "shouleiStr";
  231. } else if (row.event === 6) {
  232. showStr = "lixianStr";
  233. }
  234. return showStr;
  235. },
  236. seachData() {
  237. this.getTableData();
  238. },
  239. async getTableData() {
  240. let params = {
  241. stationId: this.stationVal,
  242. type: "WT",
  243. startTime: dayjs(this.pickerTimer).valueOf(),
  244. endTime: dayjs(this.pickerTimer).add(1, "day").valueOf(),
  245. pageNum: this.page.currentPage,
  246. pageSize: this.page.pagesize,
  247. };
  248. const { data: datas } = await getApiphotovoltaicTimelist(params);
  249. if (datas && datas.data) {
  250. let arr = [];
  251. for (let i in datas.data) {
  252. let obj = {
  253. stationId: i.substring(1),
  254. data: datas.data[i],
  255. };
  256. arr.push(obj);
  257. }
  258. this.timeCount =
  259. dayjs(this.pickerTimer).add(1, "day").valueOf() -
  260. dayjs(this.pickerTimer).valueOf();
  261. this.EvaluationData = arr.sort(this.sortBy("stationId"));
  262. }
  263. this.page.total = datas.total;
  264. },
  265. sortBy(stationId) {
  266. return (x, y) => {
  267. return x[stationId] - y[stationId];
  268. };
  269. },
  270. },
  271. };
  272. </script>
  273. <style lang="less">
  274. .gftimeTransition {
  275. padding: 0 20px;
  276. height: 100%;
  277. .Evaluation_title {
  278. .leftContent {
  279. width: 242px;
  280. height: 41px;
  281. line-height: 41px;
  282. background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
  283. span {
  284. font-size: 16px;
  285. font-family: Microsoft YaHei;
  286. font-weight: 400;
  287. color: #05bb4c;
  288. margin-left: 25px;
  289. }
  290. }
  291. .floatLeft {
  292. float: left;
  293. }
  294. .floatRight {
  295. float: right;
  296. }
  297. .rightContent {
  298. width: 212px;
  299. height: 28px;
  300. margin-top: 13px;
  301. background: url("../../../../assets/imgs/title_right_bg.png");
  302. }
  303. }
  304. .clearfix::after {
  305. content: "";
  306. clear: both;
  307. height: 0;
  308. line-height: 0;
  309. visibility: hidden;
  310. display: block;
  311. }
  312. .clearfix {
  313. zoom: 1;
  314. }
  315. .Evaluation_topall {
  316. display: flex;
  317. justify-content: space-between;
  318. .selections {
  319. position: relative;
  320. right: 120px;
  321. display: flex;
  322. margin-top: 10px;
  323. .selections_btn {
  324. flex: 0 0 55px;
  325. text-align: center;
  326. height: 33px;
  327. line-height: 33px;
  328. margin-right: 8px;
  329. color: #b9b9b9;
  330. font-size: 1.296vh;
  331. background: fade(#606769, 20);
  332. border: 1px solid fade(#606769, 20);
  333. border-radius: 20px;
  334. &:hover,
  335. &.active {
  336. background: fade(#05bb4c, 80);
  337. border: 1px solid #05bb4c;
  338. color: #fff;
  339. cursor: pointer;
  340. }
  341. }
  342. }
  343. .Evaluation_top {
  344. display: flex;
  345. flex-direction: row;
  346. align-items: center;
  347. padding-top: 10px;
  348. padding-bottom: 10px;
  349. .station {
  350. display: flex;
  351. flex-direction: row;
  352. align-items: center;
  353. font-size: 14px;
  354. font-family: Microsoft YaHei;
  355. font-weight: 400;
  356. color: #b3b3b3;
  357. margin-right: 10px;
  358. margin-left: 10px;
  359. }
  360. .search-input {
  361. margin-left: 10px;
  362. .el-input__inner {
  363. width: 175px;
  364. }
  365. .el-input__suffix {
  366. right: -50px;
  367. }
  368. }
  369. .tabCut {
  370. display: inline-block;
  371. margin: 0 10px;
  372. div {
  373. display: inline-block;
  374. width: 60px;
  375. height: 27px;
  376. border: 1px solid #274934;
  377. text-align: center;
  378. line-height: 25px;
  379. cursor: pointer;
  380. }
  381. div:nth-child(1) {
  382. border-radius: 13px 0px 0px 13px;
  383. border-right-width: 0;
  384. }
  385. div:nth-child(2) {
  386. border-radius: 0px 13px 13px 0px;
  387. }
  388. .active {
  389. background-color: rgba(5, 187, 76, 0.9);
  390. color: #fff;
  391. }
  392. }
  393. .buttons {
  394. background-color: rgba(5, 187, 76, 0.2);
  395. border: 1px solid #3b6c53;
  396. color: #b3b3b3;
  397. font-size: 14px;
  398. &:hover,
  399. &.active {
  400. background-color: rgba(5, 187, 76, 0.5);
  401. color: #ffffff;
  402. }
  403. }
  404. }
  405. }
  406. .economicTable1 {
  407. height: calc(100% - 40px);
  408. .el-table--mini {
  409. .el-table__header-wrapper {
  410. .el-checkbox {
  411. display: none;
  412. }
  413. }
  414. .el-table__body-wrapper {
  415. .el-checkbox {
  416. .el-checkbox__input {
  417. display: block;
  418. }
  419. }
  420. }
  421. }
  422. .comStr {
  423. display: inline-block;
  424. // width: 10px;
  425. height: 20px;
  426. }
  427. .daijiStr {
  428. background: #1c99ff;
  429. }
  430. .bingwangStr {
  431. background: #05bb4c;
  432. }
  433. .guzhangStr {
  434. background: #ba3237;
  435. }
  436. .jianxiuStr {
  437. background: #e17d24;
  438. }
  439. .xiandianStr {
  440. background: #c530c8;
  441. }
  442. .shouleiStr {
  443. background: #ffffff;
  444. }
  445. .lixianStr {
  446. background: #606769;
  447. }
  448. .historyBtn {
  449. background: #43516b;
  450. border-radius: 15px;
  451. margin-top: 5px;
  452. border: 1px solid #43516b;
  453. span {
  454. color: #fff;
  455. }
  456. }
  457. }
  458. .el-overlay {
  459. .el-overlay-dialog {
  460. overflow-y: hidden !important;
  461. .EvaluationhistoryModel {
  462. margin-top: 0 !important;
  463. .el-dialog__body {
  464. height: calc(100% - 51px - 50px);
  465. }
  466. }
  467. .contrastModal {
  468. .el-dialog__header {
  469. border: none;
  470. }
  471. .el-dialog__body {
  472. padding-top: 10px;
  473. }
  474. }
  475. }
  476. }
  477. .el-picker__popper .el-date-range-picker__header .el-picker-panel__icon-btn {
  478. color: #fff;
  479. }
  480. .el-picker__popper .el-date-table .in-range div {
  481. background: #43516b;
  482. }
  483. }
  484. </style>