LightMatrix1.vue 15 KB

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