index.vue 12 KB

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