index.vue 12 KB

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