LightMatrix1.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <template>
  2. <div class="light-matrix">
  3. <Row class="panel-2" type="">
  4. <Col :span="12" class="left-50-16">
  5. <div class="panel">
  6. <div class="dot left top"></div>
  7. <div class="dot left bottom"></div>
  8. <div class="dot right top"></div>
  9. <div class="dot right bottom"></div>
  10. <div class="item">
  11. <div class="loop"></div>
  12. <span class="svg-icon svg-icon-gray svg-icon-md">
  13. <SvgIcon svgid="svg-wind-site"></SvgIcon>
  14. </span>
  15. </div>
  16. <div class="item write" @click="changeShow('jrfj_FDC')">
  17. <div class="curStyle">
  18. <div>接入风机</div>
  19. <div>{{ sourceMap.fcjrnum || "---" }}</div>
  20. </div>
  21. </div>
  22. <div class="item blue" @click="changeShow('yx_FDC', 1)">
  23. <div class="curStyle">
  24. <div>· 运行</div>
  25. <div>{{ sourceMap.fcyxnum || "---" }}</div>
  26. </div>
  27. </div>
  28. <div class="item green" @click="changeShow('dj_FDC', 0)">
  29. <div class="curStyle">
  30. <div>· 待机</div>
  31. <div>{{ sourceMap.fcdjnum || "---" }}</div>
  32. </div>
  33. </div>
  34. <div class="item pink" @click="changeShow('xd_FDC', 5)">
  35. <div class="curStyle">
  36. <div>· 限电</div>
  37. <div>{{ sourceMap.fcxdnum || "---" }}</div>
  38. </div>
  39. </div>
  40. <div class="item red" @click="changeShow('gz_FDC', 2)">
  41. <div class="curStyle">
  42. <div>· 故障</div>
  43. <div>{{ sourceMap.fcgznum || "---" }}</div>
  44. </div>
  45. </div>
  46. <div class="item orange" @click="changeShow('jx_FDC', 4)">
  47. <div class="curStyle">
  48. <div>· 检修</div>
  49. <div>{{ sourceMap.fcwhnum || "---" }}</div>
  50. </div>
  51. </div>
  52. <div class="item write" @click="changeShow('sl_FDC', 6)">
  53. <div class="curStyle">
  54. <div>· 受累</div>
  55. <div>{{ sourceMap.fcslnum || "---" }}</div>
  56. </div>
  57. </div>
  58. <div class="item gray" @click="changeShow('lx_FDC', 3)">
  59. <div class="curStyle">
  60. <div>· 离线</div>
  61. <div>{{ sourceMap.fclxnum || "---" }}</div>
  62. </div>
  63. </div>
  64. </div>
  65. </Col>
  66. <Col :span="12" class="left-50-16">
  67. <div class="panel">
  68. <div class="dot left top"></div>
  69. <div class="dot left bottom"></div>
  70. <div class="dot right top"></div>
  71. <div class="dot right bottom"></div>
  72. <div class="item">
  73. <div class="loop"></div>
  74. <span class="svg-icon svg-icon-gray svg-icon-md">
  75. <SvgIcon
  76. :svgid="'svg-photovoltaic'"
  77. style="margin: 3px 0px -3px 1px"
  78. ></SvgIcon>
  79. </span>
  80. </div>
  81. <div class="item write" @click="changeShow('jrfj1_GDC')">
  82. <div class="curStyle">
  83. <div>逆变器</div>
  84. <div>{{ sourceMap.gfjrnum || "---" }}</div>
  85. </div>
  86. </div>
  87. <div class="item blue" @click="changeShow('yx1_GDC', 1)">
  88. <div class="curStyle">
  89. <div>· 运行</div>
  90. <div>{{ sourceMap.gfyxnum || "---" }}</div>
  91. </div>
  92. </div>
  93. <div class="item greenv" @click="changeShow('dj1_GDC', 0)">
  94. <div class="curStyle">
  95. <div>· 待机</div>
  96. <div>{{ sourceMap.gfdjnum || "---" }}</div>
  97. </div>
  98. </div>
  99. <div class="item pink" @click="changeShow('xd1_GDC', 5)">
  100. <div class="curStyle">
  101. <div>· 限电</div>
  102. <div>{{ sourceMap.gfxdnum || "---" }}</div>
  103. </div>
  104. </div>
  105. <div class="item red" @click="changeShow('gz1_GDC', 2)">
  106. <div class="curStyle">
  107. <div>· 故障</div>
  108. <div>{{ sourceMap.gfgznum || "---" }}</div>
  109. </div>
  110. </div>
  111. <div class="item orange" @click="changeShow('jx1_GDC', 4)">
  112. <div class="curStyle">
  113. <div>· 检修</div>
  114. <div>{{ sourceMap.gfwhnum || "---" }}</div>
  115. </div>
  116. </div>
  117. <div class="item write" @click="changeShow('sl1_GDC', 6)">
  118. <div class="curStyle">
  119. <div>· 受累</div>
  120. <div>{{ sourceMap.gfslnum || "---" }}</div>
  121. </div>
  122. </div>
  123. <div class="item gray curStyle" @click="changeShow('lx1_GDC', 3)">
  124. <div class="curStyle">
  125. <div>· 离线</div>
  126. <div>{{ sourceMap.gflxnum || "---" }}</div>
  127. </div>
  128. </div>
  129. </div>
  130. </Col>
  131. </Row>
  132. <div class="panel-box">
  133. <div v-for="(pItem, pIndex) in sourceMap.fjmap" :key="pIndex">
  134. <div class="panel-title">
  135. <div class="panel-title-name">
  136. <i class="svg-icon svg-icon-sm svg-icon-green">
  137. <SvgIcon :svgid="'svg-wind-site'"></SvgIcon>
  138. </i>
  139. <span>{{
  140. sourceMap.fczbmap[sourceMap.fjmap[pIndex][0].wpId].name ||
  141. "------"
  142. }}</span>
  143. <div
  144. class="sub-title-item"
  145. v-for="(fcItem, fcIndex) in fcStateArray"
  146. :key="fcIndex"
  147. >
  148. <span class="sub-title">{{ fcItem.text }}</span>
  149. <span class="sub-count" :class="fcItem.color">{{
  150. sourceMap.fczbmap[sourceMap.fjmap[pIndex][0].wpId][fcItem.key]
  151. }}</span>
  152. </div>
  153. </div>
  154. </div>
  155. <div class="panel-body">
  156. <div
  157. class="card"
  158. v-for="(cItem, cIndex) of pItem"
  159. :key="cIndex"
  160. v-show="cItem.isShow"
  161. :class="cItem.color"
  162. @click="goDetails(cItem)"
  163. >
  164. {{ cItem.wtnum }}
  165. </div>
  166. <!-- 站位用 保证卡片布局最后一行不会有问题 -->
  167. <i class="blank" v-for="i in pItem.length" :key="i"></i>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. </template>
  173. <script>
  174. import Row from "@/components/coms/grid/row.vue";
  175. import Col from "@/components/coms/grid/col.vue";
  176. import SvgIcon from "@com/coms/icon/svg-icon.vue";
  177. import util from "@/helper/util.js";
  178. import store from "@store/index.js";
  179. import { isNumber } from "util";
  180. import { setInterval, clearInterval } from "timers";
  181. export default {
  182. // 名称
  183. name: "LightMatrix1",
  184. // 使用组件
  185. components: {
  186. Row,
  187. Col,
  188. SvgIcon,
  189. },
  190. // 数据
  191. data() {
  192. return {
  193. timmer: null, // 计时器
  194. sourceMap: {}, // 核心数据
  195. fillCategory: null, // 过滤条件
  196. fillFjzt: null, // 过滤条件
  197. fcStateArray: [
  198. {
  199. text: "接入台数",
  200. color: "write",
  201. key: "jrts",
  202. },
  203. {
  204. text: "待机台数",
  205. color: "green",
  206. key: "djts",
  207. },
  208. {
  209. text: "并网台数",
  210. color: "blue",
  211. key: "yxts",
  212. },
  213. {
  214. text: "限电台数",
  215. color: "purple",
  216. key: "xdts",
  217. },
  218. {
  219. text: "故障台数",
  220. color: "red",
  221. key: "gzts",
  222. },
  223. {
  224. text: "检修台数",
  225. color: "orange",
  226. key: "whts",
  227. },
  228. {
  229. text: "受累台数",
  230. color: "write",
  231. key: "slts",
  232. },
  233. {
  234. text: "离线台数",
  235. color: "gray",
  236. key: "lxts",
  237. },
  238. {
  239. text: "风速",
  240. color: "gray",
  241. key: "ssfs",
  242. },
  243. {
  244. text: "预测功率",
  245. color: "gray",
  246. key: "ycgl",
  247. },
  248. {
  249. text: "保证功率",
  250. color: "gray",
  251. key: "bzgl",
  252. },
  253. {
  254. text: "应发功率",
  255. color: "gray",
  256. key: "yfgl",
  257. },
  258. {
  259. text: "实际功率",
  260. color: "gray",
  261. key: "sjgl",
  262. },
  263. {
  264. text: "AGC指令",
  265. color: "gray",
  266. key: "agcygsd",
  267. },
  268. {
  269. text: "出线功率",
  270. color: "gray",
  271. key: "agccxyg",
  272. },
  273. ],
  274. };
  275. },
  276. // 函数
  277. methods: {
  278. // 根据风机状态码返回对应 class
  279. getColor(fjzt) {
  280. switch (fjzt) {
  281. case 0:
  282. return "green";
  283. case 1:
  284. return "blue";
  285. case 2:
  286. return "red";
  287. case 3:
  288. return "gray";
  289. case 4:
  290. return "orange";
  291. case 5:
  292. return "pink";
  293. case 6:
  294. return "pink";
  295. }
  296. },
  297. // 切换显示种类
  298. changeShow(category, fjzt, skipFill) {
  299. if (!skipFill) {
  300. if (this.fillCategory === category) {
  301. this.fillCategory = null;
  302. this.fillFjzt = null;
  303. } else {
  304. this.fillCategory = category;
  305. this.fillFjzt = fjzt;
  306. }
  307. }
  308. let fjmap = this.BASE.deepCopy(this.sourceMap.fjmap);
  309. fjmap.forEach((pEle) => {
  310. pEle.forEach((cEle) => {
  311. cEle.isShow = true;
  312. if (!this.fillCategory) {
  313. cEle.isShow = true;
  314. } else if (cEle.wpId.indexOf(category.split("_")[1]) !== -1) {
  315. if (isNumber(fjzt)) {
  316. cEle.fjzt === fjzt ? (cEle.isShow = true) : (cEle.isShow = false);
  317. } else {
  318. cEle.isShow = true;
  319. }
  320. } else {
  321. cEle.isShow = true;
  322. }
  323. });
  324. });
  325. this.sourceMap.fjmap = fjmap;
  326. },
  327. // 请求服务
  328. requestData(showLoading) {
  329. let that = this;
  330. that.API.requestData({
  331. showLoading,
  332. method: "POST",
  333. subUrl: "matrix/matrixPush",
  334. success(res) {
  335. if (res) {
  336. let sourceMap = res.data;
  337. let fjmap = [];
  338. for (let key in sourceMap) {
  339. if (key !== "fczbmap" && key !== "fjmap") {
  340. sourceMap[key] += "";
  341. } else if (key === "fjmap") {
  342. sourceMap[key].forEach((pItem) => {
  343. pItem.forEach((cItem) => {
  344. cItem.color = that.getColor(cItem.fjzt);
  345. cItem.isShow = true;
  346. });
  347. });
  348. }
  349. }
  350. that.sourceMap = sourceMap;
  351. if (that.fillCategory) {
  352. that.changeShow(that.fillCategory, that.fillFjzt, true);
  353. }
  354. } else {
  355. that.sourceMap = {};
  356. }
  357. },
  358. });
  359. },
  360. // 查看风机详情
  361. goDetails(item) {
  362. if (item.wpId.indexOf("FDC") !== -1) {
  363. this.$router.push({
  364. path: `/monitor/windsite/info/${item.wpId}/${item.wtId}`,
  365. });
  366. } else {
  367. this.$router.push({
  368. path: `windsite/inverter-info/${item.wpId}/${item.wtId}`
  369. });
  370. }
  371. },
  372. },
  373. created() {
  374. let that = this;
  375. that.$nextTick(() => {
  376. that.requestData(false);
  377. that.timmer = setInterval(() => {
  378. that.requestData(false);
  379. }, that.$store.state.websocketTimeSec);
  380. });
  381. },
  382. unmounted() {
  383. clearInterval(this.timmer);
  384. this.timmer = null;
  385. },
  386. };
  387. </script>
  388. <style lang="less" scoped>
  389. @panelHeight: 6.481vh;
  390. @titleHeight: 2.7778vh;
  391. .light-matrix {
  392. // width: calc(100% - 1.111vh);
  393. height: calc(100vh - 7.222vh);
  394. display: flex;
  395. flex-direction: column;
  396. .panel-2 {
  397. .left-50-16 {
  398. width: calc(50% - 0.741vh);
  399. }
  400. }
  401. .panel {
  402. width: 100%;
  403. border: 0.093vh solid @darkgray;
  404. position: relative;
  405. padding: 0.7407vh 1.4815vh;
  406. background-color: fade(@darkgray, 20%);
  407. display: flex;
  408. .dot {
  409. width: 0.185vh;
  410. height: 0.185vh;
  411. border-radius: 50%;
  412. background-color: @write;
  413. position: absolute;
  414. &.left {
  415. left: 0.37vh;
  416. }
  417. &.right {
  418. right: 0.37vh;
  419. }
  420. &.top {
  421. top: 0.37vh;
  422. }
  423. &.bottom {
  424. bottom: 0.37vh;
  425. }
  426. }
  427. .item {
  428. flex: 1;
  429. display: flex;
  430. align-items: center;
  431. justify-content: center;
  432. flex-direction: column;
  433. color: @write;
  434. position: relative;
  435. .loop {
  436. position: absolute;
  437. width: 4.444vh;
  438. height: 4.444vh;
  439. border-radius: 50%;
  440. border: 0.093vh solid @darkgray;
  441. background-color: fade(@darkgray, 20);
  442. left: calc(50% - 2.222vh);
  443. top: calc(50% - 2.222vh);
  444. }
  445. &.write {
  446. color: @write;
  447. }
  448. &.green {
  449. color: @green;
  450. }
  451. &.blue {
  452. color: @darkBlue;
  453. }
  454. &.pink {
  455. color: @pink;
  456. }
  457. &.red {
  458. color: @red;
  459. }
  460. &.orange {
  461. color: @orange;
  462. }
  463. &.gray {
  464. color: @gray;
  465. }
  466. div {
  467. line-height: 2.222vh;
  468. &:first-child {
  469. font-size: @fontsize-s;
  470. }
  471. &:last-child {
  472. font-size: @fontsize;
  473. font-family: "Bicubik";
  474. }
  475. }
  476. }
  477. .item2 {
  478. flex: 1;
  479. display: flex;
  480. width: 20%;
  481. flex-wrap: wrap;
  482. .name {
  483. color: @gray;
  484. width: 50%;
  485. text-align: center;
  486. }
  487. .num2 {
  488. width: 50%;
  489. color: @yellow;
  490. text-align: left;
  491. }
  492. .num1 {
  493. width: 50%;
  494. color: @yellow;
  495. text-align: center;
  496. position: relative;
  497. &::after {
  498. content: "";
  499. position: absolute;
  500. width: 1.481vh;
  501. height: 0.556vh;
  502. background-color: @yellow;
  503. left: 1.204vh;
  504. top: 0.741vh;
  505. }
  506. }
  507. .num3 {
  508. width: 50%;
  509. color: @yellow;
  510. text-align: left;
  511. }
  512. }
  513. }
  514. .panel-box {
  515. margin-top: 0.7407vh;
  516. flex-grow: 1;
  517. .panel-title {
  518. width: 100%;
  519. height: @titleHeight;
  520. line-height: @titleHeight;
  521. background-color: fade(@darkgray, 40%);
  522. .panel-title-name {
  523. font-size: @fontsize-s;
  524. color: @green;
  525. display: flex;
  526. align-items: center;
  527. padding: 0 16px;
  528. i {
  529. margin-right: 0.7407vh;
  530. }
  531. .sub-title-item {
  532. display: flex;
  533. flex: 1;
  534. .sub-title {
  535. flex: 0 0 auto;
  536. color: @gray;
  537. font-size: 12px;
  538. margin: 0 0.556vh 0 1.481vh;
  539. }
  540. .sub-count {
  541. flex: 1 0 auto;
  542. font-size: 14px;
  543. font-family: "Bicubik";
  544. font-weight: 500;
  545. &.write {
  546. color: @write;
  547. }
  548. &.green {
  549. color: @green;
  550. }
  551. &.blue {
  552. color: @darkBlue;
  553. }
  554. &.pink {
  555. color: @pink;
  556. }
  557. &.red {
  558. color: @red;
  559. }
  560. &.orange {
  561. color: @orange;
  562. }
  563. &.gray {
  564. color: @gray;
  565. }
  566. }
  567. }
  568. }
  569. }
  570. .panel-body {
  571. height: calc(100% - 7.407vh);
  572. padding: 0.3704vh;
  573. width: 100%;
  574. display: flex;
  575. flex-direction: row;
  576. flex-wrap: wrap;
  577. justify-content: space-between;
  578. justify-content: flex-start;
  579. .blank {
  580. margin-right: 2px;
  581. flex: 1 0 40px;
  582. }
  583. .card {
  584. margin-right: 2px;
  585. margin-top: 2px;
  586. flex: 1 0 40px;
  587. cursor: pointer;
  588. }
  589. .card {
  590. border-radius: 0.37vh;
  591. padding: 0.185vh 0.3704vh;
  592. text-align: center;
  593. border: 0.093vh solid;
  594. font-size: 12px;
  595. &.write {
  596. color: @black;
  597. border-color: @write;
  598. background-color: @write;
  599. }
  600. &.green {
  601. color: @green;
  602. border-color: @green;
  603. }
  604. &.blue {
  605. color: @darkBlue;
  606. border-color: @darkBlue;
  607. }
  608. &.pink {
  609. color: @pink;
  610. border-color: @pink;
  611. }
  612. &.red {
  613. color: @write;
  614. border-color: @red;
  615. background-color: @red;
  616. }
  617. &.orange {
  618. color: @orange;
  619. border-color: @orange;
  620. }
  621. &.gray {
  622. color: @write;
  623. border-color: @darkgray;
  624. background-color: @darkgray;
  625. }
  626. }
  627. }
  628. }
  629. .curStyle {
  630. cursor: pointer;
  631. }
  632. }
  633. </style>