areaCard.vue 35 KB

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