大铁项目 代码调整

This commit is contained in:
joylink_cuiweidong 2022-06-30 13:52:27 +08:00
parent f10a118132
commit 927687aa9b

View File

@ -40,6 +40,7 @@ export default {
return {
stationCode:'',
groupModel: '',
hasUnsubscribe:false,
buttonList: [
{
label: '运行图',
@ -79,11 +80,11 @@ export default {
]
};
},
// watch: {
// '$store.state.training.prdType': function(prdType, oldPrdType) {
// this.changePrdType(prdType, oldPrdType);
// }
// },
watch: {
'$store.state.training.prdType': function(prdType, oldPrdType) {
this.changePrdType(prdType, oldPrdType);
}
},
mounted() {
// const _that = this;
// window.onbeforeunload = () => { _that.clearSubscribe(); };
@ -115,32 +116,40 @@ export default {
callback: action => {
}
});
}
// changePrdType(prdType, oldPrdType) {
},
changePrdType(prdType, oldPrdType) {
// if (prdType) {
// this.subscribe(prdType);
// }
// if (oldPrdType) {
// this.clearSubscribe(oldPrdType);
// }
// },
// async subscribe(prdType) {
// const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
if (prdType == '01') {
this.clearSubscribe();
this.hasUnsubscribe = true;
} else if (prdType == '02' && this.hasUnsubscribe) {
this.subscribe();
}
},
async subscribe(prdType) {
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
creatSubscribe(getTopic('CTC', this.$route.query.group), header);
// if (prdType == '02') {
// creatSubscribe(getTopic('CTC_RAILWAY', this.$route.query.group), header);
// // creatSubscribe(getTopic('CTC_RAILWAY', this.$route.query.group), header);
// } else if (prdType == '01') {
// creatSubscribe(getTopic('CTC', this.$route.query.group), header);
// // creatSubscribe(getTopic('CTC', this.$route.query.group), header);
// }
// },
// clearSubscribe(prdType) {
},
clearSubscribe(prdType) {
// if (prdType == '02') {
// clearSubscribe(getTopic('CTC_RAILWAY', this.groupModel));
// // clearSubscribe(getTopic('CTC_RAILWAY', this.groupModel));
// } else if (prdType == '01') {
// clearSubscribe(getTopic('CTC', this.groupModel));
// }
clearSubscribe(getTopic('CTC', this.groupModel));
// }
}
}
};
</script>
<style lang="scss" scoped>