LightMatrix1.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  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. console.log('!skipFill:',!skipFill)
  301. if (this.fillCategory === category) {
  302. console.log('fillCategory:',this.fillCategory)
  303. console.log('fillFjz:',this.fillFjzt)
  304. this.fillCategory = null;
  305. this.fillFjzt = null;
  306. } else {
  307. this.fillCategory = category;
  308. this.fillFjzt = fjzt;
  309. }
  310. }
  311. let fjmap = this.BASE.deepCopy(this.sourceMap.fjmap);
  312. fjmap.forEach((pEle) => {
  313. console.log('pele:',pEle)
  314. pEle.forEach((cEle) => {
  315. console.log('cele:',cEle)
  316. cEle.isShow = true;
  317. if (!this.fillCategory) {
  318. cEle.isShow = true;
  319. // cEle.isShow=false;
  320. } else if (cEle.wpId.indexOf(category.split("_")[1]) !== -1) {
  321. if (isNumber(fjzt)) {
  322. cEle.fjzt === fjzt ? (cEle.isShow = true) : (cEle.isShow = false);
  323. } else {
  324. cEle.isShow = true;
  325. // cEle.isShow = false;
  326. }
  327. } else {
  328. cEle.isShow = true;
  329. }
  330. });
  331. });
  332. this.sourceMap.fjmap = fjmap;
  333. },
  334. // 请求服务
  335. requestData(showLoading) {
  336. let that = this;
  337. that.API.requestData({
  338. showLoading,
  339. method: "POST",
  340. subUrl: "matrix/matrixPush",
  341. success(res) {
  342. if (res) {
  343. console.log('resmap:',res)
  344. let sourceMap = res.data;
  345. let fjmap = [];
  346. for (let key in sourceMap) {
  347. if (key !== "fczbmap" && key !== "fjmap") {
  348. sourceMap[key] += "";
  349. } else if (key === "fjmap") {
  350. sourceMap[key].forEach((pItem) => {
  351. pItem.forEach((cItem) => {
  352. cItem.color = that.getColor(cItem.fjzt);
  353. cItem.isShow = true;
  354. });
  355. });
  356. }
  357. }
  358. that.sourceMap = sourceMap;
  359. console.log('sourceMap:',that.sourceMap)
  360. if (that.fillCategory) {
  361. that.changeShow(that.fillCategory, that.fillFjzt, true);
  362. }
  363. } else {
  364. that.sourceMap = {};
  365. }
  366. },
  367. });
  368. },
  369. // 查看风机详情
  370. goDetails(item) {
  371. if (item.wpId.indexOf("FDC") !== -1) {
  372. this.$router.push({
  373. path: `/monitor/windsite/info/${item.wpId}/${item.wtId}`,
  374. });
  375. } else {
  376. this.$router.push({
  377. path: `windsite/inverter-info/${item.wpId}/${item.wtId}`,
  378. });
  379. }
  380. },
  381. },
  382. created() {
  383. let that = this;
  384. that.$nextTick(() => {
  385. that.requestData(false);
  386. that.timmer = setInterval(() => {
  387. that.requestData(false);
  388. }, that.$store.state.websocketTimeSec);
  389. });
  390. },
  391. unmounted() {
  392. clearInterval(this.timmer);
  393. this.timmer = null;
  394. },
  395. };
  396. </script>
  397. <style lang="less" scoped>
  398. @panelHeight: 6.481vh;
  399. @titleHeight: 2.7778vh;
  400. .light-matrix {
  401. // width: calc(100% - 1.111vh);
  402. height: calc(100vh - 7.222vh);
  403. display: flex;
  404. flex-direction: column;
  405. .panel-2 {
  406. .left-50-16 {
  407. width: calc(50% - 0.741vh);
  408. }
  409. }
  410. .panel {
  411. width: 100%;
  412. border: 0.093vh solid @darkgray;
  413. position: relative;
  414. padding: 0.7407vh 1.4815vh;
  415. background-color: fade(@darkgray, 20%);
  416. display: flex;
  417. .dot {
  418. width: 0.185vh;
  419. height: 0.185vh;
  420. border-radius: 50%;
  421. background-color: @write;
  422. position: absolute;
  423. &.left {
  424. left: 0.37vh;
  425. }
  426. &.right {
  427. right: 0.37vh;
  428. }
  429. &.top {
  430. top: 0.37vh;
  431. }
  432. &.bottom {
  433. bottom: 0.37vh;
  434. }
  435. }
  436. .item {
  437. flex: 1;
  438. display: flex;
  439. align-items: center;
  440. justify-content: center;
  441. flex-direction: column;
  442. color: @write;
  443. position: relative;
  444. .loop {
  445. position: absolute;
  446. width: 4.444vh;
  447. height: 4.444vh;
  448. border-radius: 50%;
  449. border: 0.093vh solid @darkgray;
  450. background-color: fade(@darkgray, 20);
  451. left: calc(50% - 2.222vh);
  452. top: calc(50% - 2.222vh);
  453. }
  454. &.write {
  455. color: @write;
  456. }
  457. &.green {
  458. color: @green;
  459. }
  460. &.blue {
  461. color: @darkBlue;
  462. }
  463. &.pink {
  464. color: @pink;
  465. }
  466. &.red {
  467. color: @red;
  468. }
  469. &.orange {
  470. color: @orange;
  471. }
  472. &.gray {
  473. color: @gray;
  474. }
  475. div {
  476. line-height: 2.222vh;
  477. &:first-child {
  478. font-size: @fontsize-s;
  479. }
  480. &:last-child {
  481. font-size: @fontsize;
  482. font-family: "Bicubik";
  483. }
  484. }
  485. }
  486. .item2 {
  487. flex: 1;
  488. display: flex;
  489. width: 20%;
  490. flex-wrap: wrap;
  491. .name {
  492. color: @gray;
  493. width: 50%;
  494. text-align: center;
  495. }
  496. .num2 {
  497. width: 50%;
  498. color: @yellow;
  499. text-align: left;
  500. }
  501. .num1 {
  502. width: 50%;
  503. color: @yellow;
  504. text-align: center;
  505. position: relative;
  506. &::after {
  507. content: "";
  508. position: absolute;
  509. width: 1.481vh;
  510. height: 0.556vh;
  511. background-color: @yellow;
  512. left: 1.204vh;
  513. top: 0.741vh;
  514. }
  515. }
  516. .num3 {
  517. width: 50%;
  518. color: @yellow;
  519. text-align: left;
  520. }
  521. }
  522. }
  523. .panel-box {
  524. margin-top: 0.7407vh;
  525. flex-grow: 1;
  526. .panel-title {
  527. width: 100%;
  528. height: @titleHeight;
  529. line-height: @titleHeight;
  530. background-color: fade(@darkgray, 40%);
  531. .panel-title-name {
  532. font-size: @fontsize-s;
  533. color: @green;
  534. display: flex;
  535. align-items: center;
  536. padding: 0 16px;
  537. i {
  538. margin-right: 0.7407vh;
  539. }
  540. .sub-title-item {
  541. display: flex;
  542. flex: 1;
  543. .sub-title {
  544. flex: 0 0 auto;
  545. color: @gray;
  546. font-size: 12px;
  547. margin: 0 0.556vh 0 1.481vh;
  548. }
  549. .sub-count {
  550. flex: 1 0 auto;
  551. font-size: 14px;
  552. font-family: "Bicubik";
  553. font-weight: 500;
  554. &.write {
  555. color: @write;
  556. }
  557. &.green {
  558. color: @green;
  559. }
  560. &.blue {
  561. color: @darkBlue;
  562. }
  563. &.pink {
  564. color: @pink;
  565. }
  566. &.red {
  567. color: @red;
  568. }
  569. &.orange {
  570. color: @orange;
  571. }
  572. &.gray {
  573. color: @gray;
  574. }
  575. }
  576. }
  577. }
  578. }
  579. .panel-body {
  580. height: calc(100% - 7.407vh);
  581. padding: 0.3704vh;
  582. width: 100%;
  583. display: flex;
  584. flex-direction: row;
  585. flex-wrap: wrap;
  586. justify-content: space-between;
  587. justify-content: flex-start;
  588. .blank {
  589. margin-right: 2px;
  590. flex: 1 0 40px;
  591. }
  592. .card {
  593. margin-right: 2px;
  594. margin-top: 2px;
  595. flex: 1 0 40px;
  596. cursor: pointer;
  597. }
  598. .card {
  599. border-radius: 0.37vh;
  600. padding: 0.185vh 0.3704vh;
  601. text-align: center;
  602. border: 0.093vh solid;
  603. font-size: 12px;
  604. &.write {
  605. color: @black;
  606. border-color: @write;
  607. background-color: @write;
  608. }
  609. &.green {
  610. color: @green;
  611. border-color: @green;
  612. }
  613. &.blue {
  614. color: @darkBlue;
  615. border-color: @darkBlue;
  616. }
  617. &.pink {
  618. color: @pink;
  619. border-color: @pink;
  620. }
  621. &.red {
  622. color: @write;
  623. border-color: @red;
  624. background-color: @red;
  625. }
  626. &.orange {
  627. color: @orange;
  628. border-color: @orange;
  629. }
  630. &.gray {
  631. color: @write;
  632. border-color: @darkgray;
  633. background-color: @darkgray;
  634. }
  635. }
  636. }
  637. }
  638. .curStyle {
  639. cursor: pointer;
  640. }
  641. }
  642. </style>