LightMatrix1.vue 15 KB

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