LightMatrix2.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  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. <i :class="panel1Data.first.icon"></i>
  12. </div>
  13. <div class="item" :class="data.color" v-for="(data, index) of panel1Data.datas" :key="index">
  14. <div>{{ data.test }}</div>
  15. <div>{{ sourceMap[data.key] }}</div>
  16. </div>
  17. </div>
  18. </Col>
  19. <Col :span="12" class="left-50-16">
  20. <div class="panel">
  21. <div class="dot left top"></div>
  22. <div class="dot left bottom"></div>
  23. <div class="dot right top"></div>
  24. <div class="dot right bottom"></div>
  25. <div class="item2" v-for="(data, index) of panel2Data.datas" :key="index">
  26. <div class="name">{{ data.test }}</div>
  27. <div class="num2">{{ sourceMap[data.key] }}</div>
  28. <!-- <div class="num1">×{{ data.num1 }}</div> -->
  29. <div class="num3">{{ data.num3 }}</div>
  30. </div>
  31. </div>
  32. </Col>
  33. </Row>
  34. <div class="panel-box">
  35. <div v-for="(pItem, pIndex) of sourceMap.fjmap" :key="pIndex">
  36. <div>
  37. <div class="panel-title">
  38. <div class="panel-title-name">
  39. <i class="fa fa-send"></i>
  40. <span>{{sourceMap.fczbmap[pItem[pIndex].wpId].name}}</span>
  41. <div class="sub-title-item" v-for="(data, index) in tables[0].subTitleDatas" :key="index">
  42. <span class="sub-title">{{ data.text }}</span>
  43. <span class="sub-count" :class="data.color">{{ sourceMap.fczbmap[pItem[pIndex].wpId][data.key] }}</span>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="panel-body">
  48. <table>
  49. <tbody>
  50. <tr>
  51. <td v-for="(cItem, cIndex) in pItem" :key="cIndex">
  52. <div class="card" :class="cItem.color">
  53. <div class="card-panel">
  54. <div class="card-left">
  55. <div class="tag">{{ cItem.wtnum }}</div>
  56. </div>
  57. <div class="card-right">
  58. <div class="num">{{ cItem.gl }}</div>
  59. <div class="num">{{ cItem.fs }}</div>
  60. </div>
  61. </div>
  62. <div class="card-percent">
  63. <div class="split-item"></div>
  64. <div class="split-item"></div>
  65. <div class="split-item"></div>
  66. <div class="split-item"></div>
  67. <div class="split-item"></div>
  68. <div class="percent" :style="'width: ' + cItem.lyl + '%'"></div>
  69. </div>
  70. </div>
  71. </td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import Row from "@/components/coms/grid/row.vue";
  83. import Col from "@/components/coms/grid/col.vue";
  84. import util from "@/helper/util.js";
  85. import { datainit, webtest } from "@tools/websocket.js";
  86. import store from "@store/index.js";
  87. export default {
  88. // 名称
  89. name: "LightMatrix2",
  90. // 使用组件
  91. components: {
  92. Row,
  93. Col,
  94. },
  95. // 数据
  96. data () {
  97. return {
  98. loadingFlg: false, // 遮罩开关
  99. websocketServe: null, // websocket 服务实例
  100. sourceMap: {}, // 核心数据
  101. panel1Data: {
  102. first: {
  103. icon: "fa fa-user",
  104. },
  105. datas: [
  106. {
  107. color: "write",
  108. test: "接入风机",
  109. key: "fcjrnum"
  110. },
  111. {
  112. color: "blue",
  113. test: "· 运行",
  114. key: "fcyxnum"
  115. },
  116. {
  117. color: "green",
  118. test: "· 待机",
  119. key: "fcdjnum"
  120. },
  121. {
  122. color: "purple",
  123. test: "· 限电",
  124. key: "fcxdnum"
  125. },
  126. {
  127. color: "red",
  128. test: "· 故障",
  129. key: "fcgznum"
  130. },
  131. {
  132. color: "orange",
  133. test: "· 检修",
  134. key: "fcwhnum"
  135. },
  136. {
  137. color: "write",
  138. test: "· 受累",
  139. key: "fcslnum"
  140. },
  141. {
  142. color: "gray",
  143. test: "· 离线",
  144. key: "fclxnum"
  145. },
  146. ],
  147. },
  148. panel2Data: {
  149. datas: [
  150. {
  151. test: "欠发电量",
  152. num1: 5,
  153. key: "r0qf",
  154. num3: "0%~5%",
  155. },
  156. {
  157. test: "欠发电量",
  158. num1: 4,
  159. key: "r1qf",
  160. num3: "5%~10%",
  161. },
  162. {
  163. test: "欠发电量",
  164. num1: 3,
  165. key: "r2qf",
  166. num3: "10%~20%",
  167. },
  168. {
  169. test: "欠发电量",
  170. num1: 2,
  171. key: "r3qf",
  172. num3: "20%~40%",
  173. },
  174. {
  175. test: "欠发电量",
  176. num1: 1,
  177. key: "r4qf",
  178. num3: ">40%",
  179. },
  180. ],
  181. },
  182. tables: [
  183. {
  184. col: 15,
  185. subTitleDatas: [
  186. {
  187. text: "接入台数",
  188. color: "write",
  189. key: "jrts"
  190. },
  191. {
  192. text: "待机台数",
  193. color: "green",
  194. key: "djts"
  195. },
  196. {
  197. text: "并网台数",
  198. color: "blue",
  199. key: "yxts",
  200. },
  201. {
  202. text: "限电台数",
  203. color: "purple",
  204. key: "xdts"
  205. },
  206. {
  207. text: "故障台数",
  208. color: "red",
  209. key: "gzts"
  210. },
  211. {
  212. text: "检修台数",
  213. color: "orange",
  214. key: "whts"
  215. },
  216. {
  217. text: "受累台数",
  218. color: "write",
  219. key: "slts"
  220. },
  221. {
  222. text: "离线台数",
  223. color: "gray",
  224. key: "lxts"
  225. },
  226. {
  227. text: "风速",
  228. color: "gray",
  229. key: "ssfs"
  230. },
  231. {
  232. text: "预测功率",
  233. color: "gray",
  234. key: "ycgl"
  235. },
  236. {
  237. text: "保证功率",
  238. color: "gray",
  239. key: "bzgl"
  240. },
  241. {
  242. text: "应发功率",
  243. color: "gray",
  244. key: "yfgl"
  245. },
  246. {
  247. text: "实际功率",
  248. color: "gray",
  249. key: "sjgl"
  250. },
  251. {
  252. text: "AGC指令",
  253. color: "gray",
  254. key: "agcygsd"
  255. },
  256. {
  257. text: "出线功率",
  258. color: "gray",
  259. key: "agccxyg"
  260. },
  261. ],
  262. datas: [
  263. {
  264. tag: "01",
  265. num1: "985.97 kw",
  266. num2: "6.45 m/s",
  267. percent: 70,
  268. color: "blue",
  269. },
  270. ],
  271. groupDatas: [],
  272. },
  273. ],
  274. };
  275. },
  276. // 函数
  277. methods: {
  278. getColor (fjzt) {
  279. switch (fjzt) {
  280. case 0:
  281. return 'green';
  282. break;
  283. case 1:
  284. return 'blue';
  285. break;
  286. case 2:
  287. return 'red';
  288. break;
  289. case 3:
  290. return 'gray';
  291. break;
  292. case 4:
  293. return 'orange';
  294. break;
  295. case 5:
  296. return 'purple';
  297. break;
  298. case 6:
  299. return 'write';
  300. break;
  301. }
  302. },
  303. calcGfStr (calcStr) {
  304. return (parseInt(this.sourceMap[calcStr[0]]) + parseInt(this.sourceMap[calcStr[1]])) + "";
  305. },
  306. createGroupDatas: function (table) {
  307. table.groupDatas = [];
  308. let tempDatas = [];
  309. table.datas.forEach((data, index) => {
  310. if (index % table.col == 0) {
  311. if (tempDatas.length > 0) {
  312. table.groupDatas.push(util.copy(tempDatas));
  313. tempDatas = [];
  314. }
  315. }
  316. tempDatas.push(util.copy(data));
  317. });
  318. if (tempDatas.length > 0) {
  319. table.groupDatas.push(util.copy(tempDatas));
  320. tempDatas = [];
  321. }
  322. },
  323. },
  324. created () {
  325. // 创建后
  326. let tempData = [];
  327. for (let i = 0; i < 45; i++) {
  328. tempData.push(util.copy(this.tables[0].datas[0]));
  329. if (i == 39) {
  330. tempData[i].color = "green";
  331. }
  332. if (i == 40) {
  333. tempData[i].color = "purple";
  334. }
  335. if (i == 41) {
  336. tempData[i].color = "orange";
  337. }
  338. if (i == 42) {
  339. tempData[i].color = "red";
  340. }
  341. if (i == 43) {
  342. tempData[i].color = "write";
  343. }
  344. if (i == 44) {
  345. tempData[i].color = "gray";
  346. }
  347. }
  348. this.tables[0].datas = util.copy(tempData);
  349. this.createGroupDatas(this.tables[0]);
  350. for (let i = 0; i < 5; i++) {
  351. this.tables.push(util.copy(this.tables[0]));
  352. }
  353. },
  354. mounted () {
  355. let that = this;
  356. that.loadingFlg = true;
  357. that.BASE.showLoading();
  358. that.$nextTick(() => {
  359. that.websocketServe && that.websocketServe.disconnect();
  360. that.API.requestData({
  361. method: "POST",
  362. subUrl: "admin/websocketdisconnect",
  363. success () {
  364. that.websocketServe = datainit("/topic/matrixqfpushtask");
  365. }
  366. });
  367. });
  368. },
  369. watch: {
  370. // 监听 websocket 回调并包装数据用于展示
  371. '$store.state.windturbineMap': function (res) {
  372. this.loadingFlg && this.BASE.closeLoading();
  373. this.loadingFlg = false;
  374. if (res) {
  375. let sourceMap = JSON.parse(res);
  376. for (let key in sourceMap) {
  377. if (key !== 'fczbmap' && key !== 'fjmap') {
  378. sourceMap[key] += '';
  379. } else if (key === 'fjmap') {
  380. sourceMap[key].forEach(pItem => {
  381. pItem.forEach(cItem => {
  382. cItem.color = this.getColor(cItem.fjzt);
  383. cItem.isShow = true;
  384. });
  385. });
  386. }
  387. }
  388. this.sourceMap = sourceMap;
  389. } else {
  390. this.sourceMap = {};
  391. }
  392. }
  393. }
  394. };
  395. </script>
  396. <style lang="less" scoped>
  397. @panelHeight: 6.481vh;
  398. @titleHeight: 3.704vh;
  399. .light-matrix {
  400. width: calc(100% - 1.111vh);
  401. height: calc(100vh - 7.222vh);
  402. display: flex;
  403. flex-direction: column;
  404. .panel-2 {
  405. .left-50-16 {
  406. width: calc(50% - 0.741vh);
  407. }
  408. }
  409. .panel {
  410. width: 100%;
  411. border: 1px solid @gray;
  412. position: relative;
  413. padding: 1.111vh 2.222vh;
  414. background-color: fade(@gray, 20%);
  415. display: flex;
  416. height: 6.944vh;
  417. .dot {
  418. width: 2px;
  419. height: 2px;
  420. border-radius: 50%;
  421. background-color: @write;
  422. position: absolute;
  423. &.left {
  424. left: 4px;
  425. }
  426. &.right {
  427. right: 4px;
  428. }
  429. &.top {
  430. top: 4px;
  431. }
  432. &.bottom {
  433. bottom: 4px;
  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. i {
  444. color: @gray;
  445. font-size: 2.778vh;
  446. }
  447. &.write {
  448. color: @write;
  449. }
  450. &.green {
  451. color: @green;
  452. }
  453. &.blue {
  454. color: @darkBlue;
  455. }
  456. &.purple {
  457. color: @purple;
  458. }
  459. &.red {
  460. color: @red;
  461. }
  462. &.orange {
  463. color: @orange;
  464. }
  465. &.gray {
  466. color: @gray;
  467. }
  468. div {
  469. line-height: 2.222vh;
  470. &:first-child {
  471. font-size: @fontsize;
  472. }
  473. &:last-child {
  474. font-size: @fontsize-l;
  475. font-family: 'Bicubik';
  476. }
  477. }
  478. }
  479. .item2 {
  480. flex: 1;
  481. display: flex;
  482. width: 20%;
  483. flex-wrap: wrap;
  484. .name {
  485. color: @gray;
  486. width: 50%;
  487. text-align: center;
  488. }
  489. .num2 {
  490. width: 50%;
  491. color: @yellow;
  492. text-align: left;
  493. }
  494. .num1 {
  495. width: 50%;
  496. color: @yellow;
  497. text-align: center;
  498. position: relative;
  499. &::after {
  500. content: '';
  501. position: absolute;
  502. width: 1.481vh;
  503. height: 0.556vh;
  504. background-color: @yellow;
  505. left: 1.204vh;
  506. top: 0.741vh;
  507. }
  508. }
  509. .num3 {
  510. width: 50%;
  511. color: @yellow;
  512. text-align: left;
  513. }
  514. }
  515. }
  516. .panel-box {
  517. margin-top: 1.481vh;
  518. flex-grow: 1;
  519. overflow: auto;
  520. .panel-title {
  521. width: 100%;
  522. height: @titleHeight;
  523. line-height: @titleHeight;
  524. background-color: fade(@gray, 40%);
  525. .panel-title-name {
  526. font-size: 1.111vh;
  527. color: @green;
  528. display: flex;
  529. align-items: center;
  530. i {
  531. margin: 0 0.556vh 0 1.481vh;
  532. }
  533. .sub-title-item {
  534. .sub-title {
  535. color: @gray;
  536. font-size: 1.019vh;
  537. margin: 0 0.556vh 0 1.481vh;
  538. }
  539. .sub-count {
  540. font-size: 1.296vh;
  541. font-family: 'Bicubik';
  542. font-weight: 500;
  543. &.write {
  544. color: @write;
  545. }
  546. &.green {
  547. color: @green;
  548. }
  549. &.blue {
  550. color: @blue;
  551. }
  552. &.purple {
  553. color: @purple;
  554. }
  555. &.red {
  556. color: @red;
  557. }
  558. &.orange {
  559. color: @orange;
  560. }
  561. &.gray {
  562. color: @gray;
  563. }
  564. }
  565. }
  566. }
  567. }
  568. .panel-body {
  569. height: calc(100% - 7.407vh);
  570. background-color: fade(@gray, 20%);
  571. padding: 0.741vh;
  572. overflow: auto;
  573. margin-bottom: 1.481vh;
  574. table {
  575. width: 100%;
  576. .card {
  577. border: 1px solid;
  578. .card-panel {
  579. display: flex;
  580. flex-grow: row;
  581. .card-left {
  582. width: 40%;
  583. border-right: 1px dotted;
  584. .tag {
  585. color: @write;
  586. font-size: 1.111vh;
  587. width: 100%;
  588. text-align: center;
  589. }
  590. }
  591. .card-right {
  592. width: 60%;
  593. .num {
  594. width: 100%;
  595. font-size: 1.019vh;
  596. text-align: right;
  597. padding-right: 0.278vh;
  598. }
  599. }
  600. }
  601. .card-percent {
  602. height: 0.926vh;
  603. padding: 0.093vh 0.185vh;
  604. position: relative;
  605. border-top: 1px solid;
  606. background-color: transparent;
  607. display: flex;
  608. .split-item {
  609. flex: 1;
  610. border-right: 1px solid @black;
  611. z-index: 1;
  612. &:last-child {
  613. border: none;
  614. }
  615. }
  616. .percent {
  617. height: 0.648vh;
  618. background-color: @yellow;
  619. position: absolute;
  620. left: 0.185vh;
  621. top: 0.093vh;
  622. }
  623. }
  624. &.blue {
  625. border-color: @darkBlue;
  626. background-color: fade(@darkBlue, 30%);
  627. .card-panel {
  628. .card-left {
  629. border-color: @darkBlue;
  630. }
  631. .card-right {
  632. .num {
  633. color: @darkBlue;
  634. }
  635. }
  636. }
  637. .card-percent {
  638. border-color: @darkBlue;
  639. }
  640. }
  641. &.purple {
  642. border-color: @purple;
  643. background-color: fade(@purple, 30%);
  644. .card-panel {
  645. .card-left {
  646. border-color: @purple;
  647. }
  648. .card-right {
  649. .num {
  650. color: @purple;
  651. }
  652. }
  653. }
  654. .card-percent {
  655. border-color: @purple;
  656. }
  657. }
  658. &.orange {
  659. border-color: @orange;
  660. background-color: fade(@orange, 30%);
  661. .card-panel {
  662. .card-left {
  663. border-color: @orange;
  664. }
  665. .card-right {
  666. .num {
  667. color: @orange;
  668. }
  669. }
  670. }
  671. .card-percent {
  672. border-color: @orange;
  673. }
  674. }
  675. &.green {
  676. border-color: @green;
  677. background-color: fade(@green, 30%);
  678. .card-panel {
  679. .card-left {
  680. border-color: @green;
  681. }
  682. .card-right {
  683. .num {
  684. color: @green;
  685. }
  686. }
  687. }
  688. .card-percent {
  689. border-color: @green;
  690. }
  691. }
  692. &.gray {
  693. border-color: @gray;
  694. background-color: fade(@gray, 30%);
  695. .card-panel {
  696. .card-left {
  697. border-color: @gray;
  698. }
  699. .card-right {
  700. .num {
  701. color: @gray;
  702. }
  703. }
  704. }
  705. .card-percent {
  706. border-color: @gray;
  707. }
  708. }
  709. &.red {
  710. border-color: @red;
  711. .card-panel {
  712. background-color: @red;
  713. .card-left {
  714. border-color: @darkRed;
  715. }
  716. .card-right {
  717. .num {
  718. color: @write;
  719. }
  720. }
  721. }
  722. .card-percent {
  723. border-color: @red;
  724. }
  725. }
  726. &.write {
  727. border-color: @write;
  728. .card-panel {
  729. background-color: @write;
  730. .card-left {
  731. border-color: @black;
  732. .tag {
  733. color: @black;
  734. }
  735. }
  736. .card-right {
  737. .num {
  738. color: @black;
  739. }
  740. }
  741. }
  742. .card-percent {
  743. border-color: @write;
  744. }
  745. }
  746. }
  747. }
  748. }
  749. }
  750. }
  751. </style>