Matrix.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. <template>
  2. <div class="matrix">
  3. <div class="btn-group-tabs">
  4. <BtnGroup2 :btnGroups="btnGroups" :rowIndex="rowIndex" :index="selectIndex" @select="select"></BtnGroup2>
  5. </div>
  6. <div class="panel-title">
  7. <div class="panel-title-name" v-if="sourceMap">
  8. <i class="fa fa-send"></i>
  9. <span>{{ sourceMap.fczbmap.jczbmap.name }}</span>
  10. <span class="sub-title">接入台数</span>
  11. <span class="sub-count">{{ sourceMap.fczbmap.jczbmap.jrts }}</span>
  12. </div>
  13. </div>
  14. <div class="panel-body">
  15. <div class="card" v-for="(cItem, cIndex) of sourceMap.fjmap[0]" :key="cIndex" :class="cItem.color" @click="jumpUrl(cItem.wpId,cItem.wtId)">
  16. <div class="card-panel">
  17. <div class="card-left">
  18. <div class="tag">{{ cItem.wtnum }}</div>
  19. <div class="icon">
  20. <span class="svg-icon svg-icon-sm" :class="cItem.color == 'black' ? 'svg-icon-black' : cItem.color == 'gray' ? 'svg-icon-gray' : 'svg-icon-write'">
  21. <SvgIcon :svgid="mapping[cItem.color]"></SvgIcon>
  22. </span>
  23. </div>
  24. </div>
  25. <div class="card-right">
  26. <div class="num">{{ cItem.fs }}
  27. <block v-if='cItem.wpId.indexOf("FDC") !== -1'>m/s</block>
  28. <block v-else>W/m²</block>
  29. </div>
  30. <div class="num" v-if='cItem.wpId.indexOf("FDC") == -1' style="height:0.25rem;"> </div>
  31. <div class="num">{{ cItem.gl }} kW</div>
  32. <div class="num" v-if='cItem.wpId.indexOf("FDC") !== -1'>{{ cItem.fdjzs }} rpm</div>
  33. </div>
  34. </div>
  35. <div class="card-percent">
  36. <div class="percent" :style="'width: ' + cItem.lyl + '%'"></div>
  37. </div>
  38. </div>
  39. <!-- 站位用 保证卡片布局最后一行不会有问题 -->
  40. <i class="blank" v-for="i in sourceMap.fjmap[0].length" :key="i"></i>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. import util from "@/helper/util.js";
  46. import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
  47. import SvgIcon from "@com/coms/icon/svg-icon.vue";
  48. export default {
  49. // 名称
  50. name: "Matrix",
  51. // 使用组件
  52. components: {
  53. BtnGroup2,
  54. SvgIcon,
  55. },
  56. data() {
  57. return {
  58. timmer: null, // 计时器
  59. wpId: "",
  60. selectIndex: 0,
  61. rowIndex: 0,
  62. mapping: {
  63. green: "svg-standby",
  64. blue: "svg-normal-power",
  65. pink: "svg-limit-power",
  66. red: "svg-gz-downtime",
  67. orange: "svg-jx-downtime",
  68. gray: "svg-offline",
  69. black: "svg-intranet-involvement",
  70. },
  71. sourceMap: {
  72. // 核心数据
  73. fczbmap: {
  74. jczbmap: {},
  75. },
  76. fjmap: [[]],
  77. },
  78. col: 15,
  79. datas: [
  80. {
  81. tag: "SG1",
  82. num1: "985.97 kw",
  83. num2: "985.97 kw",
  84. num3: "6.45 m/s",
  85. percent: 70,
  86. color: "blue",
  87. },
  88. ],
  89. btnGroups: [
  90. {
  91. icon: "fa fa-fire",
  92. btns: [],
  93. },
  94. {
  95. icon: "fa fa-fire-extinguisher",
  96. btns: [],
  97. },
  98. ],
  99. };
  100. },
  101. methods: {
  102. getColor(fjzt) {
  103. switch (fjzt) {
  104. case 0:
  105. return "green";
  106. break;
  107. case 1:
  108. return "blue";
  109. break;
  110. case 2:
  111. return "red";
  112. break;
  113. case 3:
  114. return "gray";
  115. break;
  116. case 4:
  117. return "orange";
  118. break;
  119. case 5:
  120. return "purple";
  121. break;
  122. case 6:
  123. return "write";
  124. break;
  125. }
  126. },
  127. // 请求服务
  128. requestData(showLoading) {
  129. let that = this;
  130. that.API.requestData({
  131. showLoading,
  132. method: "POST",
  133. subUrl: "matrix/matrixByWpIdPush",
  134. data: {
  135. wpId: that.wpId,
  136. },
  137. success(res) {
  138. if (res.data) {
  139. let sourceMap = res.data;
  140. for (let key in sourceMap) {
  141. if (key !== "fczbmap" && key !== "fjmap") {
  142. sourceMap[key] += "";
  143. } else if (key === "fjmap") {
  144. sourceMap[key].forEach((pItem) => {
  145. pItem.forEach((cItem) => {
  146. cItem.color = that.getColor(cItem.fjzt);
  147. cItem.isShow = true;
  148. });
  149. });
  150. }
  151. }
  152. that.sourceMap = sourceMap;
  153. } else {
  154. that.sourceMap = {};
  155. }
  156. },
  157. });
  158. },
  159. getWp() {
  160. let that = this;
  161. that.API.requestData({
  162. method: "GET",
  163. subUrl: "powercompare/windfarmAllAjax",
  164. success(res) {
  165. let btnGroups = [
  166. {
  167. icon: "fa fa-fire",
  168. btns: [],
  169. },
  170. {
  171. icon: "fa fa-fire-extinguisher",
  172. btns: [],
  173. },
  174. ];
  175. res.data.forEach((ele, index) => {
  176. if (ele.id.indexOf("FDC") !== -1) {
  177. btnGroups[0].btns.push({
  178. text: ele.name,
  179. code: ele.id,
  180. });
  181. } else {
  182. btnGroups[1].btns.push({
  183. text: ele.name,
  184. code: ele.id,
  185. });
  186. }
  187. });
  188. that.btnGroups = btnGroups;
  189. that.renderBtnActiveIndex();
  190. },
  191. });
  192. },
  193. renderBtnActiveIndex() {
  194. this.btnGroups.forEach((pEle, pIndex) => {
  195. pEle.btns.forEach((cEle, cIndex) => {
  196. if (cEle.code === this.wpId) {
  197. this.rowIndex = pIndex;
  198. this.selectIndex = cIndex;
  199. }
  200. });
  201. });
  202. },
  203. select(res) {
  204. this.$router.replace({
  205. path: `/monitor/windsite/matrix/${res.code}`,
  206. });
  207. },
  208. jumpUrl(wpId, wtId){
  209. if (wpId.indexOf("FDC") !== -1) {
  210. this.$router.push({
  211. path: `/monitor/windsite/info/${wpId}/${wtId}`
  212. });
  213. } else {
  214. this.$router.push({
  215. path: `../../windsite/inverter-info/${wpId}/${wtId}`
  216. });
  217. }
  218. },
  219. },
  220. created() {
  221. let that = this;
  222. that.wpId = that.$route.params.wpId;
  223. that.$nextTick(() => {
  224. that.requestData(false);
  225. that.getWp();
  226. that.timmer = setInterval(() => {
  227. that.requestData(false);
  228. }, that.$store.state.websocketTimeSec);
  229. });
  230. },
  231. mounted() {},
  232. unmounted() {
  233. clearInterval(this.timmer);
  234. this.timmer = null;
  235. },
  236. watch: {
  237. $route(res) {
  238. this.wpId = res.params.wpId;
  239. this.requestData(false);
  240. this.renderBtnActiveIndex();
  241. },
  242. },
  243. };
  244. </script>
  245. <style lang="less" scoped>
  246. @titleHeight: 3.704vh;
  247. .matrix {
  248. width: 100%;
  249. height: 100%;
  250. .btn-group-tabs {
  251. display: flex;
  252. flex-direction: row;
  253. .photovoltaic {
  254. margin-left: 1.481vh;
  255. }
  256. }
  257. .panel-title {
  258. width: 100%;
  259. height: @titleHeight;
  260. line-height: @titleHeight;
  261. background-color: fade(@darkgray, 40%);
  262. margin-top: 1.481vh;
  263. .panel-title-name {
  264. font-size: @fontsize-s;
  265. color: @green;
  266. i {
  267. margin: 0 0.556vh 0 1.481vh;
  268. }
  269. .sub-title {
  270. color: @gray;
  271. font-size: @fontsize-s;
  272. margin: 0 0.556vh 0 1.481vh;
  273. }
  274. .sub-count {
  275. font-size: @fontsize-s;
  276. color: @write;
  277. font-weight: 600;
  278. }
  279. }
  280. }
  281. .panel-body {
  282. height: calc(100% - 9vh);
  283. background-color: fade(@darkgray, 20%);
  284. padding: 0.741vh;
  285. overflow: auto;
  286. width: 100%;
  287. display: flex;
  288. flex-direction: row;
  289. flex-wrap: wrap;
  290. justify-content: space-between;
  291. align-content: flex-start;
  292. .blank {
  293. margin-right: 4px;
  294. flex: 1 0 125px;
  295. }
  296. .card {
  297. cursor: pointer;
  298. margin-right: 4px;
  299. margin-top: 4px;
  300. flex: 1 0 125px;
  301. }
  302. .card {
  303. border: 0.093vh solid;
  304. .card-panel {
  305. display: flex;
  306. flex-grow: row;
  307. .card-left {
  308. width: 40%;
  309. border-right: 0.093vh dotted;
  310. .tag {
  311. color: @write;
  312. font-size: 14px;
  313. width: 100%;
  314. text-align: center;
  315. }
  316. .icon {
  317. flex-grow: 1;
  318. height: calc(100% - 16px);
  319. display: flex;
  320. align-items: center;
  321. justify-content: center;
  322. i {
  323. font-size: 14px;
  324. }
  325. }
  326. }
  327. .card-right {
  328. width: 60%;
  329. .num {
  330. width: 100%;
  331. font-size: 13px;
  332. text-align: right;
  333. padding-right: 0.3704vh;
  334. margin: 0.1852vh 0;
  335. }
  336. }
  337. }
  338. .card-percent {
  339. height: 0.926vh;
  340. padding: 0.093vh 0.185vh;
  341. position: relative;
  342. border-top: 0.093vh solid;
  343. background-color: transparent;
  344. .percent {
  345. height: 0.648vh;
  346. background-color: @green;
  347. position: absolute;
  348. left: 0.185vh;
  349. top: 0.211vh;
  350. }
  351. }
  352. &.blue {
  353. border-color: @darkBlue;
  354. background-color: fade(@darkBlue, 15%);
  355. .card-panel {
  356. .card-left {
  357. border-color: @darkBlue;
  358. .tag {
  359. background-color: @darkBlue;
  360. }
  361. }
  362. .card-right {
  363. .num {
  364. color: @darkBlue;
  365. }
  366. }
  367. }
  368. .card-percent {
  369. border-color: @darkBlue;
  370. }
  371. }
  372. &.pink {
  373. border-color: @pink;
  374. background-color: fade(@pink, 15%);
  375. .card-panel {
  376. .card-left {
  377. border-color: @pink;
  378. .tag {
  379. background-color: @pink;
  380. }
  381. }
  382. .card-right {
  383. .num {
  384. color: @pink;
  385. }
  386. }
  387. }
  388. .card-percent {
  389. border-color: @pink;
  390. }
  391. }
  392. &.orange {
  393. border-color: @orange;
  394. background-color: fade(@orange, 15%);
  395. .card-panel {
  396. .card-left {
  397. border-color: @orange;
  398. .tag {
  399. background-color: @orange;
  400. }
  401. }
  402. .card-right {
  403. .num {
  404. color: @orange;
  405. }
  406. }
  407. }
  408. .card-percent {
  409. border-color: @orange;
  410. }
  411. }
  412. &.gray {
  413. border-color: @darkgray;
  414. background-color: fade(@darkgray, 15%);
  415. .card-panel {
  416. .card-left {
  417. border-color: @darkgray;
  418. .tag {
  419. background-color: @darkgray;
  420. }
  421. }
  422. .card-right {
  423. .num {
  424. color: @gray;
  425. }
  426. }
  427. }
  428. .card-percent {
  429. border-color: @darkgray;
  430. }
  431. }
  432. &.red {
  433. border-color: @red;
  434. .card-panel {
  435. background-color: @red;
  436. .card-left {
  437. border-color: @darkRed;
  438. .tag {
  439. background-color: @darkRed;
  440. }
  441. }
  442. .card-right {
  443. .num {
  444. color: @write;
  445. }
  446. }
  447. }
  448. .card-percent {
  449. border-color: @red;
  450. }
  451. }
  452. &.write {
  453. border-color: @write;
  454. .card-panel {
  455. background-color: @write;
  456. .card-left {
  457. border-color: @black;
  458. .tag {
  459. background-color: @darkgray;
  460. }
  461. }
  462. .card-right {
  463. .num {
  464. color: @black;
  465. }
  466. }
  467. }
  468. .card-percent {
  469. border-color: @write;
  470. }
  471. }
  472. }
  473. }
  474. }
  475. </style>