LightMatrix1.vue 15 KB

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