diff --git a/src/store/modules/iscs.js b/src/store/modules/iscs.js index 2ad62748f..e9a954abc 100644 --- a/src/store/modules/iscs.js +++ b/src/store/modules/iscs.js @@ -14,7 +14,9 @@ const iscs = { closeMusicNum: 0, // 关闭音乐标识 faultList: [], // 故障 元素状态 incidentList: [], // 事件列表 - alarmList: [] // 报警列表 + alarmList: [], // 报警列表 + gateFaultList: [], // 闸机故障 + gateFaultCount: 0 }, getters: { @@ -184,6 +186,15 @@ const iscs = { }, updateIscsState: (state, deviceStatus) => { Vue.prototype.$iscs && Vue.prototype.$iscs.update(deviceStatus); + }, + handlerGateFaultList: (state, data) => { + if (data.type === 'SET') { + state.gateFaultList.push(data.stationCode); + } else if (data.type === 'CANCEL') { + const index = state.gateFaultList.findIndex(item => item === data.stationCode); + state.gateFaultList.splice(index, 1); + } + state.gateFaultCount++; } }, @@ -224,6 +235,9 @@ const iscs = { }, setDelIncidentList: ( { commit }) => { commit('setDelIncidentList'); + }, + handlerGateFaultList: ({ commit }, data) => { + commit('handlerGateFaultList', data); } } }; diff --git a/src/views/iscs/iscsSystem/stationConfig/dialog/malfunction.vue b/src/views/iscs/iscsSystem/stationConfig/dialog/malfunction.vue index 7f764c25c..e8a153d94 100644 --- a/src/views/iscs/iscsSystem/stationConfig/dialog/malfunction.vue +++ b/src/views/iscs/iscsSystem/stationConfig/dialog/malfunction.vue @@ -3,7 +3,7 @@ import iscsSystem from '../canvas/iscsCanvas'; import {getIscsData} from '@/api/iscs'; -import { creatSubscribe, clearSubscribe, getTopic } from '@/utils/stomp'; -import { getToken } from '@/utils/auth'; export default { name:'TicketOrEntrance', components:{ @@ -25,8 +23,7 @@ export default { loading:false, width:window.innerWidth, scaleRate:window.innerWidth / 2200, - height: 1000, - flag: false + height: 1000 }; }, computed:{ @@ -45,10 +42,8 @@ export default { this.mode = this.$route.params.mode; this.getInitData(); }, - '$route.query.stationId': function (val, oldVal) { - if (this.flag && this.mode == 'autoTicket') { - this.clearSubscribe(oldVal); - } + '$store.state.iscs.gateFaultCount': function(val) { + this.$store.dispatch('iscs/updateIscsState', [{deviceType: 'GATE', status: this.$store.state.iscs.gateFaultList.includes(this.stationId) ? 0 : 1}]); } }, created() { @@ -57,9 +52,6 @@ export default { mounted() { this.getInitData(); }, - beforeDestroy() { - this.clearSubscribe(this.$route.query.stationId); - }, methods:{ getInitData() { const params = { @@ -95,22 +87,13 @@ export default { const data = JSON.parse(resp.data.graphData); this.$refs.iscsPlate.show(data, this.width, this.height, this.scaleRate); document.querySelector('.fasIndex').scrollTop = 0; - if (this.mode == 'autoTicket') { - this.subscribe(this.$route.query.stationId); - this.flag = true; + if (this.mode === 'autoTicket') { + this.$store.dispatch('iscs/updateIscsState', [{deviceType: 'GATE', status: this.$store.state.iscs.gateFaultList.includes(this.stationId) ? 0 : 1}]); } } else { this.loading = false; } }); - }, - subscribe(stationCode) { - const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; - creatSubscribe(getTopic('ISCSGATE', this.$route.query.group, {stationCode} ), header); - this.$store.dispatch('app/animationsClose'); - }, - clearSubscribe(stationCode) { - clearSubscribe(getTopic('ISCSGATE', this.$route.query.group, {stationCode})); } } }; diff --git a/src/views/iscs/iscsSystem/stationNav.vue b/src/views/iscs/iscsSystem/stationNav.vue index 88ea5bb97..d56187e81 100644 --- a/src/views/iscs/iscsSystem/stationNav.vue +++ b/src/views/iscs/iscsSystem/stationNav.vue @@ -4,15 +4,15 @@
-
-
+
+
-
-
{{ item.name }}
+
{{ item.name }}
+
@@ -64,6 +64,7 @@
事件
+
故障取消
故障设置
@@ -460,7 +461,10 @@ export default { }, // 设置故障 handleMalfunction() { - this.$refs.malfunction.doShow(); + this.$refs.malfunction.doShow('SET'); + }, + cancelMalfunction() { + this.$refs.malfunction.doShow('CANCEL'); }, selectChildren(type, isReplace = false) { // 选择菜单 let stationName = '';