优化:删除时先取消选择,再移除选中的项

This commit is contained in:
jmal 2020-05-20 14:22:01 +08:00
parent b4405aec55
commit d11650d343

View File

@ -2295,17 +2295,27 @@
fileIds: fileIds fileIds: fileIds
}).then(() => { }).then(() => {
// 移除列表 // 移除列表
let removeFileIndexList = []
if(this.$refs.fileListTable.tableSelectData.length > 0){ if(this.$refs.fileListTable.tableSelectData.length > 0){
this.$refs.fileListTable.tableSelectData.forEach(item => { this.$refs.fileListTable.tableSelectData.forEach(item => {
let fileIndex = this.fileList.findIndex(file => file.id === item.id) let fileIndex = this.fileList.findIndex(file => file.id === item.id)
if(fileIndex > -1){ if(fileIndex > -1){
this.fileList.splice(fileIndex,1) removeFileIndexList.push(fileIndex)
} }
}) })
} }
// 先清空之前选择的数据
this.$refs.fileListTable.doLayout() this.$refs.fileListTable.doLayout()
this.$refs.fileListTable.clearSelection()// 删除后清空之前选择的数据 this.$refs.fileListTable.clearSelection()
this.$refs.fileListTable.tableSelectData = [] this.$refs.fileListTable.tableSelectData = []
const that = this
setTimeout(function () {
// 再执行移除
removeFileIndexList.forEach(fileIndex => {
that.fileList.splice(fileIndex,1)
})
},300)
}).then(()=>{ }).then(()=>{
this.$notify({ this.$notify({
title: '删除成功', title: '删除成功',