areaCard.vue 36 KB

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