fix:修改所有表格翻页后不回到顶部的问题 并且保证删除修改后滚动条位置不变

This commit is contained in:
zhangyu
2020-12-31 17:41:40 +08:00
parent b267dfa3f3
commit 62f88ebf6c
12 changed files with 125 additions and 13 deletions

View File

@@ -21,7 +21,7 @@
<button :title="$t('overall.batchEdit')" @click.stop="batchEdit" class="nz-btn nz-btn-size-normal nz-btn-style-light" id="asset-batch-asset" style="margin-left: 15px" v-has="'asset_toBatchEdit'">
<i class="nz-icon nz-icon-batch-edit"></i>
</button>
<delete-button :delete-objs="batchDeleteObjs" @after="getTableData" api="asset" v-has="'asset_delete'"></delete-button>
<delete-button :delete-objs="batchDeleteObjs" @after="getTableData" @before="delFlag=true" api="asset" v-has="'asset_delete'"></delete-button>
</div>
<div class="pagination-top pagination-top-hide display-none"></div>
</div>
@@ -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();
}