areaCard.vue 28 KB

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