controlAllArea.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102
  1. <template>
  2. <div class="problem" @contextmenu="contextmenu">
  3. <div class="body">
  4. <img class="logo" src="../../assets/img/logo.png" alt="" />
  5. <div class="titleBar">
  6. <div class="title" @click="parametersContrast()">设备区</div>
  7. <el-select
  8. @change="listedChange()"
  9. class="inputs"
  10. v-model="selectValue"
  11. placeholder="请选择"
  12. >
  13. <el-option
  14. v-for="item in options"
  15. :key="item.value"
  16. :label="item.label"
  17. :value="item.value"
  18. >
  19. </el-option>
  20. </el-select>
  21. </div>
  22. <div
  23. class="content"
  24. style="
  25. margin-top: 20px;
  26. margin-left: 35px;
  27. height: 85%;
  28. overflow-y: auto;
  29. "
  30. >
  31. <!-- <el-scrollbar>
  32. <div class="scoll"> -->
  33. <div class="matrix" v-if="showList.length > 0">
  34. <box-select node=".box" @selectList="selectList">
  35. <!-- v-if="showWh(showList[0])" -->
  36. <MatrixBlock
  37. @choose-click="handleClick"
  38. @on-click="handleDetails"
  39. :dataList="showList"
  40. >
  41. </MatrixBlock>
  42. <!-- <MatrixBlockPv
  43. v-else
  44. @on-click="handleDetialPv"
  45. :dataList="showList"
  46. >
  47. </MatrixBlockPv> -->
  48. </box-select>
  49. </div>
  50. <!-- </div>
  51. </el-scrollbar> -->
  52. </div>
  53. </div>
  54. <WindturbineDetailPages
  55. v-model="dialogVisible"
  56. :showSvg="showSvg"
  57. @close="handleClose"
  58. :windturbine="currentWindturbine"
  59. ></WindturbineDetailPages>
  60. <PvDetailPages
  61. v-model="dialogPvDia"
  62. @close="handleClose"
  63. :windturbine="currentWindturbinePv"
  64. >
  65. </PvDetailPages>
  66. <ParametersContrast
  67. :chooseList="chooseList"
  68. v-model="parametersDisplay"
  69. ></ParametersContrast>
  70. </div>
  71. </template>
  72. <script>
  73. import WindturbineDetailPages from "../WindturbineDetailPages.vue";
  74. import PvDetailPages from "components/PvDetailPages.vue";
  75. import MatrixBlock from "../matrixBlock.vue";
  76. import MatrixBlockPv from "../matrixBlockPv.vue";
  77. import EaxyMatrxBlock from "../eaxyMatrixBlock.vue";
  78. import BackgroundData from "utils/BackgroundData";
  79. import api from "api/index";
  80. import boxSelect from "components/boxSelect.vue";
  81. import ParametersContrast from "./parametersContrast.vue";
  82. import MessageBridge from "utils/MessageBridge";
  83. import dataJson from "./controlJson.json";
  84. export default {
  85. name: "ProblemArea",
  86. components: {
  87. WindturbineDetailPages,
  88. PvDetailPages,
  89. MatrixBlock,
  90. MatrixBlockPv,
  91. boxSelect,
  92. ParametersContrast,
  93. EaxyMatrxBlock,
  94. },
  95. props: {
  96. current: {
  97. type: Number,
  98. },
  99. datas: {
  100. type: String,
  101. },
  102. },
  103. data() {
  104. return {
  105. allNames: [],
  106. allList: {},
  107. dataList: [],
  108. showList: [],
  109. chooseList: [],
  110. lockValues: [],
  111. currentWindturbine: {},
  112. currentWindturbinePv: {},
  113. dialogVisible: false,
  114. dialogPvDia: false,
  115. showSvg: false,
  116. parametersDisplay: false,
  117. windturbinelist: {},
  118. options: [
  119. {
  120. value: "0",
  121. label: "问题设备",
  122. },
  123. {
  124. value: "1",
  125. label: "故障",
  126. },
  127. {
  128. value: "2",
  129. label: "维护",
  130. },
  131. {
  132. value: "3",
  133. label: "离线",
  134. },
  135. {
  136. value: "4",
  137. label: "挂牌",
  138. },
  139. ],
  140. selectValue: "0",
  141. intervals: null,
  142. controlErorCodes: [
  143. "控制成功",
  144. "控制命令发送失败",
  145. "无效的控制地址",
  146. "被控设备异常",
  147. "无效的控制功能",
  148. "网络连接错误,检查场站通信",
  149. "控制结果读取超时",
  150. "未知错误",
  151. "控制命令错误",
  152. "收到无法识别数据",
  153. "未读取到数据包",
  154. "未知错误",
  155. "风机操作过频繁",
  156. "风机被挂牌",
  157. "风机操作与风机状态不符",
  158. "需要登录",
  159. ],
  160. };
  161. },
  162. computed: {},
  163. created: function () {
  164. // this.initData();
  165. // this.handleWindturbineChange();
  166. // this.controls();
  167. // this.getLocks();
  168. // this.intervals = setInterval(() =>{
  169. // this.handleWindturbineChange
  170. // }, 3000);
  171. },
  172. mounted() {
  173. this.$nextTick(() => {
  174. this.showList = dataJson.showList;
  175. });
  176. },
  177. methods: {
  178. showWh(item) {
  179. let show = false;
  180. if (item.stationId) {
  181. show = true;
  182. }
  183. return show;
  184. },
  185. selectList(val) {
  186. val.forEach((item) => {
  187. this.handleClick(this.windturbinelist[item.id]);
  188. });
  189. },
  190. controls() {
  191. this.options = [
  192. {
  193. value: "0",
  194. label: "问题设备",
  195. },
  196. {
  197. value: "1",
  198. label: "故障",
  199. },
  200. {
  201. value: "2",
  202. label: "维护",
  203. },
  204. {
  205. value: "3",
  206. label: "离线",
  207. },
  208. {
  209. value: "4",
  210. label: "挂牌",
  211. },
  212. ];
  213. let stationList = this.$store.state.stationList;
  214. stationList.forEach((item, index) => {
  215. if (item.id.indexOf("FDC") != -1 || item.id.indexOf("GDC") != -1) {
  216. let obj = {};
  217. obj.value = String(index + 6);
  218. obj.label = item.name;
  219. obj.stationId = item.code || item.id;
  220. this.options.push(obj);
  221. }
  222. });
  223. // let json = this.$store.state.windturbinelist;
  224. let wswind = JSON.parse(window.sessionStorage.getItem("windSbq"));
  225. let pv = JSON.parse(window.sessionStorage.getItem("pvSbq"));
  226. let json = {};
  227. if (wswind && pv) {
  228. json = { ...wswind, ...pv };
  229. this.dataList = [];
  230. const showList = [];
  231. let arr = Object.keys(json).sort();
  232. for (let id of arr) {
  233. let val = json[id];
  234. this.chooseList.forEach((item) => {
  235. if (item.windturbineId === val.windturbineId) {
  236. val.active = true;
  237. }
  238. });
  239. this.dataList.push(val);
  240. switch (Number(this.selectValue)) {
  241. case 0:
  242. if (
  243. val.status === 5 ||
  244. val.status === 6 ||
  245. val.status === 7 ||
  246. val.lockValue > 0
  247. ) {
  248. showList.push(val);
  249. }
  250. break;
  251. case 1:
  252. val.status === 5 ? showList.push(val) : "";
  253. break;
  254. case 2:
  255. val.status === 6 ? showList.push(val) : "";
  256. break;
  257. case 3:
  258. val.status === 7 ? showList.push(val) : "";
  259. break;
  260. case 4:
  261. val.lockValue > 0 ? showList.push(val) : "";
  262. break;
  263. default:
  264. if (
  265. val.stationId ===
  266. this.options.filter((ops) => ops?.value === this.selectValue)[0]
  267. .stationId
  268. ) {
  269. showList.push(val);
  270. }
  271. break;
  272. }
  273. }
  274. let checkoutList = BackgroundData.getInstance().checkouts;
  275. checkoutList.forEach((item) => {
  276. let showIndex = null;
  277. showList.forEach((param, index) => {
  278. if (item.windturbineId === param.windturbineId) {
  279. showIndex = index;
  280. }
  281. });
  282. showList.splice(showIndex, 1);
  283. });
  284. showList.sort((a, b) => {
  285. let aSubString = "0",
  286. bSubString = "0";
  287. let aStation = "1",
  288. bStation = "2";
  289. if (a.windturbineId && b.windturbineId) {
  290. aSubString = a.windturbineId.substring(
  291. a.windturbineId.lastIndexOf("_") + 1
  292. );
  293. bSubString = b.windturbineId.substring(
  294. b.windturbineId.lastIndexOf("_") + 1
  295. );
  296. aStation = a.windturbineId.substring(
  297. 0,
  298. a.windturbineId.lastIndexOf("_")
  299. );
  300. bStation = b.windturbineId.substring(
  301. 0,
  302. b.windturbineId.lastIndexOf("_")
  303. );
  304. } else if (a.id && b.id) {
  305. aSubString = a.id.substring(a.id.lastIndexOf("_") + 1);
  306. bSubString = b.id.substring(b.id.lastIndexOf("_") + 1);
  307. aStation = a.id.substring(0, a.id.lastIndexOf("_"));
  308. bStation = b.id.substring(0, b.id.lastIndexOf("_"));
  309. }
  310. if (aStation === bStation) {
  311. return parseInt(aSubString) - parseInt(bSubString);
  312. } else {
  313. return 0;
  314. }
  315. });
  316. this.showList = showList;
  317. }
  318. },
  319. getLocks() {
  320. api.getCustomerLock().then((res) => {
  321. if (res) {
  322. this.lockValues = res.data;
  323. }
  324. });
  325. },
  326. initData: function () {
  327. let mb = MessageBridge.getInstance();
  328. let vss = [
  329. { key: "/topic/voice-control", action: this.windturbineMessage },
  330. ];
  331. mb.register(vss);
  332. },
  333. windturbineMessage(msg) {
  334. if (this.$store.state.current === 2) {
  335. let arr = [];
  336. if (msg === "CLOSE") {
  337. arr.push(msg);
  338. } else {
  339. arr = msg.split("-");
  340. }
  341. this.dialogVisible = false;
  342. this.showSvg = false;
  343. this.svgWeb = "";
  344. if (arr[0] === "OPEN_FJ") {
  345. this.currentWindturbine = this.windturbinelist[arr[1]];
  346. this.dialogVisible = true;
  347. } else if (arr[0] === "CLOSE") {
  348. this.dialogVisible = false;
  349. } else if (
  350. arr[0] === "CONTROL_START" ||
  351. arr[0] === "CONTROL_STOP" ||
  352. arr[0] === "CONTROL_MAINTAIN"
  353. ) {
  354. let windControlList = [];
  355. let mss = {};
  356. arr.forEach((item) => {
  357. if (
  358. item ===
  359. (this.windturbinelist[item]
  360. ? this.windturbinelist[item].windturbineId
  361. : "")
  362. ) {
  363. switch (arr[0]) {
  364. case "CONTROL_START":
  365. this.windturbinelist[item].controlType = "1";
  366. break;
  367. case "CONTROL_STOP":
  368. this.windturbinelist[item].controlType = "2";
  369. break;
  370. case "CONTROL_MAINTAIN":
  371. this.windturbinelist[item].controlType = "6";
  372. break;
  373. case "CONTROL_UNMAINTAIN":
  374. this.windturbinelist[item].controlType = "8";
  375. break;
  376. }
  377. windControlList.push(this.windturbinelist[item]);
  378. }
  379. });
  380. mss.type = "send";
  381. this.sendCommand(mss, windControlList);
  382. } else if (
  383. arr[0] === "CONTROL_LOCK_OVERHAUL" ||
  384. arr[0] === "CONTROL_LOCK_MAINTAIN" ||
  385. arr[0] === "CONTROL_LOCK_LNVOLVED_OVERHAUL" ||
  386. arr[0] === "CONTROL_LOCK_LNVOLVED_MAINTAIN" ||
  387. arr[0] === "CONTROL_LOCK_LNVOLVED_PG" ||
  388. arr[0] === "CONTROL_LOCK_LNVOLVED_WEATHER" ||
  389. arr[0] === "CONTROL_UNLOCK"
  390. ) {
  391. let windturbine = this.windturbinelist[arr[1]];
  392. switch (arr[0]) {
  393. case "CONTROL_LOCK_OVERHAUL":
  394. this.sendLock({ value: "CheckLock" }, windturbine);
  395. break;
  396. case "CONTROL_LOCK_MAINTAIN":
  397. this.sendLock({ value: "FaultLock" }, windturbine);
  398. break;
  399. case "CONTROL_LOCK_LNVOLVED_OVERHAUL":
  400. this.sendLock({ value: "StationCheckLock" }, windturbine);
  401. break;
  402. case "CONTROL_LOCK_LNVOLVED_MAINTAIN":
  403. this.sendLock({ value: "StationFaulLock" }, windturbine);
  404. break;
  405. case "CONTROL_LOCK_LNVOLVED_PG":
  406. this.sendLock({ value: "StationPowerLineLock" }, windturbine);
  407. break;
  408. case "CONTROL_LOCK_LNVOLVED_WEATHER":
  409. this.sendLock({ value: "StationWeatherLock" }, windturbine);
  410. break;
  411. case "CONTROL_UNLOCK":
  412. this.sendLock({ value: "UnLock" }, windturbine);
  413. break;
  414. }
  415. }
  416. }
  417. },
  418. /* 右键菜单 */
  419. contextmenu() {
  420. const remote = require("electron").remote;
  421. let that = this;
  422. let menuTemplate = [];
  423. if (
  424. this.selectValue === "0" ||
  425. this.selectValue === "1" ||
  426. this.selectValue === "2" ||
  427. this.selectValue === "3" ||
  428. this.selectValue === "4"
  429. ) {
  430. menuTemplate = [
  431. {
  432. label: "挂牌",
  433. submenu: [
  434. {
  435. label: "检修",
  436. click() {
  437. that.sendLock({ value: "CheckLock" });
  438. },
  439. },
  440. {
  441. label: "故障维修",
  442. click() {
  443. that.sendLock({ value: "FaultLock" });
  444. },
  445. },
  446. {
  447. label: "场内受累检修",
  448. click() {
  449. that.sendLock({ value: "StationCheckLock" });
  450. },
  451. },
  452. {
  453. label: "场内受累故障",
  454. click() {
  455. that.sendLock({ value: "StationFaulLock" });
  456. },
  457. },
  458. {
  459. label: "场外受累电网",
  460. click() {
  461. that.sendLock({ value: "StationPowerLineLock" });
  462. },
  463. },
  464. {
  465. label: "场外受累天气",
  466. click() {
  467. that.sendLock({ value: "StationWeatherLock" });
  468. },
  469. },
  470. ],
  471. },
  472. {
  473. label: "取消挂牌",
  474. click() {
  475. that.sendLock({ value: "UnLock" });
  476. },
  477. },
  478. {
  479. label: "参数对比",
  480. click() {
  481. that.parametersContrast();
  482. },
  483. },
  484. ];
  485. } else {
  486. menuTemplate = [
  487. {
  488. label: "启动",
  489. click() {
  490. that.sendCommand({ controlType: "1", deviceType: "Manual" });
  491. },
  492. },
  493. {
  494. label: "停机",
  495. click() {
  496. that.sendCommand({ controlType: "2", deviceType: "Manual" });
  497. },
  498. },
  499. {
  500. label: "复位",
  501. click() {
  502. that.sendCommand({ controlType: "5", deviceType: "Manual" });
  503. },
  504. },
  505. {
  506. label: "维护",
  507. click() {
  508. that.sendCommand({ controlType: "6", deviceType: "Manual" });
  509. },
  510. },
  511. {
  512. label: "取消维护",
  513. click() {
  514. that.sendCommand({ controlType: "8", deviceType: "Manual" });
  515. },
  516. },
  517. {
  518. label: "挂牌",
  519. submenu: [
  520. {
  521. label: "检修",
  522. click() {
  523. that.sendLock({ value: "CheckLock" });
  524. },
  525. },
  526. {
  527. label: "故障维修",
  528. click() {
  529. that.sendLock({ value: "FaultLock" });
  530. },
  531. },
  532. {
  533. label: "场内受累检修",
  534. click() {
  535. that.sendLock({ value: "StationCheckLock" });
  536. },
  537. },
  538. {
  539. label: "场内受累故障",
  540. click() {
  541. that.sendLock({ value: "StationFaulLock" });
  542. },
  543. },
  544. {
  545. label: "场外受累电网",
  546. click() {
  547. that.sendLock({ value: "StationPowerLineLock" });
  548. },
  549. },
  550. {
  551. label: "场外受累天气",
  552. click() {
  553. that.sendLock({ value: "StationWeatherLock" });
  554. },
  555. },
  556. ],
  557. },
  558. {
  559. label: "取消挂牌",
  560. click() {
  561. that.sendLock({ value: "UnLock" });
  562. },
  563. },
  564. {
  565. label: "参数对比",
  566. click() {
  567. that.parametersContrast();
  568. },
  569. },
  570. ];
  571. }
  572. const menu = remote.Menu.buildFromTemplate(menuTemplate);
  573. menu.popup(remote.getCurrentWindow());
  574. },
  575. sendCommand(msg, windturbine) {
  576. let bd = BackgroundData.getInstance();
  577. if (!bd.LoginUser) {
  578. this.$notify({
  579. title: "请登录",
  580. message: "控制风机需要先登录!",
  581. type: "warning",
  582. position: "bottom-right",
  583. offset: 60,
  584. duration: 3000,
  585. });
  586. return;
  587. }
  588. let sendList = [];
  589. if (windturbine) {
  590. sendList = windturbine;
  591. } else {
  592. this.chooseList.forEach((item) => {
  593. item.controlType = Number(msg.controlType);
  594. });
  595. sendList = this.chooseList;
  596. }
  597. if (sendList.length > 0) {
  598. bd.checkout(sendList);
  599. this.chooseList = [];
  600. let pairs = {};
  601. sendList.forEach((item) => {
  602. let ct = {
  603. windturbineId: item.windturbineId,
  604. stationId: item.stationId,
  605. projectId: item.projectId,
  606. modelId: item.modelId,
  607. controlType: item.controlType,
  608. lockType: item.lockType,
  609. userName: `system_${bd.LoginUser.name}`,
  610. userId: 0,
  611. auto: false,
  612. deviceType: msg.deviceType,
  613. };
  614. pairs[ct.windturbineId] = ct;
  615. });
  616. api.windturbControl(pairs).then((res) => {
  617. if (res) {
  618. this.controlSuccess(res);
  619. }
  620. });
  621. }
  622. },
  623. sendLock(msg, windturbine) {
  624. let bd = BackgroundData.getInstance();
  625. if (!bd.LoginUser) {
  626. this.$notify({
  627. title: "请登录",
  628. message: "控制风机需要先登录!",
  629. type: "warning",
  630. position: "bottom-right",
  631. offset: 60,
  632. duration: 3000,
  633. });
  634. return;
  635. }
  636. let sendList = [];
  637. if (windturbine) {
  638. windturbine.lockType = msg.value;
  639. sendList.push(windturbine);
  640. } else {
  641. this.chooseList.forEach((item) => {
  642. item.lockType = msg.value;
  643. });
  644. sendList = this.chooseList;
  645. }
  646. if (sendList.length > 0) {
  647. this.chooseList = [];
  648. let pairs = {};
  649. sendList.forEach((item) => {
  650. let ct = {
  651. windturbineId: item.windturbineId,
  652. stationId: item.stationId,
  653. projectId: item.projectId,
  654. modelId: item.modelId,
  655. controlType: item.controlType,
  656. lockType: item.lockType,
  657. userName: `system_${bd.LoginUser.name}`,
  658. userId: 0,
  659. };
  660. pairs[ct.windturbineId] = ct;
  661. });
  662. api.windturbControlLock(pairs).then((res) => {
  663. if (res) {
  664. this.controlSuccess(res);
  665. }
  666. });
  667. }
  668. },
  669. /* 控制成功 */
  670. controlSuccess(msg) {
  671. let bd = BackgroundData.getInstance();
  672. for (let id in msg.data) {
  673. let val = msg.data[id];
  674. if (val.errorCode !== "0") {
  675. bd.removeCheckouts(val);
  676. }
  677. }
  678. let mss = ""; // 信息
  679. let iserror = false; // 是否有控制错误的风机
  680. for (let v in msg.data) {
  681. let val = msg.data[v];
  682. if (val.errorCode > 0) {
  683. iserror = true;
  684. mss += `${val.windturbineId} ${
  685. this.controlErorCodes[val.errorCode]
  686. }\n`;
  687. }
  688. }
  689. let tp = iserror ? "warning" : "success";
  690. // if (!iserror) {
  691. // mss = "控制成功";
  692. // }
  693. this.$notify({
  694. title: "控制",
  695. message: mss,
  696. type: tp,
  697. position: "bottom-right",
  698. offset: 60,
  699. duration: 3000,
  700. });
  701. },
  702. /* 控制失败 */
  703. controlError(err) {
  704. this.$notify({
  705. title: "控制出现错误",
  706. message: err.message,
  707. type: "warning",
  708. position: "bottom-right",
  709. offset: 60,
  710. duration: 3000,
  711. });
  712. },
  713. handleClick(values) {
  714. if (values.active) {
  715. let showIndex = null;
  716. this.chooseList.forEach((item, index) => {
  717. if (item.windturbineId === values.windturbineId) {
  718. showIndex = index;
  719. }
  720. });
  721. this.chooseList.splice(showIndex, 1);
  722. } else {
  723. this.chooseList.push(values);
  724. }
  725. this.showList.forEach((item) => {
  726. if (item.windturbineId === values.windturbineId) {
  727. item.active = !item.active;
  728. }
  729. });
  730. },
  731. listedChange() {
  732. this.chooseList = [];
  733. const showList = [];
  734. if (Number(this.selectValue) >= 6) {
  735. console.log(
  736. this.options.filter((ops) => ops?.value === this.selectValue)[0]
  737. .stationId
  738. );
  739. this.$store.commit(
  740. "currentStation",
  741. this.options.filter((ops) => ops?.value === this.selectValue)[0]
  742. .stationId
  743. );
  744. } else {
  745. this.$store.commit("currentStation", "");
  746. }
  747. console.log(this.$store.state.currentStation);
  748. this.dataList.forEach((val) => {
  749. val.active = false;
  750. switch (Number(this.selectValue)) {
  751. case 0:
  752. if (
  753. val.status === 5 ||
  754. val.status === 6 ||
  755. val.status === 7 ||
  756. val.lockValue > 0
  757. ) {
  758. showList.push(val);
  759. }
  760. break;
  761. case 1:
  762. val.status === 5 ? showList.push(val) : "";
  763. break;
  764. case 2:
  765. val.status === 6 ? showList.push(val) : "";
  766. break;
  767. case 3:
  768. val.status === 7 ? showList.push(val) : "";
  769. break;
  770. case 4:
  771. val.lockValue > 0 ? showList.push(val) : "";
  772. break;
  773. default:
  774. if (Number(this.selectValue) < 12) {
  775. if (
  776. val.stationId ===
  777. this.options.filter((ops) => ops?.value === this.selectValue)[0]
  778. .stationId
  779. ) {
  780. showList.push(val);
  781. }
  782. } else {
  783. if (
  784. val.station ===
  785. this.options.filter((ops) => ops?.value === this.selectValue)[0]
  786. .stationId
  787. ) {
  788. showList.push(val);
  789. }
  790. }
  791. break;
  792. }
  793. });
  794. showList.sort((a, b) => {
  795. let aSubString = "0",
  796. bSubString = "0";
  797. let aStation = "1",
  798. bStation = "2";
  799. if (a.windturbineId && b.windturbineId) {
  800. aSubString = a.windturbineId.substring(
  801. a.windturbineId.lastIndexOf("_") + 1
  802. );
  803. bSubString = b.windturbineId.substring(
  804. b.windturbineId.lastIndexOf("_") + 1
  805. );
  806. aStation = a.windturbineId.substring(
  807. 0,
  808. a.windturbineId.lastIndexOf("_")
  809. );
  810. bStation = b.windturbineId.substring(
  811. 0,
  812. b.windturbineId.lastIndexOf("_")
  813. );
  814. } else if (a.id && b.id) {
  815. aSubString = a.id.substring(a.id.lastIndexOf("_") + 1);
  816. bSubString = b.id.substring(b.id.lastIndexOf("_") + 1);
  817. aStation = a.id.substring(0, a.id.lastIndexOf("_"));
  818. bStation = b.id.substring(0, b.id.lastIndexOf("_"));
  819. }
  820. if (aStation === bStation) {
  821. return parseInt(aSubString) - parseInt(bSubString);
  822. } else {
  823. return 0;
  824. }
  825. });
  826. this.showList = showList;
  827. },
  828. handleDetails(itm) {
  829. this.dialogVisible = true;
  830. this.currentWindturbine = itm;
  831. },
  832. handleDetialPv(item) {
  833. this.dialogPvDia = true;
  834. this.currentWindturbinePv = item;
  835. },
  836. handleClose() {
  837. this.dialogVisible = false;
  838. this.showSvg = false;
  839. this.getLocks();
  840. },
  841. parametersContrast() {
  842. if (this.chooseList.length > 1) {
  843. this.parametersDisplay = true;
  844. }
  845. },
  846. handleWindturbineChange() {
  847. let ws = MessageBridge.getInstance();
  848. let wind = [{ key: "/topic/windturbine", action: this.getWindMsg }];
  849. let guangfu = [{ key: "/topic/pv", action: this.getPvMsg }];
  850. ws.register(wind);
  851. ws.register(guangfu);
  852. },
  853. getPvMsg(msg) {
  854. window.sessionStorage.removeItem("pvSbq");
  855. // let jsonMsg = JSON.parse(msg)
  856. window.sessionStorage.setItem("pvSbq", msg);
  857. this.changeData();
  858. },
  859. getWindMsg(msg) {
  860. window.sessionStorage.removeItem("windSbq");
  861. // let jsonMsg = JSON.parse(msg)
  862. window.sessionStorage.setItem("windSbq", msg);
  863. this.changeData();
  864. },
  865. changeData() {
  866. let wswind = JSON.parse(window.sessionStorage.getItem("windSbq"));
  867. let pv = JSON.parse(window.sessionStorage.getItem("pvSbq"));
  868. let msg = {};
  869. if (wswind || pv) {
  870. msg = { ...wswind };
  871. if (pv) {
  872. msg = { ...msg, ...pv };
  873. }
  874. this.windturbinelist = msg;
  875. this.$store.commit("windturbinelist", msg);
  876. this.dataList = [];
  877. const showList = [];
  878. let arr = Object.keys(msg).sort();
  879. let newArr = [];
  880. for (let id of arr) {
  881. let val = msg[id];
  882. newArr.push(val);
  883. this.chooseList.forEach((item) => {
  884. if (item.windturbineId === val.windturbineId) {
  885. val.active = true;
  886. }
  887. });
  888. if (val.lockValue === 9) {
  889. val.lockValues = this.lockValues.filter(
  890. (item) => val.windturbineId === item.windturbineID
  891. )[0]?.value;
  892. }
  893. this.dataList.push(val);
  894. switch (Number(this.selectValue)) {
  895. case 0:
  896. if (
  897. val.status === 5 ||
  898. val.status === 6 ||
  899. val.status === 7 ||
  900. val.lockValue > 0
  901. ) {
  902. showList.push(val);
  903. }
  904. break;
  905. case 1:
  906. val.status === 5 ? showList.push(val) : "";
  907. break;
  908. case 2:
  909. val.status === 6 ? showList.push(val) : "";
  910. break;
  911. case 3:
  912. val.status === 7 ? showList.push(val) : "";
  913. break;
  914. case 4:
  915. val.lockValue > 0 ? showList.push(val) : "";
  916. break;
  917. default:
  918. // if (
  919. // val.stationId ===
  920. // this.options.filter(
  921. // (ops) => ops?.value === this.selectValue
  922. // )[0].stationId
  923. // ) {
  924. // this.showList.push(val);
  925. // }
  926. if (Number(this.selectValue) < 12) {
  927. if (
  928. val.stationId ===
  929. this.options.filter(
  930. (ops) => ops?.value === this.selectValue
  931. )[0].stationId
  932. ) {
  933. showList.push(val);
  934. }
  935. } else {
  936. if (
  937. val.station ===
  938. this.options.filter(
  939. (ops) => ops?.value === this.selectValue
  940. )[0].stationId
  941. ) {
  942. showList.push(val);
  943. }
  944. }
  945. break;
  946. }
  947. }
  948. // console.log('showList', this.showList)
  949. let checkoutList = BackgroundData.getInstance().checkouts;
  950. if (checkoutList.length > 0) {
  951. checkoutList.forEach((item) => {
  952. let showIndex = null;
  953. showList.forEach((param, index) => {
  954. if (item.windturbineId === param.windturbineId) {
  955. showIndex = index;
  956. }
  957. });
  958. showList.splice(showIndex, 1);
  959. });
  960. }
  961. showList.sort((a, b) => {
  962. let aSubString = "0",
  963. bSubString = "0";
  964. let aStation = "1",
  965. bStation = "2";
  966. if (a.windturbineId && b.windturbineId) {
  967. aSubString = a.windturbineId.substring(
  968. a.windturbineId.lastIndexOf("_") + 1
  969. );
  970. bSubString = b.windturbineId.substring(
  971. b.windturbineId.lastIndexOf("_") + 1
  972. );
  973. aStation = a.windturbineId.substring(
  974. 0,
  975. a.windturbineId.lastIndexOf("_")
  976. );
  977. bStation = b.windturbineId.substring(
  978. 0,
  979. b.windturbineId.lastIndexOf("_")
  980. );
  981. } else if (a.id && b.id) {
  982. aSubString = a.id.substring(a.id.lastIndexOf("_") + 1);
  983. bSubString = b.id.substring(b.id.lastIndexOf("_") + 1);
  984. aStation = a.id.substring(0, a.id.lastIndexOf("_"));
  985. bStation = b.id.substring(0, b.id.lastIndexOf("_"));
  986. }
  987. if (aStation === bStation) {
  988. return parseInt(aSubString) - parseInt(bSubString);
  989. } else {
  990. return 0;
  991. }
  992. });
  993. this.showList = showList;
  994. }
  995. },
  996. },
  997. unmounted() {
  998. clearInterval(this.intervals);
  999. this.intervals = null;
  1000. },
  1001. };
  1002. </script>
  1003. <style scoped>
  1004. .problem {
  1005. height: 100%;
  1006. }
  1007. .body {
  1008. border: 1px solid #373737;
  1009. width: 100%;
  1010. margin-left: 15px;
  1011. margin-top: 10px;
  1012. height: 61vh;
  1013. }
  1014. .body .scoll {
  1015. height: 91%;
  1016. }
  1017. .titleBar {
  1018. display: flex;
  1019. flex-direction: row;
  1020. align-items: center;
  1021. }
  1022. .title {
  1023. color: #ffffff;
  1024. font-size: 14px;
  1025. margin-left: 32px;
  1026. /* margin-top: 12px; */
  1027. margin-bottom: 10px;
  1028. /* width: 570px; */
  1029. width: 29vw;
  1030. height: 50px;
  1031. display: flex;
  1032. align-items: center;
  1033. position: absolute;
  1034. background-color: #000000;
  1035. }
  1036. .title::before {
  1037. z-index: 1;
  1038. content: "";
  1039. position: absolute;
  1040. left: -18px !important;
  1041. /* top: 30px !important; */
  1042. width: 5px;
  1043. height: 5px;
  1044. background-color: #54b75a;
  1045. border-radius: 50%;
  1046. }
  1047. .inputs {
  1048. border: none;
  1049. width: 174px !important;
  1050. margin-left: 110px;
  1051. }
  1052. .el-input__inner {
  1053. background-color: rgb(100, 100, 100) !important;
  1054. color: rgb(220, 220, 220) !important;
  1055. border: 1px solid red !important;
  1056. }
  1057. .logo {
  1058. position: absolute;
  1059. top: 2px;
  1060. left: 12px;
  1061. }
  1062. .content::-webkit-scrollbar {
  1063. /*隐藏滚轮*/
  1064. display: none;
  1065. }
  1066. .box1 {
  1067. width: 99%;
  1068. height: 40px;
  1069. background-color: rgb(30, 30, 30);
  1070. margin-top: 2px;
  1071. text-align: left;
  1072. line-height: 40px;
  1073. color: #fff;
  1074. box-sizing: border-box;
  1075. padding-left: 20px;
  1076. }
  1077. </style>