diff --git a/nezha-fronted/src/components/common/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/alert/alertMessageTable.vue index 2b79494a6..31cba4354 100644 --- a/nezha-fronted/src/components/common/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/alert/alertMessageTable.vue @@ -355,6 +355,8 @@ viewAssetState: false, scrollbarWrap: null, + delFlag:false, + tableDataInitNum:0, } }, computed: { @@ -636,6 +638,7 @@ deleteMessage() { this.$refs.remarkForm.validate(valid => { if (valid) { + this.delFlag=true; this.$emit('deleteMessage',this.deleteBox,()=>{ this.deleteBox.ids=[]; bus.$emit("alert-message-change") @@ -855,7 +858,16 @@ if (n.length === 0 && this.pageObj.pageNo > 1) { this.pageNo(this.pageObj.pageNo-1); } + if(!this.delFlag){ + this.$refs.alertListTable.bodyWrapper.scrollTop = 0 + } + this.tableDataInitNum++;//因为异步加载的问题导致该表格加载三次 只有最后一次是稳定 故只有第三次是去除是否删除的标记 + if(this.tableDataInitNum===2){ + this.tableDataInitNum=0; + this.delFlag=false; + } } + } }, mounted() { diff --git a/nezha-fronted/src/components/common/deleteButton.vue b/nezha-fronted/src/components/common/deleteButton.vue index 6105dc4e6..707a842b1 100644 --- a/nezha-fronted/src/components/common/deleteButton.vue +++ b/nezha-fronted/src/components/common/deleteButton.vue @@ -25,6 +25,7 @@ cancelButtonText: this.$t("tip.no"), type: 'warning' }).then(() => { + this.$emit('before'); let params=this.filterParam(); this.$delete(this.api+params).then(response => { if (response.code === 200) { diff --git a/nezha-fronted/src/components/page/alert/config.vue b/nezha-fronted/src/components/page/alert/config.vue index 762c81612..77391157b 100644 --- a/nezha-fronted/src/components/page/alert/config.vue +++ b/nezha-fronted/src/components/page/alert/config.vue @@ -48,7 +48,7 @@ - + @@ -289,6 +289,7 @@ viewAsset: false, searchTime: bus.getTimezontDateRange(), scrollbarWrap: null, + delFlag:false, } }, methods: { @@ -307,6 +308,7 @@ closeRightBox(refresh) { this.rightBox.show = false; if (refresh) { + this.delFlag=true; this.getTableData(); } }, @@ -318,6 +320,7 @@ }).then(() => { this.$delete("alert/rule?ids=" + u.id).then(response => { if (response.code === 200) { + this.delFlag=true; this.$message({type: 'success', message: this.$t("tip.deleteSuccess")}); this.getTableData(); } else { @@ -509,6 +512,11 @@ if (n.length === 0 && this.pageObj.pageNo > 1) { this.pageNo(this.pageObj.pageNo-1); } + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.alertRuleTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } } } }, diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index 7ae2919ea..a78cf49c3 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -21,7 +21,7 @@ - + @@ -388,11 +388,11 @@ idcId: '', idcIds: '' }, - assetPingSwitch: localStorage.getItem('nz-sys-asset-ping-switch'), tagKeys:[], - scrollbarWrap: null + scrollbarWrap: null, + delFlag:false, } }, computed:{ @@ -434,6 +434,14 @@ }else if(n.length === 0 && this.pageObj.pageNo === 1){ this.afterTableListChange(); } + + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.assetTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } + + } } }, @@ -555,6 +563,7 @@ this.$delete("asset?ids=" + asset.id).then(response => { if (response.code === 200) { this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")}); + this.delFlag=true; this.getTableData() } else { this.$message.error(response.msg); @@ -593,6 +602,7 @@ this.rightBox.show = false; this.rightBox.batchShow = false; if (refresh) { + this.delFlag=true; this.getTableData() this.loadKeys(); } diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue index 6c02a7fa2..7b7a6ebd1 100644 --- a/nezha-fronted/src/components/page/config/account.vue +++ b/nezha-fronted/src/components/page/config/account.vue @@ -31,7 +31,7 @@ class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="account-add"> - + @@ -250,6 +250,7 @@ }, searchLabel: {}, //搜索参数 scrollbarWrap: null, + delFlag:false, } }, methods: { @@ -280,6 +281,8 @@ closeRightBox(refresh) { this.rightBox.show = false; if (refresh) { + this.delFlag=true; + this.delFlag=true; this.getTableData(); } }, @@ -301,6 +304,7 @@ }).then(() => { this.$delete("sys/user/delete?userIds=" + u.userId).then(response => { if (response.code === 200) { + this.delFlag=true; this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.getTableData(); } else { @@ -458,6 +462,13 @@ if (n.length === 0 && this.pageObj.pageNo > 1) { this.pageNo(this.pageObj.pageNo-1); } + + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.accountTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } + } } }, diff --git a/nezha-fronted/src/components/page/config/dc.vue b/nezha-fronted/src/components/page/config/dc.vue index aac61138a..2c2a91e86 100644 --- a/nezha-fronted/src/components/page/config/dc.vue +++ b/nezha-fronted/src/components/page/config/dc.vue @@ -17,7 +17,7 @@ class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="dc-add"> - + @@ -269,6 +269,7 @@ searchLabel: {}, //搜索参数 tabShow: 1, // 控制显示一级页面和二级页面 1 dc 2cabinet scrollbarWrap: null, + delFlag:false, } }, computed:{ @@ -366,6 +367,7 @@ closeDcBox(refresh) { this.rightBox.dc.show = false; if (refresh) { + this.delFlag=true; this.getTableData(); bus.$emit("dc-list-change"); } @@ -373,6 +375,7 @@ closeTrafficBox(refresh) { this.rightBox.trafficSetting.show = false; if (refresh) { + this.delFlag=true; this.getTableData(); } }, @@ -384,6 +387,7 @@ }).then(() => { this.$delete("idc?ids=" + u.id).then(response => { if (response.code === 200) { + this.delFlag=true; this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.getTableData(); bus.$emit("dc-list-change"); @@ -516,6 +520,12 @@ if (n.length === 0 && this.pageObj.pageNo > 1) { this.pageNo(this.pageObj.pageNo-1); } + + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.dcTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } } } }, diff --git a/nezha-fronted/src/components/page/config/menus.vue b/nezha-fronted/src/components/page/config/menus.vue index c9bf668dc..c6d4a0068 100644 --- a/nezha-fronted/src/components/page/config/menus.vue +++ b/nezha-fronted/src/components/page/config/menus.vue @@ -19,7 +19,7 @@ id="menus-add" type="button"> - + @@ -206,12 +206,14 @@ }, searchLabel: {}, //搜索参数 scrollbarWrap: null, + delFlag:false, } }, methods: { closeRightBox(refresh) { this.rightBox.show = false; if (refresh) { + this.delFlag=true; this.getTableData(); } }, @@ -233,6 +235,7 @@ }).then(() => { this.$delete("sys/menu?ids=" + u.id).then(response => { if (response.code === 200) { + this.delFlag=true; this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.getTableData(); } else { @@ -305,6 +308,24 @@ this.getTableData(); }, }, + watch:{ + tableData: { + deep: true, + handler(n) { + if (n.length === 0 && this.pageObj.pageNo > 1) { + this.pageNo(this.pageObj.pageNo-1); + } + + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.menusTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } + + + } + } + }, created(){ //是否存在分页缓存 let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId); diff --git a/nezha-fronted/src/components/page/config/mib.vue b/nezha-fronted/src/components/page/config/mib.vue index d2a63cafd..449a7b20a 100644 --- a/nezha-fronted/src/components/page/config/mib.vue +++ b/nezha-fronted/src/components/page/config/mib.vue @@ -22,7 +22,7 @@ - + @@ -205,6 +205,7 @@ }, searchLabel: {}, //搜索参数 scrollbarWrap: null, + delFlag:false, } }, methods: { @@ -218,6 +219,7 @@ closeRightBox(refresh) { this.rightBox.show = false; if (refresh) { + this.delFlag=true; this.getTableData(); } }, @@ -229,6 +231,7 @@ }).then(() => { this.$delete("mib?ids=" + u.id).then(response => { if (response.code === 200) { + this.delFlag=true; this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.getTableData(); } else { @@ -352,6 +355,11 @@ if (n.length === 0 && this.pageObj.pageNo > 1) { this.pageNo(this.pageObj.pageNo-1); } + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.mibTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } } } }, diff --git a/nezha-fronted/src/components/page/config/model.vue b/nezha-fronted/src/components/page/config/model.vue index de8af7e50..35ecd98a9 100644 --- a/nezha-fronted/src/components/page/config/model.vue +++ b/nezha-fronted/src/components/page/config/model.vue @@ -15,7 +15,7 @@ - + @@ -204,6 +204,7 @@ }, searchLabel: {}, //搜索参数 scrollbarWrap: null, + delFlag:false, } }, methods: { @@ -248,6 +249,7 @@ }).then(() => { this.$delete("model?ids=" + u.id).then(response => { if (response.code === 200) { + this.delFlag=true; this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.getTableData(); } else { @@ -266,6 +268,7 @@ closeRightBox(refresh) { this.rightBox.show = false; if (refresh) { + this.delFlag=true; this.getTableData(); } }, @@ -371,6 +374,11 @@ if (n.length === 0 && this.pageObj.pageNo > 1) { this.pageNo(this.pageObj.pageNo-1); } + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.modelTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } } } }, diff --git a/nezha-fronted/src/components/page/config/promServer.vue b/nezha-fronted/src/components/page/config/promServer.vue index 2e285393f..cd71a4e0e 100644 --- a/nezha-fronted/src/components/page/config/promServer.vue +++ b/nezha-fronted/src/components/page/config/promServer.vue @@ -16,7 +16,7 @@ class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="prom-add"> - + @@ -224,6 +224,7 @@ searchLabel: {}, //搜索参数 promServerType:null, scrollbarWrap: null, + delFlag:false, } }, methods: { @@ -276,6 +277,7 @@ }).then(() => { this.$delete("promServer?ids=" + u.id).then(response => { if (response.code === 200) { + this.delFlag=true; this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.getTableData(); } else { @@ -296,6 +298,7 @@ closeRightBox(refresh) { this.rightBox.show = false; if (refresh) { + this.delFlag=true; this.getTableData(); } }, @@ -451,6 +454,11 @@ if (n.length === 0 && this.pageObj.pageNo > 1) { this.pageNo(this.pageObj.pageNo-1); } + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.promTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } } } }, diff --git a/nezha-fronted/src/components/page/config/roles.vue b/nezha-fronted/src/components/page/config/roles.vue index 68d14313d..1035ef240 100644 --- a/nezha-fronted/src/components/page/config/roles.vue +++ b/nezha-fronted/src/components/page/config/roles.vue @@ -18,7 +18,7 @@ id="roles-add" type="button"> - + @@ -182,12 +182,14 @@ }, searchLabel: {}, //搜索参数 scrollbarWrap: null, + delFlag:false, } }, methods: { closeRightBox(refresh) { this.rightBox.show = false; if (refresh) { + this.delFlag=true; this.getTableData(); } }, @@ -210,6 +212,7 @@ }).then(() => { this.$delete("sys/role?ids=" + u.id).then(response => { if (response.code === 200) { + this.delFlag=true; this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")}); this.getTableData(); } else { @@ -300,6 +303,11 @@ if (n.length === 0 && this.pageObj.pageNo > 1) { this.pageNo(this.pageObj.pageNo-1); } + if(!this.delFlag){ // 不是删除时回到顶部 + this.$refs.rolesTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } } } }, diff --git a/nezha-fronted/src/components/page/project/project.vue b/nezha-fronted/src/components/page/project/project.vue index 7df17382a..1f0f182c3 100644 --- a/nezha-fronted/src/components/page/project/project.vue +++ b/nezha-fronted/src/components/page/project/project.vue @@ -49,7 +49,7 @@ - + @@ -379,7 +379,8 @@ readonly:true, }], }, - scrollbarWrap: null + scrollbarWrap: null, + delFlag:false, } }, methods:{ @@ -553,6 +554,7 @@ }).then(()=>{ this.$delete("endpoint?ids="+endpoint.id).then(response=>{ if(response.code===200){ + this.delFlag=true; this.$message({duration:1000,type:'success',message:this.$t("tip.deleteSuccess")}); this.getEndpointTableData(); }else{ @@ -842,6 +844,11 @@ if (n.length === 0 && this.endpointPageObj.pageNo > 1) { this.endpointPageNo(this.endpointPageObj.pageNo-1); } + if(!this.delFlag){ // 不是删除时回到顶部 以及修改时 + this.$refs.endpointTable.bodyWrapper.scrollTop = 0 + }else{ + this.delFlag=false; + } } } },