LightMatrix2.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  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>{{ data.num }}</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">{{ data.num2 }}</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="(table, k) of tables" :key="k">
  36. <div class="panel-title">
  37. <div class="panel-title-name">
  38. <i class="fa fa-send"></i>
  39. <span>某某某风电场</span>
  40. <div class="sub-title-item" v-for="(data, index) of table.subTitleDatas" :key="index">
  41. <span class="sub-title">{{ data.text }}</span>
  42. <span class="sub-count" :class="data.color">{{ data.num }}</span>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="panel-body">
  47. <table>
  48. <tbody>
  49. <tr v-for="(row, i) of table.groupDatas" :key="i">
  50. <td v-for="(col, j) of row" :key="j">
  51. <div class="card" :class="col.color">
  52. <div class="card-panel">
  53. <div class="card-left">
  54. <div class="tag">{{ col.tag }}</div>
  55. </div>
  56. <div class="card-right">
  57. <div class="num">{{ col.num1 }}</div>
  58. <div class="num">{{ col.num2 }}</div>
  59. </div>
  60. </div>
  61. <div class="card-percent">
  62. <div class="split-item"></div>
  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="percent" :style="'width: ' + col.percent + '%'"></div>
  68. </div>
  69. </div>
  70. </td>
  71. </tr>
  72. </tbody>
  73. </table>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. import Row from "@/components/coms/grid/row.vue";
  81. import Col from "@/components/coms/grid/col.vue";
  82. import util from "@/helper/util.js";
  83. export default {
  84. // 名称
  85. name: "LightMatrix2",
  86. // 使用组件
  87. components: {
  88. Row,
  89. Col,
  90. },
  91. // 数据
  92. data() {
  93. return {
  94. panel1Data: {
  95. first: {
  96. icon: "fa fa-user",
  97. },
  98. datas: [
  99. {
  100. color: "write",
  101. test: "接入风机",
  102. num: 256,
  103. },
  104. {
  105. color: "blue",
  106. test: "· 运行",
  107. num: 256,
  108. },
  109. {
  110. color: "green",
  111. test: "· 待机",
  112. num: 256,
  113. },
  114. {
  115. color: "pink",
  116. test: "· 限电",
  117. num: 256,
  118. },
  119. {
  120. color: "red",
  121. test: "· 故障",
  122. num: 256,
  123. },
  124. {
  125. color: "orange",
  126. test: "· 检修",
  127. num: 256,
  128. },
  129. {
  130. color: "write",
  131. test: "· 受累",
  132. num: 256,
  133. },
  134. {
  135. color: "gray",
  136. test: "· 离线",
  137. num: 256,
  138. },
  139. ],
  140. },
  141. panel2Data: {
  142. datas: [
  143. {
  144. test: "欠发电量",
  145. num1: 5,
  146. num2: 7.34,
  147. num3: "0%~5%",
  148. },
  149. {
  150. test: "欠发电量",
  151. num1: 4,
  152. num2: 7.34,
  153. num3: "5%~10%",
  154. },
  155. {
  156. test: "欠发电量",
  157. num1: 3,
  158. num2: 7.34,
  159. num3: "10%~20%",
  160. },
  161. {
  162. test: "欠发电量",
  163. num1: 2,
  164. num2: 7.34,
  165. num3: "20%~40%",
  166. },
  167. {
  168. test: "欠发电量",
  169. num1: 1,
  170. num2: 7.34,
  171. num3: ">40%",
  172. },
  173. ],
  174. },
  175. tables: [
  176. {
  177. col: 15,
  178. subTitleDatas: [
  179. {
  180. text: "接入台数",
  181. num: 256,
  182. color: "write",
  183. },
  184. {
  185. text: "待机台数",
  186. num: 256,
  187. color: "green",
  188. },
  189. {
  190. text: "并网台数",
  191. num: 256,
  192. color: "blue",
  193. },
  194. {
  195. text: "限电台数",
  196. num: 256,
  197. color: "pink",
  198. },
  199. {
  200. text: "故障台数",
  201. num: 256,
  202. color: "red",
  203. },
  204. {
  205. text: "检修台数",
  206. num: 256,
  207. color: "orange",
  208. },
  209. {
  210. text: "受累台数",
  211. num: 256,
  212. color: "write",
  213. },
  214. {
  215. text: "离线台数",
  216. num: 256,
  217. color: "gray",
  218. },
  219. {
  220. text: "风速",
  221. num: 256,
  222. color: "gray",
  223. },
  224. {
  225. text: "预测功率",
  226. num: 256,
  227. color: "gray",
  228. },
  229. {
  230. text: "保证功率",
  231. num: 256,
  232. color: "gray",
  233. },
  234. {
  235. text: "应发功率",
  236. num: 256,
  237. color: "gray",
  238. },
  239. {
  240. text: "实际功率",
  241. num: 256,
  242. color: "gray",
  243. },
  244. {
  245. text: "AGC指令",
  246. num: 256,
  247. color: "gray",
  248. },
  249. {
  250. text: "出线功率",
  251. num: 256,
  252. color: "gray",
  253. },
  254. ],
  255. datas: [
  256. {
  257. tag: "01",
  258. num1: "985.97 kw",
  259. num2: "6.45 m/s",
  260. percent: 70,
  261. color: "blue",
  262. },
  263. ],
  264. groupDatas: [],
  265. },
  266. ],
  267. };
  268. },
  269. // 函数
  270. methods: {
  271. createGroupDatas: function(table) {
  272. table.groupDatas = [];
  273. let tempDatas = [];
  274. table.datas.forEach((data, index) => {
  275. if (index % table.col == 0) {
  276. if (tempDatas.length > 0) {
  277. table.groupDatas.push(util.copy(tempDatas));
  278. tempDatas = [];
  279. }
  280. }
  281. tempDatas.push(util.copy(data));
  282. });
  283. if (tempDatas.length > 0) {
  284. table.groupDatas.push(util.copy(tempDatas));
  285. tempDatas = [];
  286. }
  287. },
  288. },
  289. // 生命周期钩子
  290. beforeCreate() {
  291. // 创建前
  292. },
  293. created() {
  294. // 创建后
  295. let tempData = [];
  296. for (let i = 0; i < 45; i++) {
  297. tempData.push(util.copy(this.tables[0].datas[0]));
  298. if (i == 39) {
  299. tempData[i].color = "green";
  300. }
  301. if (i == 40) {
  302. tempData[i].color = "pink";
  303. }
  304. if (i == 41) {
  305. tempData[i].color = "orange";
  306. }
  307. if (i == 42) {
  308. tempData[i].color = "red";
  309. }
  310. if (i == 43) {
  311. tempData[i].color = "write";
  312. }
  313. if (i == 44) {
  314. tempData[i].color = "gray";
  315. }
  316. }
  317. this.tables[0].datas = util.copy(tempData);
  318. this.createGroupDatas(this.tables[0]);
  319. for (let i = 0; i < 5; i++) {
  320. this.tables.push(util.copy(this.tables[0]));
  321. }
  322. },
  323. beforeMount() {
  324. // 渲染前
  325. },
  326. mounted() {
  327. // 渲染后
  328. },
  329. beforeUpdate() {
  330. // 数据更新前
  331. },
  332. updated() {
  333. // 数据更新后
  334. },
  335. };
  336. </script>
  337. <style lang="less" scoped>
  338. @panelHeight: 6.481vh;
  339. @titleHeight: 3.704vh;
  340. .light-matrix {
  341. width: calc(100% - 1.111vh);
  342. height: calc(100vh - 7.222vh);
  343. display: flex;
  344. flex-direction: column;
  345. .panel-2 {
  346. .left-50-16 {
  347. width: calc(50% - 0.741vh);
  348. }
  349. }
  350. .panel {
  351. width: 100%;
  352. border: 0.093vh solid @darkgray;
  353. position: relative;
  354. padding: 1.111vh 2.222vh;
  355. background-color: fade(@darkgray, 20%);
  356. display: flex;
  357. height: 6.944vh;
  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. i {
  385. color: @gray;
  386. font-size: 2.778vh;
  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: 1.481vh;
  459. flex-grow: 1;
  460. overflow: auto;
  461. .panel-title {
  462. width: 100%;
  463. height: @titleHeight;
  464. line-height: @titleHeight;
  465. background-color: fade(@darkgray, 40%);
  466. .panel-title-name {
  467. font-size: @fontsize-s;
  468. color: @green;
  469. display: flex;
  470. align-items: center;
  471. i {
  472. margin: 0 0.556vh 0 1.481vh;
  473. }
  474. .sub-title-item {
  475. .sub-title {
  476. color: @gray;
  477. font-size: @fontsize-s;
  478. margin: 0 0.556vh 0 1.481vh;
  479. }
  480. .sub-count {
  481. font-size: @fontsize-s;
  482. font-family: "Bicubik";
  483. font-weight: 500;
  484. &.write {
  485. color: @write;
  486. }
  487. &.green {
  488. color: @green;
  489. }
  490. &.blue {
  491. color: @blue;
  492. }
  493. &.pink {
  494. color: @pink;
  495. }
  496. &.red {
  497. color: @red;
  498. }
  499. &.orange {
  500. color: @orange;
  501. }
  502. &.gray {
  503. color: @gray;
  504. }
  505. }
  506. }
  507. }
  508. }
  509. .panel-body {
  510. height: calc(100% - 7.407vh);
  511. background-color: fade(@darkgray, 20%);
  512. padding: 0.741vh;
  513. overflow: auto;
  514. margin-bottom: 1.481vh;
  515. table {
  516. width: 100%;
  517. .card {
  518. border: 0.093vh solid;
  519. .card-panel {
  520. display: flex;
  521. flex-grow: row;
  522. .card-left {
  523. width: 40%;
  524. border-right: 0.093vh dotted;
  525. .tag {
  526. color: @write;
  527. font-size: 14px;
  528. width: 100%;
  529. text-align: center;
  530. }
  531. }
  532. .card-right {
  533. width: 60%;
  534. .num {
  535. width: 100%;
  536. font-size: 13px;
  537. text-align: right;
  538. padding-right: 0.278vh;
  539. }
  540. }
  541. }
  542. .card-percent {
  543. height: 0.926vh;
  544. padding: 0.093vh 0.185vh;
  545. position: relative;
  546. border-top: 0.093vh solid;
  547. background-color: transparent;
  548. display: flex;
  549. .split-item {
  550. flex: 1;
  551. border-right: 0.093vh solid @black;
  552. z-index: 1;
  553. &:last-child {
  554. border: none;
  555. }
  556. }
  557. .percent {
  558. height: 0.648vh;
  559. background-color: @yellow;
  560. position: absolute;
  561. left: 0.185vh;
  562. top: 0.093vh;
  563. }
  564. }
  565. &.blue {
  566. border-color: @darkBlue;
  567. background-color: fade(@darkBlue, 30%);
  568. .card-panel {
  569. .card-left {
  570. border-color: @darkBlue;
  571. }
  572. .card-right {
  573. .num {
  574. color: @darkBlue;
  575. }
  576. }
  577. }
  578. .card-percent {
  579. border-color: @darkBlue;
  580. }
  581. }
  582. &.pink {
  583. border-color: @pink;
  584. background-color: fade(@pink, 30%);
  585. .card-panel {
  586. .card-left {
  587. border-color: @pink;
  588. }
  589. .card-right {
  590. .num {
  591. color: @pink;
  592. }
  593. }
  594. }
  595. .card-percent {
  596. border-color: @pink;
  597. }
  598. }
  599. &.orange {
  600. border-color: @orange;
  601. background-color: fade(@orange, 30%);
  602. .card-panel {
  603. .card-left {
  604. border-color: @orange;
  605. }
  606. .card-right {
  607. .num {
  608. color: @orange;
  609. }
  610. }
  611. }
  612. .card-percent {
  613. border-color: @orange;
  614. }
  615. }
  616. &.green {
  617. border-color: @green;
  618. background-color: fade(@green, 30%);
  619. .card-panel {
  620. .card-left {
  621. border-color: @green;
  622. }
  623. .card-right {
  624. .num {
  625. color: @green;
  626. }
  627. }
  628. }
  629. .card-percent {
  630. border-color: @green;
  631. }
  632. }
  633. &.gray {
  634. border-color: @darkgray;
  635. background-color: fade(@darkgray, 30%);
  636. .card-panel {
  637. .card-left {
  638. border-color: @darkgray;
  639. }
  640. .card-right {
  641. .num {
  642. color: @gray;
  643. }
  644. }
  645. }
  646. .card-percent {
  647. border-color: @darkgray;
  648. }
  649. }
  650. &.red {
  651. border-color: @red;
  652. .card-panel {
  653. background-color: @red;
  654. .card-left {
  655. border-color: @darkRed;
  656. }
  657. .card-right {
  658. .num {
  659. color: @write;
  660. }
  661. }
  662. }
  663. .card-percent {
  664. border-color: @red;
  665. }
  666. }
  667. &.write {
  668. border-color: @write;
  669. .card-panel {
  670. background-color: @write;
  671. .card-left {
  672. border-color: @black;
  673. .tag {
  674. color: @black;
  675. }
  676. }
  677. .card-right {
  678. .num {
  679. color: @black;
  680. }
  681. }
  682. }
  683. .card-percent {
  684. border-color: @write;
  685. }
  686. }
  687. }
  688. }
  689. }
  690. }
  691. }
  692. </style>