From c71cbfb359c5b50db75d98435c6641620fbdd313 Mon Sep 17 00:00:00 2001 From: songshankun <songshankun@foxmail.com> Date: 星期日, 08 十月 2023 18:34:15 +0800 Subject: [PATCH] feat: 页面刷新保持在当前通道 --- src/views/visualization.vue | 37 +++++++++++++++++++++++++++++-------- 1 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/views/visualization.vue b/src/views/visualization.vue index bb6eb01..c0e7cc3 100644 --- a/src/views/visualization.vue +++ b/src/views/visualization.vue @@ -787,7 +787,11 @@ this.getDate3(); this.getDate2(); }, 5000); - this.getTaskInfo(); + + let channelType = this.getChannelTypeFromUrl() + channelType = channelType ?? 1 + this.activeName = channelType + this.getTaskInfo(channelType); this.getTaskCountStatistics() }, beforeDestroy() { @@ -803,7 +807,6 @@ // } }, methods: { - getModelList(){ this.resResult=null for (let i in this.TasksCopy){ @@ -822,10 +825,10 @@ this.isUpdateIcon=true; break; } - } + } } } - this.resResult=res; + this.resResult=res; }) } } @@ -839,7 +842,6 @@ } } this.$message.error('褰撳墠宸ュ簭鏃犵紪鍙凤紝鏃犳硶鏌ョ湅宸ュ簭!') - }, getProcessModelList(){ this.getModelList() @@ -873,6 +875,7 @@ }, cutClick(val) { this.activeName = val; + this.updateChannelTypeToUrl(val) if(this.activeName==2){ this.Tasks=this.TasksCopy.slice(0,2) if(this.Tasks.length<2){ @@ -915,9 +918,6 @@ } }); }, - - - getDateObj(date, fmt) { if (/(y+)/.test(fmt)) { fmt = fmt.replace( @@ -1161,6 +1161,27 @@ } }) }, + /** + * 鍚慤RL涓缃綋鍓嶉�氶亾灞曠ず绫诲瀷 + * @param {number} type 閫氶亾灞曠ず绫诲瀷 + */ + updateChannelTypeToUrl(type){ + const activeName = this.getChannelTypeFromUrl(); + if (activeName === type){ + return + } + let path = this.$router.history.current.path + this.$router.push({path, query: {activeName: `${type ?? 1}`}}) + }, + /** + * 浠嶶RL鑾峰彇褰撳墠閫氶亾灞曠ず绫诲瀷 + * @return {number} + */ + getChannelTypeFromUrl(){ + let activeName = new URLSearchParams(location.search).get('activeName') + activeName = activeName ? +activeName : undefined + return activeName + }, getProgressInfo() { this.resprocInfoTimer=null for (let i in this.TasksCopy){ -- Gitblit v1.8.0