大铁项目 代码调整

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