Inverter-Info.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. <template>
  2. <div class="Inverter-Info">
  3. <!-- <div class="btn-group-tabs">
  4. <BtnGroup2 :btnGroups="btnGroups" :rowIndex="0" :index="1" @select="select"></BtnGroup2>
  5. </div>-->
  6. <div class="box-main">
  7. <!-- <List class="list" :title="list.title" :list="list.datas" @select="selectList"></List> -->
  8. <div class="wind-site-menu">
  9. <div class="wind-site-title">选择逆变器</div>
  10. <div class="wind-site-body">
  11. <collapse-list
  12. :list="WindSites"
  13. :allowScroll="true"
  14. scrollHeight="calc(100vh - 175px)"
  15. @click="clickMenu"
  16. />
  17. </div>
  18. </div>
  19. <div class="Inverter-Info-body">
  20. <div class="Inverter-Info-title">
  21. <div class="title">{{info.name}}</div>
  22. <div class="title-tools-left">
  23. <div class="other">逆变器型号:{{info.modelid}}</div>
  24. <div class="state">
  25. 状态:
  26. <div class="dot" :class="stateColor"></div>
  27. </div>
  28. </div>
  29. <!-- <div class="title-tools">
  30. <div class="previous">上一页</div>
  31. <div class="next">上一页</div>
  32. <div class="return">返回</div>
  33. </div>-->
  34. </div>
  35. <div class="inverter-datas">
  36. <div class="inverter-item">
  37. <div class="inverter-item-info">
  38. <div class="form">
  39. <div>
  40. <table class="table-form mg-b-8" height="60%">
  41. <tr v-for="(aiarr) in aiData" :key="aiarr">
  42. <td class="text gray">{{aiarr[0].name}}</td>
  43. <td class="value green">{{aiarr[0].value}}</td>
  44. <td class="unit gray">{{aiarr[0].unit}}</td>
  45. <td class="text gray" v-if="aiarr.length>1">{{aiarr[1].name}}</td>
  46. <td class="value green" v-if="aiarr.length>1">{{aiarr[1].value}}</td>
  47. <td class="unit gray" v-if="aiarr.length>1">{{aiarr[1].unit}}</td>
  48. </tr>
  49. </table>
  50. </div>
  51. <div>
  52. <panel class="line-panel" :title="'开网频率'">
  53. <multiple-line-chart :list="lineValue" :units="['']" height="100%" />
  54. </panel>
  55. </div>
  56. </div>
  57. <div class="states">
  58. <div class="counts">
  59. <div class="all">
  60. <span class="text">全部状态</span>
  61. <span class="value">30</span>
  62. </div>
  63. <div class="error">
  64. <span class="text">报警状态</span>
  65. <span class="value">30</span>
  66. </div>
  67. </div>
  68. <div class="state-list">
  69. <el-scrollbar>
  70. <div class="list-body">
  71. <div v-for="item of diAll" :key="item" class="list-item">
  72. <div class="text">{{item.name}}</div>
  73. <div class="state">
  74. <div :class="{ red: item.value == 1, green: item.value != 1 }"></div>
  75. </div>
  76. </div>
  77. </div>
  78. </el-scrollbar>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. // import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
  90. import List from "@com/coms/list/list.vue";
  91. import Panel from "../../../components/coms/panel/panel.vue";
  92. import MultipleLineChart from "../../../components/chart/line/multiple-line-chart.vue";
  93. import collapseList from "@/components/coms/collapse/collapse-list.vue";
  94. export default {
  95. // 名称
  96. name: "Box",
  97. // 使用组件
  98. components: {
  99. // BtnGroup2,
  100. List,
  101. Panel,
  102. MultipleLineChart,
  103. collapseList
  104. },
  105. // 数据
  106. data() {
  107. return {
  108. timmer: null,
  109. timmer1: null,
  110. WindSites: [],
  111. diAll: [],
  112. diOn: [],
  113. info: {},
  114. stateColor: "blue",
  115. list: {
  116. title: "逆变器列表",
  117. datas: [
  118. {
  119. text: "1#逆变室",
  120. color: "blue"
  121. }
  122. ]
  123. },
  124. wtId: "PL01_01",
  125. aiData: [],
  126. lineValue: [
  127. {
  128. title: "功率",
  129. value: [
  130. {
  131. text: "00:00",
  132. value: 0
  133. }
  134. ]
  135. }
  136. ]
  137. };
  138. },
  139. // 函数
  140. methods: {
  141. selectList: function(item) {
  142. console.log(item);
  143. },
  144. select: function(item) {
  145. console.log(item);
  146. },
  147. onReturn: function() {
  148. console.log("return");
  149. },
  150. // 点击左侧菜单
  151. clickMenu(res) {
  152. // console.log(res);
  153. this.wpId = res.wpId;
  154. this.wtId = res.wtId;
  155. this.$router.replace(`/monitor/windsite/inverter-info/${res.wpId}/${res.wtId}`);
  156. this.getData();
  157. this.getLineChart();
  158. },
  159. async buildSelectList() {
  160. let res = await this.API.requestData({
  161. method: "POST",
  162. // baseURL: "http://localhost:8082/",
  163. subUrl: "matrix/findPVSimpleMatrixAll"
  164. });
  165. let WindSites = [];
  166. res.data.data.forEach((ele, index) => {
  167. ele.inverterls.forEach(function(inver) {
  168. // inver["text"] = inver["wtnum"];
  169. inver["text"] = inver["wtnum"];
  170. inver["color"] = "blue";
  171. inver["id"] = inver["wtId"];
  172. });
  173. WindSites.push({
  174. id: String(index),
  175. text: ele.wpName,
  176. children: ele.inverterls
  177. });
  178. });
  179. this.WindSites = WindSites;
  180. },
  181. async getData() {
  182. let res = await this.API.requestData({
  183. method: "POST",
  184. // baseURL: "http://localhost:8082/",
  185. subUrl: "monitorinverter/findInverterInfo",
  186. data: {
  187. wtId: this.wtId
  188. }
  189. });
  190. const aiData = [];
  191. if (res.data.data.listAI) {
  192. const arr = res.data.data.listAI;
  193. for (let index = 0; index < arr.length; index = index + 2) {
  194. const elem1 = arr[index];
  195. const elem2 = arr[index + 1];
  196. aiData.push([elem1, elem2]);
  197. }
  198. if (arr.length % 2 == 1) {
  199. aiData.push([arr[arr.length - 1]]);
  200. }
  201. }
  202. this.aiData = aiData;
  203. // di
  204. if (res.data.data.listDI) {
  205. this.diAll = res.data.data.listDI.allList;
  206. this.diOn = res.data.data.listDI.onList;
  207. }
  208. this.info = res.data.data.info;
  209. },
  210. async getLineChart() {
  211. let res = await this.API.requestData({
  212. method: "POST",
  213. // baseURL: "http://localhost:8082/",
  214. subUrl: "monitorinverter/findInverterPowerLine",
  215. data: {
  216. wtId: this.wtId
  217. }
  218. });
  219. let date = new Date();
  220. date.setHours(0);
  221. date.setMinutes(0);
  222. let timt = date.getTime();
  223. const result = [];
  224. for (let i = 0; i <= 48; i++) {
  225. date.setMinutes(i * 30);
  226. result.push({
  227. text: new Date(timt + i * 1000 * 60 * 30).formatDate("hh:mm"),
  228. value: res.data.data[i]
  229. });
  230. }
  231. this.lineValue = [
  232. {
  233. title: "功率",
  234. value: result
  235. }
  236. ];
  237. },
  238. async getTurbinesState() {
  239. let that = this;
  240. let res = await this.API.requestData({
  241. method: "POST",
  242. subUrl: "matrix/matrixDetialGfPush"
  243. });
  244. const ztmap = {};
  245. if (res && res.data && res.data.data && res.data.data.fjmap) {
  246. res.data.data.fjmap.forEach(function(fcList) {
  247. fcList.forEach(function(fjItem) {
  248. ztmap[fjItem["wtId"]] = fjItem["fjzt"];
  249. });
  250. });
  251. }
  252. that.stateColor = that.getColor(ztmap[that.wtId]);
  253. if (this.WindSites) {
  254. this.WindSites.forEach(function(ws) {
  255. if (ws.children) {
  256. ws.children.forEach(function(fj) {
  257. fj["color"] = that.getColor(ztmap[fj.wtId]);
  258. });
  259. }
  260. });
  261. }
  262. },
  263. getColor(fjzt) {
  264. switch (fjzt) {
  265. case 0:
  266. return "green";
  267. break;
  268. case 1:
  269. return "blue";
  270. break;
  271. case 2:
  272. return "red";
  273. break;
  274. case 3:
  275. return "gray";
  276. break;
  277. case 4:
  278. return "orange";
  279. break;
  280. case 5:
  281. return "purple";
  282. break;
  283. case 6:
  284. return "write";
  285. break;
  286. }
  287. }
  288. },
  289. // 生命周期钩子
  290. beforeCreate() {
  291. // 创建前
  292. },
  293. created() {
  294. // debugger;
  295. let that = this;
  296. this.wtId = that.$route.params.wtId;
  297. this.buildSelectList();
  298. this.getTurbinesState();
  299. this.getData();
  300. // this.getDIData();
  301. this.getLineChart();
  302. that.timmer = setInterval(() => {
  303. that.getData();
  304. // that.getDIData();
  305. that.getTurbinesState();
  306. }, 2000);
  307. that.timmer1 = setInterval(() => {
  308. that.getLineChart();
  309. }, 60 * 1000);
  310. },
  311. beforeMount() {
  312. // 渲染前
  313. },
  314. mounted() {
  315. // 渲染后
  316. },
  317. beforeUpdate() {
  318. // 数据更新前
  319. },
  320. updated() {
  321. // 数据更新后
  322. },
  323. unmounted() {
  324. clearInterval(this.timmer);
  325. this.timmer = null;
  326. clearInterval(this.timmer1);
  327. this.timmer1 = null;
  328. }
  329. };
  330. </script>
  331. <style lang="less">
  332. .state-green {
  333. width: 0.741vh;
  334. height: 0.741vh;
  335. background-color: @green;
  336. }
  337. .Inverter-Info {
  338. width: 100%;
  339. height: auto;
  340. .box-main {
  341. width: 100%;
  342. height: calc(100vh - 12.963vh);
  343. display: flex;
  344. flex-direction: row;
  345. margin-top: 1.481vh;
  346. .wind-site-menu {
  347. flex: 0 0 15vh;
  348. color: @gray;
  349. background: fade(@darkgray, 10);
  350. height: calc(100vh - 122px);
  351. .wind-site-title {
  352. font-size: 14px;
  353. font-weight: 600;
  354. padding: 16px;
  355. }
  356. }
  357. .wind-site-info-body {
  358. flex: auto;
  359. padding-left: 1.481vh;
  360. .info-menu {
  361. .info-menu-item {
  362. display: inline-block;
  363. border: 1px solid fade(@darkgray, 80);
  364. border-radius: 2px;
  365. color: @gray;
  366. font-size: @fontsize-s;
  367. letter-spacing: 1px;
  368. cursor: pointer;
  369. width: 85px;
  370. height: 30px;
  371. line-height: 30px;
  372. text-align: center;
  373. &.active {
  374. color: @white;
  375. background: fade(@purple, 60);
  376. border-color: fade(@purple, 60);
  377. }
  378. & + .info-menu-item {
  379. margin-left: 0.741vh;
  380. }
  381. }
  382. }
  383. }
  384. .list {
  385. margin-right: 1.481vh;
  386. flex: 0 0 auto;
  387. }
  388. .Inverter-Info-body {
  389. flex: 1 0 auto;
  390. .Inverter-Info-title {
  391. position: relative;
  392. background: fade(@darkgray, 40);
  393. padding: 16px 20px;
  394. .title {
  395. font-size: @fontsize;
  396. color: @green;
  397. }
  398. .title-tools {
  399. position: absolute;
  400. top: 0;
  401. right: 0;
  402. display: flex;
  403. color: @gray-l;
  404. & > div {
  405. padding: 16px;
  406. }
  407. .return {
  408. padding-left: 40px;
  409. }
  410. }
  411. .title-tools-left {
  412. position: absolute;
  413. top: 0;
  414. left: 150px;
  415. // margin-left: 10px;
  416. display: flex;
  417. color: @gray-l;
  418. & > div {
  419. padding: 16px;
  420. }
  421. .return {
  422. padding-left: 40px;
  423. }
  424. .state {
  425. display: flex;
  426. align-items: center;
  427. .dot {
  428. width: 8px;
  429. height: 8px;
  430. &.green {
  431. background: @green;
  432. }
  433. &.yellow {
  434. background: @yellow;
  435. }
  436. &.orange {
  437. background: @orange;
  438. }
  439. &.red {
  440. background: @red;
  441. }
  442. &.blue {
  443. background: @blue;
  444. }
  445. }
  446. }
  447. }
  448. }
  449. .inverter-datas {
  450. display: flex;
  451. height: calc(100% - 53px);
  452. .inverter-item {
  453. flex: 0 0 calc(100% - 4px);
  454. margin: 8px 0;
  455. .inverter-item-header {
  456. color: @gray-l;
  457. background: fade(@gray, 40);
  458. display: flex;
  459. height: 37px;
  460. line-height: 37px;
  461. padding: 0 16px;
  462. .name {
  463. flex: 1 0 auto;
  464. }
  465. .other {
  466. margin-right: 32px;
  467. }
  468. .state {
  469. display: flex;
  470. align-items: center;
  471. .dot {
  472. width: 8px;
  473. height: 8px;
  474. &.green {
  475. background: @green;
  476. }
  477. &.yellow {
  478. background: @yellow;
  479. }
  480. &.orange {
  481. background: @orange;
  482. }
  483. &.red {
  484. background: @red;
  485. }
  486. }
  487. }
  488. }
  489. .inverter-item-info {
  490. display: flex;
  491. margin-top: 8px;
  492. height: calc(100%);
  493. .form {
  494. // flex: 0 0 calc(50% -4px);
  495. flex-basis: 60%;
  496. position: relative;
  497. display: flex;
  498. flex-flow: column;
  499. // & > div{
  500. // flex-basis: 40%;
  501. // }
  502. .table-form {
  503. outline: 1px solid fade(@gray, 40);
  504. tr td.text {
  505. text-align: left;
  506. line-height: 37px;
  507. padding: 0;
  508. padding-left: 32px;
  509. }
  510. }
  511. .line-panel {
  512. position: absolute;
  513. bottom: 0;
  514. width: 100%;
  515. .panel-body {
  516. height: 216px;
  517. }
  518. }
  519. }
  520. .states {
  521. // flex: 0 0 calc(50% -4px);
  522. flex-basis: 40%;
  523. margin-left: 8px;
  524. .counts {
  525. display: flex;
  526. & > div {
  527. flex: 0 0 calc(50% - 4px);
  528. height: 37px;
  529. line-height: 37px;
  530. text-align: center;
  531. display: flex;
  532. justify-content: space-evenly;
  533. font-size: 12px;
  534. .value {
  535. font-family: @font-family-num;
  536. font-size: 16px;
  537. }
  538. }
  539. .all {
  540. background: fade(@gray, 40);
  541. }
  542. .error {
  543. background: @red;
  544. margin-left: 8px;
  545. }
  546. }
  547. .state-list {
  548. outline: 1px solid fade(@gray, 40);
  549. margin-top: 8px;
  550. height: calc(100% - 42px);
  551. .list-item {
  552. display: flex;
  553. line-height: 37px;
  554. padding: 0 16px;
  555. color: @gray;
  556. background: fade(@gray, 20);
  557. font-size: @fontsize-s;
  558. align-items: center;
  559. &:nth-child(2n) {
  560. background: transparent;
  561. }
  562. .text {
  563. flex: 1 0 auto;
  564. }
  565. .state {
  566. width: 22px;
  567. height: 22px;
  568. margin-right: 16px;
  569. background: #010b0a;
  570. border-radius: 50%;
  571. display: flex;
  572. align-items: center;
  573. justify-content: center;
  574. & > div {
  575. width: 14px;
  576. height: 14px;
  577. border-radius: 50%;
  578. &.green {
  579. background: @green;
  580. }
  581. &.red {
  582. background: @red;
  583. }
  584. }
  585. }
  586. }
  587. }
  588. }
  589. }
  590. & + .inverter-item {
  591. margin-left: 8px;
  592. }
  593. }
  594. .chart {
  595. width: 100%;
  596. height: 100%;
  597. display: inline-block;
  598. }
  599. }
  600. }
  601. }
  602. }
  603. </style>