iscs调整

This commit is contained in:
joylink_fanyuhong 2022-01-18 15:51:24 +08:00
parent a3d388ec96
commit 3e15722d05
4 changed files with 58 additions and 5 deletions

View File

@ -342,6 +342,7 @@ const socket = {
deviceStateMessages: null, // 新版订阅设备状态消息 deviceStateMessages: null, // 新版订阅设备状态消息
iscsStateMessages: null, // iscs设备状态消息 iscsStateMessages: null, // iscs设备状态消息
iscsStatePaMessages: null, // iscsPA设备状态消息 iscsStatePaMessages: null, // iscsPA设备状态消息
iscsStatePisMessages: null, // iscsPIS设备状态消息
simulationSpeed: 1, // 仿真倍速 simulationSpeed: 1, // 仿真倍速
simulationPause: false, simulationPause: false,
simulationPslStatus: [], // PSL面板按钮状态信息 simulationPslStatus: [], // PSL面板按钮状态信息
@ -429,6 +430,9 @@ const socket = {
}, },
setIscsStatePaMessages: (state, speed) => { setIscsStatePaMessages: (state, speed) => {
state.iscsStatePaMessages = speed; state.iscsStatePaMessages = speed;
},
setIscsStatePisMessages: (state, speed) => {
state.iscsStatePisMessages = speed;
} }
}, },
@ -520,6 +524,9 @@ const socket = {
}, },
handleIscsPaState:({ commit }, state) => { handleIscsPaState:({ commit }, state) => {
commit('setIscsStatePaMessages', state); commit('setIscsStatePaMessages', state);
},
handleIscsPisState:({ commit }, state) => {
commit('setIscsStatePisMessages', state);
} }
} }
}; };

View File

@ -60,6 +60,8 @@ function callback(Response) {
store.dispatch('socket/handleIscsState', JSON.parse(Response.body)); store.dispatch('socket/handleIscsState', JSON.parse(Response.body));
} else if (Response.headers.destination.includes('iscs/pa')) { } else if (Response.headers.destination.includes('iscs/pa')) {
store.dispatch('socket/handleIscsPaState', JSON.parse(Response.body)); store.dispatch('socket/handleIscsPaState', JSON.parse(Response.body));
} else if (Response.headers.destination.includes('iscs/pis')) {
store.dispatch('socket/handleIscsPisState', JSON.parse(Response.body));
} else { } else {
const data = JSON.parse(Response.body); const data = JSON.parse(Response.body);
store.dispatch('socket/setStomp', data); store.dispatch('socket/setStomp', data);

View File

@ -233,7 +233,17 @@ export default {
}, },
releaseBroadcast() { releaseBroadcast() {
this.visible = false; this.visible = false;
if (this.resource) { if (this.addModel.infoType === 'realTime') {
if (!this.addModel.infoTitle) {
this.$message.error('请输入实时信息标题!');
} else if (!this.addModel.infoContent) {
this.$message.error('请输入实时信息内容!');
} else {
this.$emit('releaseBroadcast', {name: this.addModel.infoTitle, content: this.addModel.infoContent });
this.addModel.infoContent = '';
this.addModel.infoTitle = '';
}
} else if (this.resource) {
this.$emit('releaseBroadcast', this.resource); this.$emit('releaseBroadcast', this.resource);
} }
}, },

View File

@ -21,7 +21,7 @@
</div> </div>
<div v-if="station.children&&station.children.length>0"> <div v-if="station.children&&station.children.length>0">
<div v-for="(child,index) in station.children" :key="station.code+index" class="each_data_info" style="text-align: center;" @click="selectArea(station.code,index)"> <div v-for="(child,index) in station.children" :key="station.code+index" class="each_data_info" style="text-align: center;" @click="selectArea(station.code,index)">
<div v-if="child.status==='default'" class="button_default_content"> <div v-if="child.status==='default'" :id="station.code + '-' + index" class="button_default_content">
<div class="button_default" :style="{background:selectedAreaList.includes(station.code + '-' + index)?'#2EFF74':'#CDCDCD'}" /> <div class="button_default" :style="{background:selectedAreaList.includes(station.code + '-' + index)?'#2EFF74':'#CDCDCD'}" />
</div> </div>
</div> </div>
@ -72,6 +72,8 @@ import { getByGroupStationList } from '@/api/jmap/map';
import { queryIscsDeviceCod } from '@/api/iscs'; import { queryIscsDeviceCod } from '@/api/iscs';
import InfoBroadcast from './infoBroadcast'; import InfoBroadcast from './infoBroadcast';
import { sendCommandNew } from '@/api/jmap/training'; import { sendCommandNew } from '@/api/jmap/training';
import { creatSubscribe, clearSubscribe, getTopic } from '@/utils/stomp';
import { getToken } from '@/utils/auth';
export default { export default {
name:'MainScreen', name:'MainScreen',
components: { components: {
@ -92,9 +94,25 @@ export default {
], ],
stationList:[], stationList:[],
selectedAreaList: [], selectedAreaList: [],
iscsDeviceMap: {},
deviceMap: {} deviceMap: {}
}; };
}, },
watch: {
'$store.state.socket.iscsStatePisMessages': function (list) {
if (list && list.length) {
list.forEach(item => {
const index = this.iscsDeviceMap[item.code];
if (index) {
this.$set(this.deviceMap[index], 'state', item.state);
const div = document.getElementById(index);
div.style.background = item.state === 'normal' ? '#2EFF74' : '#D4D4D4';
}
});
}
}
},
async created () { async created () {
// 线 // 线
try { try {
@ -120,6 +138,7 @@ export default {
if (station.code == item.station) { if (station.code == item.station) {
const index = positionMap[item.position]; const index = positionMap[item.position];
children[index].status = 'default'; children[index].status = 'default';
this.iscsDeviceMap[item.code] = station.code + '-' + index;
this.deviceMap[station.code + '-' + index] = item; this.deviceMap[station.code + '-' + index] = item;
} }
}); });
@ -133,10 +152,13 @@ export default {
} }
}); });
} }
this.subscribe();
} catch (e) { } catch (e) {
this.$message.error('获取车站列表失败!'); this.$message.error('获取车站列表失败!');
} }
},
beforeDestroy() {
this.clearSubscribe();
}, },
methods:{ methods:{
showInfoBrroadcast() { showInfoBrroadcast() {
@ -173,10 +195,13 @@ export default {
} }
const params = { const params = {
resourceId: voice.id, resourceId: voice.id,
iscsDeviceCodes: iscsDeviceCodes iscsDeviceCodes: iscsDeviceCodes,
name: voice.name,
content: voice.content
}; };
console.log(voice, '------', params);
sendCommandNew(this.$route.query.group, 'ISCS_PIS_Play', params).then(resp => { sendCommandNew(this.$route.query.group, 'ISCS_PIS_Play', params).then(resp => {
const voiceUrl = this.$store.state.user.resourcesUrl + voice.url; const voiceUrl = this.$store.state.user.resourcesUrl + (voice.url || resp.data);
const audio = document.getElementById('voice'); const audio = document.getElementById('voice');
audio.src = voiceUrl; audio.src = voiceUrl;
audio.play(); audio.play();
@ -250,6 +275,15 @@ export default {
} }
}); });
}); });
},
subscribe() {
this.clearSubscribe();
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
creatSubscribe(getTopic('ISCSPIS', this.$route.query.group ), header);
this.$store.dispatch('app/animationsClose');
},
clearSubscribe() {
clearSubscribe(getTopic('ISCSPIS', this.$route.query.group));
} }
} }
}; };