LightMatrix1.vue 15 KB

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