fix:取消监听tableData 把回到顶部事件放入search 解决删除修改后也回到顶部的问题

This commit is contained in:
zhangyu
2020-11-17 09:05:43 +08:00
parent adeb7830cb
commit c4672ad61e
18 changed files with 60 additions and 84 deletions

View File

@@ -184,7 +184,7 @@
<el-dialog :visible.sync="deleteBox.show" :title="$t('alert.list.remark')" :modal-append-to-body='false' :show-close="true" width="450px" @close="closeDialog" class="nz-message"> <el-dialog :visible.sync="deleteBox.show" :title="$t('alert.list.remark')" :modal-append-to-body='false' :show-close="true" width="450px" @close="closeDialog" class="nz-message">
<div class="upload-body"> <div class="upload-body">
<el-form ref="remarkForm" :model="deleteBox"> <el-form ref="remarkForm" :model="deleteBox">
<el-form-item prop="remark"> <el-form-item prop="remark" :rules="[{required:true,message: $t('validate.required'), trigger: 'change'}]">
<el-input type="textarea" :placeholder="$t('alert.description')" v-model="deleteBox.remark"></el-input> <el-input type="textarea" :placeholder="$t('alert.description')" v-model="deleteBox.remark"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -829,11 +829,11 @@
} }
}, },
watch: { watch: {
tableData(){ /*tableData(){
if(this.$refs.alertListTable&&this.$refs.alertListTable.bodyWrapper){ if(this.$refs.alertListTable&&this.$refs.alertListTable.bodyWrapper){
this.$refs.alertListTable.bodyWrapper.scrollTop = 0; this.$refs.alertListTable.bodyWrapper.scrollTop = 0;
} }
}, },*/
showSubList(n) { showSubList(n) {
this.$bottomBoxWindow.showSubListWatch(vm, n); this.$bottomBoxWindow.showSubListWatch(vm, n);
}, },

View File

@@ -623,6 +623,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.alertMessageTable.$refs.alertListTable && this.$refs.alertMessageTable.$refs.alertListTable.bodyWrapper){
this.$refs.alertMessageTable.$refs.alertListTable.bodyWrapper.scrollTop = 0;
}
this.getAlertList(); this.getAlertList();
}, },
// 数据排序 // 数据排序
@@ -670,13 +673,6 @@
this.getAlertList(); this.getAlertList();
} }
}, },
tableData(){
if(this.$refs.alertMessageTable&&this.$refs.alertMessageTable.bodyWrapper){
this.$nextTick(()=>{
this.$refs.alertMessageTable.bodyWrapper.scrollTop = 0;
})
}
},
}, },
mounted() { mounted() {
//是否存在分页缓存 //是否存在分页缓存

View File

@@ -223,6 +223,9 @@
this.$set(this.searchLabel, item, searchObj[item]); this.$set(this.searchLabel, item, searchObj[item]);
} }
} }
if(this.$refs.cabTable&&this.$refs.cabTable.bodyWrapper){
this.$refs.cabTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
assetStatClassName(param) { assetStatClassName(param) {
@@ -260,11 +263,6 @@
} }
} }
}, },
tableData(){
if(this.$refs.cabTable&&this.$refs.cabTable.bodyWrapper){
this.$refs.cabTable.bodyWrapper.scrollTop = 0;
}
},
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {

View File

@@ -383,6 +383,9 @@
if(orderBy){ if(orderBy){
this.$set(this.endpointSearchLabel, 'orderBy', orderBy); this.$set(this.endpointSearchLabel, 'orderBy', orderBy);
} }
if(this.$refs.endpointTable&& this.$refs.endpointTable.bodyWrapper){
this.$refs.endpointTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
dateFormat(time) { dateFormat(time) {
@@ -477,11 +480,6 @@
} }
} }
}, },
tableData(){
if(this.$refs.endpointTable&& this.$refs.endpointTable.bodyWrapper){
this.$refs.endpointTable.bodyWrapper.scrollTop = 0;
}
},
}, },
mounted() { mounted() {
//初始化表头 //初始化表头

View File

@@ -201,11 +201,6 @@
'alertLabel':alertLabel, 'alertLabel':alertLabel,
}, },
watch:{ watch:{
tableData(){
if(this.$refs.alertListTable&&this.$refs.alertListTable.bodyWrapper){
this.$refs.alertListTable.bodyWrapper.scrollTop = 0;
}
},
}, },
computed: { computed: {
tagType() { tagType() {
@@ -478,6 +473,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.alertListTable&&this.$refs.alertListTable.bodyWrapper){
this.$refs.alertListTable.bodyWrapper.scrollTop = 0;
}
this.getAlertList(); this.getAlertList();
}, },

View File

@@ -124,11 +124,6 @@
'alertLabel':alertLabel, 'alertLabel':alertLabel,
}, },
watch:{ watch:{
tableData(){
if(this.$refs.assetTable&& this.$refs.assetTable.bodyWrapper){
this.$refs.assetTable.bodyWrapper.scrollTop = 0;
}
},
}, },
computed: { computed: {
tagType() { tagType() {
@@ -340,6 +335,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.assetTable&& this.$refs.assetTable.bodyWrapper){
this.$refs.assetTable.bodyWrapper.scrollTop = 0;
}
this.getAssetList(); this.getAssetList();
}, },
}, },

View File

@@ -115,11 +115,6 @@
'alertLabel':alertLabel, 'alertLabel':alertLabel,
}, },
watch:{ watch:{
tableData(){
if(this.$refs.endpointTable){
this.$refs.endpointTable.bodyWrapper.scrollTop = 0;
}
},
}, },
computed: { computed: {
tagType() { tagType() {
@@ -330,6 +325,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.endpointTable){
this.$refs.endpointTable.bodyWrapper.scrollTop = 0;
}
this.getEndpointList(); this.getEndpointList();
}, },
}, },

View File

@@ -246,6 +246,7 @@
this.topologyLoading=false; this.topologyLoading=false;
return arr1 return arr1
} }
let promiseArr=[];
arr.forEach((item,index)=>{ arr.forEach((item,index)=>{
item.shape='image'; item.shape='image';
item.id=item.moduleId; item.id=item.moduleId;
@@ -255,19 +256,6 @@
this.$get('/module/stat',{id:item.id}).then(res=>{ this.$get('/module/stat',{id:item.id}).then(res=>{
item.state=res.data; item.state=res.data;
// if(index===arr.length-1){ // if(index===arr.length-1){
// setTimeout(()=>{
// this.nodesArray=[...this.nodesArrayOther];
// this.edgesArray=[...this.edgesArrayOther];
// setTimeout(()=>{
// this.topologyLoading=false;
// this.$refs['topology'].setData();
// },500)
// })
// }
});
this.dealImg(`/project/topo/icon/${item.iconId}`).then((data)=>{
item.image=data;
if(index===arr.length-1){
setTimeout(()=>{ setTimeout(()=>{
this.nodesArray=[...this.nodesArrayOther]; this.nodesArray=[...this.nodesArrayOther];
this.edgesArray=[...this.edgesArrayOther]; this.edgesArray=[...this.edgesArrayOther];
@@ -276,7 +264,19 @@
this.$refs['topology'].setData(); this.$refs['topology'].setData();
},500) },500)
}) })
} // }
});
promiseArr.push( this.dealImg(`/project/topo/icon/${item.iconId}`))
});
Promise.all(promiseArr).then(res2=>{
res2.forEach((item,index)=>{
arr[index].image=item;
});
setTimeout(()=>{
this.nodesArray=[...this.nodesArrayOther];
this.edgesArray=[...this.edgesArrayOther];
this.topologyLoading=false;
this.$refs['topology'].setData();
}) })
}); });
return arr return arr

View File

@@ -408,6 +408,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.alertRuleTable && this.$refs.alertRuleTable.bodyWrapper){
this.$refs.alertRuleTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
// 全屏 // 全屏

View File

@@ -613,6 +613,7 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
this.$refs.alertMessageTable.$refs.alertListTable.bodyWrapper.scrollTop = 0;
this.getAlertList(); this.getAlertList();
}, },
viewRule: function (id) { viewRule: function (id) {

View File

@@ -428,11 +428,6 @@
} }
} }
}, },
tableData(){
if(this.$refs.assetTable&&this.$refs.assetTable.bodyWrapper){
this.$refs.assetTable.bodyWrapper.scrollTop = 0;
}
},
}, },
methods: { methods: {
fullScreen() { fullScreen() {
@@ -631,6 +626,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.assetTable&&this.$refs.assetTable.bodyWrapper){
this.$refs.assetTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
convertToDetail(obj) { convertToDetail(obj) {

View File

@@ -325,6 +325,9 @@
this.$set(this.searchLabel, item, searchObj[item]); this.$set(this.searchLabel, item, searchObj[item]);
} }
} }
if(this.$refs.accountTable){
this.$refs.accountTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
// 数据排序 // 数据排序
@@ -358,11 +361,6 @@
let vm = this; let vm = this;
this.$bottomBoxWindow.showSubListWatch(vm, n); this.$bottomBoxWindow.showSubListWatch(vm, n);
}, },
tableData(n){
if(this.$refs.accountTable){
this.$refs.accountTable.bodyWrapper.scrollTop = 0;
}
},
}, },
mounted() { mounted() {
//初始化表头 //初始化表头

View File

@@ -441,6 +441,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.dcTable&&this.$refs.dcTable.bodyWrapper){
this.$refs.dcTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
showCabinet(dc) { showCabinet(dc) {
@@ -488,11 +491,6 @@
let vm = this; let vm = this;
this.$bottomBoxWindow.showSubListWatch(vm, n); this.$bottomBoxWindow.showSubListWatch(vm, n);
}, },
tableData(){
if(this.$refs.dcTable&&this.$refs.dcTable.bodyWrapper){
this.$refs.dcTable.bodyWrapper.scrollTop = 0;
}
},
}, },
destroyed() { destroyed() {
window.onresize = null; window.onresize = null;

View File

@@ -292,6 +292,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.mibTable&&this.$refs.mibTable.bodyWrapper){
this.$refs.mibTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
downloadMib(mib) { downloadMib(mib) {

View File

@@ -315,6 +315,9 @@
if(orderBy) { if(orderBy) {
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.modelTable&&this.$refs.modelTable.bodyWrapper){
this.$refs.modelTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
// 数据排序 // 数据排序
@@ -368,11 +371,6 @@
let vm = this; let vm = this;
this.$bottomBoxWindow.showSubListWatch(vm, n); this.$bottomBoxWindow.showSubListWatch(vm, n);
}, },
tableData(){
if(this.$refs.modelTable&&this.$refs.modelTable.bodyWrapper){
this.$refs.modelTable.bodyWrapper.scrollTop = 0;
}
},
} }
} }
</script> </script>

View File

@@ -359,6 +359,9 @@
if(orderBy){ if(orderBy){
this.$set(this.searchLabel, 'orderBy', orderBy); this.$set(this.searchLabel, 'orderBy', orderBy);
} }
if(this.$refs.promTable&&this.$refs.promTable.bodyWrapper){
this.$refs.promTable.bodyWrapper.scrollTop = 0;
}
this.getTableData(); this.getTableData();
}, },
//获取dc数据 //获取dc数据
@@ -444,11 +447,6 @@
let vm = this; let vm = this;
this.$bottomBoxWindow.showSubListWatch(vm, n); this.$bottomBoxWindow.showSubListWatch(vm, n);
}, },
tableData(){
if(this.$refs.promTable&&this.$refs.promTable.bodyWrapper){
this.$refs.promTable.bodyWrapper.scrollTop = 0;
}
},
} }
} }
</script> </script>

View File

@@ -285,11 +285,6 @@
}, },
}, },
watch:{ watch:{
tableData(){
if(this.$refs.terminalLogTablethis.$refs.terminalLogTable.bodyWrapper){
this.$refs.terminalLogTable.bodyWrapper.scrollTop = 0;
}
},
}, },
mounted() { mounted() {
//初始化表头 //初始化表头

View File

@@ -578,6 +578,9 @@
if(orderBy){ if(orderBy){
this.$set(this.endpointSearchLabel,'orderBy',orderBy); this.$set(this.endpointSearchLabel,'orderBy',orderBy);
} }
if(this.$refs.endpointTable&&this.$refs.endpointTable.bodyWrapper){
this.$refs.endpointTable.bodyWrapper.scrollTop = 0;
}
this.getEndpointTableData(); this.getEndpointTableData();
}, },
@@ -837,11 +840,6 @@
}); });
} }
}, },
endpointTableData(){
if(this.$refs.endpointTable&&this.$refs.endpointTable.bodyWrapper){
this.$refs.endpointTable.bodyWrapper.scrollTop = 0;
}
},
}, },
destroyed(){ destroyed(){
window.onresize=null; window.onresize=null;