LightMatrix2.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  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-lg">
  12. <svg-icon svgid="svg-wind-site"></svg-icon>
  13. </span>
  14. </div>
  15. <div
  16. class="item curStyle"
  17. :class="data.color"
  18. v-for="(data, index) of panel1Data.datas"
  19. :key="index" @click="changeShow(data.category,data.fjzt)"
  20. >
  21. <div>{{ data.test }}</div>
  22. <div>{{ sourceMap[data.key] }}</div>
  23. </div>
  24. </div>
  25. </Col>
  26. <Col :span="12" class="left-50-16">
  27. <div class="panel">
  28. <div class="dot left top"></div>
  29. <div class="dot left bottom"></div>
  30. <div class="dot right top"></div>
  31. <div class="dot right bottom"></div>
  32. <div
  33. class="item2"
  34. v-for="(data, index) of panel2Data.datas"
  35. :key="index"
  36. >
  37. <div class="name">{{ data.test }}</div>
  38. <div class="num2">{{ sourceMap[data.key] }}</div>
  39. <div class="num1">×{{ data.num1 }}</div>
  40. <div class="num3">{{ data.num3 }}</div>
  41. </div>
  42. </div>
  43. </Col>
  44. </Row>
  45. <el-scrollbar>
  46. <div class="panel-box">
  47. <div v-for="(pItem, pIndex) of sourceMap.fjmap" :key="pIndex">
  48. <div class="panel-title">
  49. <div class="panel-title-name">
  50. <i class="svg-icon svg-icon-sm svg-icon-green">
  51. <SvgIcon :svgid="'svg-wind-site'"></SvgIcon>
  52. </i>
  53. <span>{{ sourceMap.fczbmap[pItem[pIndex].wpId].name }}</span>
  54. <div
  55. class="sub-title-item"
  56. v-for="(data, index) in tables[0].subTitleDatas"
  57. :key="index"
  58. >
  59. <span class="sub-title">{{ data.text }}</span>
  60. <span class="sub-count" :class="data.color">{{
  61. sourceMap.fczbmap[pItem[pIndex].wpId][data.key]
  62. }}</span>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="panel-body">
  67. <div
  68. class="card"
  69. v-for="(cItem, cIndex) in pItem"
  70. :key="cIndex"
  71. v-show="cItem.isShow"
  72. :class="cItem.color"
  73. @click="goDetails(cItem)"
  74. >
  75. <div class="card-panel">
  76. <div class="card-left">
  77. <div class="tag">{{ cItem.wtId.substring(cItem.wtId.length - 3)}}</div>
  78. </div>
  79. <div class="card-right">
  80. <div class="num">{{ cItem.gl }}&nbsp;kw</div>
  81. <div class="num">{{ cItem.fs }}&nbsp;m/s</div>
  82. </div>
  83. </div>
  84. <div class="card-percent">
  85. <div class="split-item"></div>
  86. <div class="split-item"></div>
  87. <div class="split-item"></div>
  88. <div class="split-item"></div>
  89. <div class="split-item"></div>
  90. <div class="percent" :style="'width: ' + cItem.lyl + '%'"></div>
  91. </div>
  92. </div>
  93. <!-- 站位用 保证卡片布局最后一行不会有问题 -->
  94. <i class="blank" v-for="i in pItem.length" :key="i"></i>
  95. </div>
  96. </div>
  97. </div>
  98. </el-scrollbar>
  99. </div>
  100. </template>
  101. <script>
  102. import Row from "@/components/coms/grid/row.vue";
  103. import Col from "@/components/coms/grid/col.vue";
  104. import util from "@/helper/util.js";
  105. import api from "@api/cockpit/matrix/index.js";
  106. import store from "@store/index.js";
  107. import { isNumber } from "util";
  108. import SvgIcon from "../../components/coms/icon/svg-icon.vue";
  109. export default {
  110. // 名称
  111. name: "LightMatrix2",
  112. // 使用组件
  113. components: {
  114. Row,
  115. Col,
  116. SvgIcon,
  117. },
  118. // 数据
  119. data() {
  120. return {
  121. timmer: null, // 计时器
  122. sourceMap: {}, // 核心数据
  123. fillCategory: null, // 过滤条件
  124. fillFjzt: null, // 过滤条件
  125. panel1Data: {
  126. first: {
  127. icon: "fa fa-user",
  128. },
  129. datas: [
  130. {
  131. color: "write",
  132. test: "接入风机",
  133. key: "fcjrnum",
  134. category:'jrfj_FDC'
  135. },
  136. {
  137. color: "blue",
  138. test: "· 运行",
  139. key: "fcyxnum",
  140. category:'yx_FDC',
  141. fjzt:1
  142. },
  143. {
  144. color: "green",
  145. test: "· 待机",
  146. key: "fcdjnum",
  147. category:'dj_FDC',
  148. fjzt:0
  149. },
  150. {
  151. color: "pink",
  152. test: "· 限电",
  153. key: "fcxdnum",
  154. category:'xd_FDC',
  155. fjzt:5
  156. },
  157. {
  158. color: "red",
  159. test: "· 故障",
  160. key: "fcgznum",
  161. category:'gz_FDC',
  162. fjzt:2
  163. },
  164. {
  165. color: "orange",
  166. test: "· 检修",
  167. key: "fcwhnum",
  168. category:'jx_FDC',
  169. fjzt:4
  170. },
  171. {
  172. color: "write",
  173. test: "· 受累",
  174. key: "fcslnum",
  175. category:'sl_FDC',
  176. fjzt:6
  177. },
  178. {
  179. color: "gray",
  180. test: "· 离线",
  181. key: "fclxnum",
  182. category:'lx_FDC',
  183. fjzt:3
  184. },
  185. ],
  186. },
  187. panel2Data: {
  188. datas: [
  189. {
  190. test: "欠发电量",
  191. num1: 5,
  192. key: "r0qf",
  193. num3: "0%~5%",
  194. },
  195. {
  196. test: "欠发电量",
  197. num1: 4,
  198. key: "r1qf",
  199. num3: "5%~10%",
  200. },
  201. {
  202. test: "欠发电量",
  203. num1: 3,
  204. key: "r2qf",
  205. num3: "10%~20%",
  206. },
  207. {
  208. test: "欠发电量",
  209. num1: 2,
  210. key: "r3qf",
  211. num3: "20%~40%",
  212. },
  213. {
  214. test: "欠发电量",
  215. num1: 1,
  216. key: "r4qf",
  217. num3: ">40%",
  218. },
  219. ],
  220. },
  221. tables: [
  222. {
  223. col: 15,
  224. subTitleDatas: [
  225. {
  226. text: "接入台数",
  227. color: "write",
  228. key: "jrts",
  229. },
  230. {
  231. text: "待机台数",
  232. color: "green",
  233. key: "djts",
  234. },
  235. {
  236. text: "并网台数",
  237. color: "blue",
  238. key: "yxts",
  239. },
  240. {
  241. text: "限电台数",
  242. color: "pink",
  243. key: "xdts",
  244. },
  245. {
  246. text: "故障台数",
  247. color: "red",
  248. key: "gzts",
  249. },
  250. {
  251. text: "检修台数",
  252. color: "orange",
  253. key: "whts",
  254. },
  255. {
  256. text: "受累台数",
  257. color: "write",
  258. key: "slts",
  259. },
  260. {
  261. text: "离线台数",
  262. color: "gray",
  263. key: "lxts",
  264. },
  265. {
  266. text: "风速",
  267. color: "gray",
  268. key: "ssfs",
  269. },
  270. {
  271. text: "预测功率",
  272. color: "gray",
  273. key: "ycgl",
  274. },
  275. {
  276. text: "保证功率",
  277. color: "gray",
  278. key: "bzgl",
  279. },
  280. {
  281. text: "应发功率",
  282. color: "gray",
  283. key: "yfgl",
  284. },
  285. {
  286. text: "实际功率",
  287. color: "gray",
  288. key: "sjgl",
  289. },
  290. {
  291. text: "AGC指令",
  292. color: "gray",
  293. key: "agcygsd",
  294. },
  295. {
  296. text: "出线功率",
  297. color: "gray",
  298. key: "agccxyg",
  299. },
  300. ],
  301. datas: [
  302. {
  303. tag: "01",
  304. num1: "985.97 kw",
  305. num2: "6.45 m/s",
  306. percent: 70,
  307. color: "blue",
  308. },
  309. ],
  310. },
  311. ],
  312. };
  313. },
  314. // 函数
  315. methods: {
  316. getColor(fjzt) {
  317. switch (fjzt) {
  318. case 0:
  319. return "green";
  320. case 1:
  321. return "blue";
  322. case 2:
  323. return "red";
  324. case 3:
  325. return "gray";
  326. case 4:
  327. return "orange";
  328. case 5:
  329. return "pink";
  330. case 6:
  331. // return "pink";
  332. return "write";
  333. }
  334. },
  335. calcGfStr(calcStr) {
  336. return (
  337. parseInt(this.sourceMap[calcStr[0]]) +
  338. parseInt(this.sourceMap[calcStr[1]]) +
  339. ""
  340. );
  341. },
  342. // 切换显示种类
  343. changeShow(category, fjzt, skipFill) {
  344. // if (!skipFill) {
  345. // console.log('!skipFill:',!skipFill)
  346. // if (this.fillCategory === category) {
  347. // console.log('fillCategory:',this.fillCategory)
  348. // console.log('fillFjz:',this.fillFjzt)
  349. // this.fillCategory = null;
  350. // this.fillFjzt = null;
  351. // } else {
  352. this.fillCategory = category;
  353. this.fillFjzt = fjzt;
  354. // }
  355. // }
  356. let fjmap = this.BASE.deepCopy(this.sourceMap.fjmap);
  357. fjmap.forEach((pEle) => {
  358. // console.log('pele:',pEle)
  359. pEle.forEach((cEle) => {
  360. // console.log('cele:',cEle)
  361. cEle.isShow = true;
  362. if (!this.fillCategory) {
  363. cEle.isShow = true;
  364. // cEle.isShow=false;
  365. } else if (cEle.wpId.indexOf(category.split("_")[1]) !== -1) {
  366. if (isNumber(fjzt)) {
  367. cEle.fjzt === fjzt ? (cEle.isShow = true) : (cEle.isShow = false);
  368. } else {
  369. cEle.isShow = true;
  370. // cEle.isShow = false;
  371. }
  372. } else {
  373. cEle.isShow = true;
  374. }
  375. });
  376. });
  377. this.sourceMap.fjmap = fjmap;
  378. },
  379. // 请求服务
  380. requestData(showLoading) {
  381. api.matrixQfPush(showLoading).then(res =>{
  382. if (res.data) {
  383. let sourceMap = res.data;
  384. for (let key in sourceMap) {
  385. if (key !== "fczbmap" && key !== "fjmap") {
  386. sourceMap[key] += "";
  387. } else if (key === "fjmap") {
  388. sourceMap[key].forEach((pItem) => {
  389. pItem.forEach((cItem) => {
  390. cItem.color = this.getColor(cItem.fjzt);
  391. cItem.isShow = true;
  392. });
  393. });
  394. }
  395. }
  396. this.sourceMap = sourceMap;
  397. console.log('sourceMap:',this.sourceMap)
  398. if (this.fillCategory) {
  399. this.changeShow(this.fillCategory, this.fillFjzt, true);
  400. }
  401. } else {
  402. this.sourceMap = {};
  403. }
  404. })
  405. // let that = this;
  406. // that.API.requestData({
  407. // showLoading,
  408. // method: "POST",
  409. // subUrl: "matrix/matrixQfPush",
  410. // success(res) {
  411. // if (res.data) {
  412. // let sourceMap = res.data;
  413. // for (let key in sourceMap) {
  414. // if (key !== "fczbmap" && key !== "fjmap") {
  415. // sourceMap[key] += "";
  416. // } else if (key === "fjmap") {
  417. // sourceMap[key].forEach((pItem) => {
  418. // pItem.forEach((cItem) => {
  419. // cItem.color = that.getColor(cItem.fjzt);
  420. // cItem.isShow = true;
  421. // });
  422. // });
  423. // }
  424. // }
  425. // that.sourceMap = sourceMap;
  426. // console.log('sourceMap:',that.sourceMap)
  427. // if (that.fillCategory) {
  428. // that.changeShow(that.fillCategory, that.fillFjzt, true);
  429. // }
  430. // } else {
  431. // that.sourceMap = {};
  432. // }
  433. // },
  434. // });
  435. },
  436. // 查看风机详情
  437. goDetails(item) {
  438. this.$router.push({
  439. path: `/monitor/windsite/info/${item.wpId}/${item.wtId}`,
  440. });
  441. },
  442. },
  443. created() {
  444. let that = this;
  445. that.$nextTick(() => {
  446. that.requestData(true);
  447. that.timmer = setInterval(() => {
  448. that.requestData(false);
  449. }, that.$store.state.websocketTimeSec);
  450. });
  451. },
  452. mounted() {},
  453. unmounted() {
  454. clearInterval(this.timmer);
  455. this.timmer = null;
  456. },
  457. };
  458. </script>
  459. <style lang="less" scoped>
  460. @panelHeight: 6.481vh;
  461. @titleHeight: 26px;
  462. .light-matrix {
  463. // width: calc(100% - 1.111vh);
  464. height: calc(100vh - 7.222vh);
  465. display: flex;
  466. flex-direction: column;
  467. .panel-2 {
  468. .left-50-16 {
  469. width: calc(50% - 0.741vh);
  470. }
  471. }
  472. .panel {
  473. width: 100%;
  474. border: 0.093vh solid @darkgray;
  475. position: relative;
  476. padding: 1.111vh 2.222vh;
  477. background-color: fade(@darkgray, 20%);
  478. display: flex;
  479. height: 6.944vh;
  480. .dot {
  481. width: 0.185vh;
  482. height: 0.185vh;
  483. border-radius: 50%;
  484. background-color: @write;
  485. position: absolute;
  486. &.left {
  487. left: 0.37vh;
  488. }
  489. &.right {
  490. right: 0.37vh;
  491. }
  492. &.top {
  493. top: 0.37vh;
  494. }
  495. &.bottom {
  496. bottom: 0.37vh;
  497. }
  498. }
  499. .item {
  500. flex: 1;
  501. display: flex;
  502. align-items: center;
  503. justify-content: center;
  504. flex-direction: column;
  505. color: @write;
  506. i {
  507. color: @gray;
  508. font-size: 2.778vh;
  509. }
  510. &.write {
  511. color: @write;
  512. }
  513. &.green {
  514. color: @green;
  515. }
  516. &.blue {
  517. color: @darkBlue;
  518. }
  519. &.pink {
  520. color: @pink;
  521. }
  522. &.red {
  523. color: @red;
  524. }
  525. &.orange {
  526. color: @orange;
  527. }
  528. &.gray {
  529. color: @gray;
  530. }
  531. div {
  532. line-height: 2.222vh;
  533. &:first-child {
  534. font-size: @fontsize-s;
  535. }
  536. &:last-child {
  537. font-size: @fontsize;
  538. font-family: "Bicubik";
  539. }
  540. }
  541. }
  542. .item2 {
  543. flex: 1;
  544. display: flex;
  545. width: 20%;
  546. flex-wrap: wrap;
  547. .name {
  548. color: @gray;
  549. width: 50%;
  550. text-align: center;
  551. }
  552. .num2 {
  553. width: 50%;
  554. color: @yellow;
  555. text-align: left;
  556. }
  557. .num1 {
  558. width: 50%;
  559. color: @yellow;
  560. text-align: center;
  561. position: relative;
  562. &::after {
  563. content: "";
  564. position: absolute;
  565. width: 1.481vh;
  566. height: 0.556vh;
  567. background-color: @yellow;
  568. left: 1.204vh;
  569. top: 0.741vh;
  570. }
  571. }
  572. .num3 {
  573. width: 50%;
  574. color: @yellow;
  575. text-align: left;
  576. }
  577. }
  578. }
  579. .panel-box {
  580. margin-top: 1.481vh;
  581. flex-grow: 1;
  582. .panel-title {
  583. width: 100%;
  584. line-height: @titleHeight;
  585. background-color: fade(@darkgray, 40%);
  586. .panel-title-name {
  587. font-size: 12px;
  588. color: @green;
  589. display: flex;
  590. flex-wrap: wrap;
  591. align-items: center;
  592. padding-left: 16px;
  593. i {
  594. margin-right: 0.7407vh;
  595. }
  596. .sub-title-item {
  597. display: flex;
  598. flex: 0 0 110px;
  599. .sub-title {
  600. flex: 0 0 auto;
  601. color: @gray;
  602. font-size: 12px;
  603. margin: 0 0.556vh 0 1.481vh;
  604. padding-top: 1px;
  605. }
  606. .sub-count {
  607. flex: 1 0 auto;
  608. font-size: 14px;
  609. font-family: "Bicubik";
  610. font-weight: 500;
  611. &.write {
  612. color: @write;
  613. }
  614. &.green {
  615. color: @green;
  616. }
  617. &.blue {
  618. color: @darkBlue;
  619. }
  620. &.pink {
  621. color: @pink;
  622. }
  623. &.red {
  624. color: @red;
  625. }
  626. &.orange {
  627. color: @orange;
  628. }
  629. &.gray {
  630. color: @gray;
  631. }
  632. }
  633. }
  634. }
  635. }
  636. .panel-body {
  637. height: calc(100% - 7.407vh);
  638. background-color: fade(@darkgray, 20%);
  639. padding: 4px 8px 8px 8px;
  640. margin-bottom: 8px;
  641. width: 100%;
  642. display: flex;
  643. flex-direction: row;
  644. flex-wrap: wrap;
  645. justify-content: space-between;
  646. .blank {
  647. margin-right: 4px;
  648. flex: 1 0 110px;
  649. }
  650. .card {
  651. cursor: pointer;
  652. margin-right: 4px;
  653. margin-top: 4px;
  654. flex: 1 0 110px;
  655. }
  656. .card {
  657. border: 0.093vh solid;
  658. .card-panel {
  659. display: flex;
  660. .card-left {
  661. width: 30%;
  662. border-right: 0.093vh dotted;
  663. .tag {
  664. color: @write;
  665. font-size: 14px;
  666. width: 100%;
  667. text-align: center;
  668. padding-top: 0.3704vh;
  669. }
  670. }
  671. .card-right {
  672. width: 70%;
  673. .num {
  674. width: 100%;
  675. font-size: 13px;
  676. text-align: right;
  677. padding-right: 0.3704vh;
  678. margin: 0.3704vh 0;
  679. }
  680. }
  681. }
  682. .card-percent {
  683. height: 8px;
  684. position: relative;
  685. border-top: 1px solid;
  686. background-color: transparent;
  687. display: flex;
  688. .split-item {
  689. flex: 1;
  690. border-right: 1px solid @black;
  691. z-index: 1;
  692. &:last-child {
  693. border: none;
  694. }
  695. }
  696. .percent {
  697. height: 5px;
  698. background-color: @yellow;
  699. position: absolute;
  700. left: 0.185vh;
  701. top: 0.093vh;
  702. }
  703. }
  704. &.blue {
  705. border-color: @darkBlue;
  706. background-color: fade(@darkBlue, 15%);
  707. .card-panel {
  708. .card-left {
  709. .tag {
  710. color: @darkBlue;
  711. }
  712. border-color: @darkBlue;
  713. }
  714. .card-right {
  715. .num {
  716. color: @darkBlue;
  717. }
  718. }
  719. }
  720. .card-percent {
  721. border-color: @darkBlue;
  722. }
  723. }
  724. &.pink {
  725. border-color: @pink;
  726. background-color: fade(@pink, 15%);
  727. .card-panel {
  728. .card-left {
  729. .tag {
  730. color: @pink;
  731. }
  732. border-color: @pink;
  733. }
  734. .card-right {
  735. .num {
  736. color: @pink;
  737. }
  738. }
  739. }
  740. .card-percent {
  741. border-color: @pink;
  742. }
  743. }
  744. &.orange {
  745. border-color: @orange;
  746. background-color: fade(@orange, 15%);
  747. .card-panel {
  748. .card-left {
  749. .tag {
  750. color: @orange;
  751. }
  752. border-color: @orange;
  753. }
  754. .card-right {
  755. .num {
  756. color: @orange;
  757. }
  758. }
  759. }
  760. .card-percent {
  761. border-color: @orange;
  762. }
  763. }
  764. &.green {
  765. border-color: @green;
  766. background-color: fade(@green, 15%);
  767. .card-panel {
  768. .card-left {
  769. .tag {
  770. color: @green;
  771. }
  772. border-color: @green;
  773. }
  774. .card-right {
  775. .num {
  776. color: @green;
  777. }
  778. }
  779. }
  780. .card-percent {
  781. border-color: @green;
  782. }
  783. }
  784. &.gray {
  785. border-color: @darkgray;
  786. background-color: fade(@darkgray, 15%);
  787. .card-panel {
  788. .card-left {
  789. .tag {
  790. color: @white;
  791. }
  792. border-color: @darkgray;
  793. }
  794. .card-right {
  795. .num {
  796. color: @gray;
  797. }
  798. }
  799. }
  800. .card-percent {
  801. border-color: @darkgray;
  802. }
  803. }
  804. &.red {
  805. border-color: @red;
  806. .card-panel {
  807. background-color: @red;
  808. .card-left {
  809. .tag {
  810. color: @white;
  811. }
  812. border-color: @darkRed;
  813. }
  814. .card-right {
  815. .num {
  816. color: @write;
  817. }
  818. }
  819. }
  820. .card-percent {
  821. border-color: @red;
  822. }
  823. }
  824. &.write {
  825. border-color: @write;
  826. .card-panel {
  827. background-color: @write;
  828. .card-left {
  829. .tag {
  830. color: @white;
  831. }
  832. border-color: @black;
  833. .tag {
  834. color: @black;
  835. }
  836. }
  837. .card-right {
  838. .num {
  839. color: @black;
  840. }
  841. }
  842. }
  843. .card-percent {
  844. border-color: @write;
  845. }
  846. }
  847. }
  848. }
  849. }
  850. .curStyle {
  851. cursor: pointer;
  852. }
  853. }
  854. </style>