[update] 选择用户组件全选在原来选中的数据上追加
This commit is contained in:
@@ -241,13 +241,23 @@ export default {
|
|||||||
params.order = 'desc'
|
params.order = 'desc'
|
||||||
getAction(this.url.userList, params).then(res => {
|
getAction(this.url.userList, params).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.dataSourceRight = res.result.records || []
|
const arr = this.uniqueByKey([...res.result.records || [], ...this.dataSourceRight || []], 'contactId')
|
||||||
this.selectedRowKeys = (res.result.records || []).map(item => item.contactId)
|
this.dataSourceRight = Array.from(arr)
|
||||||
|
this.selectedRowKeys = Array.from(arr).map(item => item.contactId)
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.loadingLeft = false
|
this.loadingLeft = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 根据某个字段对对象数组去重
|
||||||
|
uniqueByKey (arr, key) {
|
||||||
|
const map = arr.reduce((acc, obj) => {
|
||||||
|
const keyValue = obj[key]
|
||||||
|
acc[keyValue] = obj
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
return Object.values(map)
|
||||||
|
},
|
||||||
// 获取当前查询条件的所有数据
|
// 获取当前查询条件的所有数据
|
||||||
async getCurrentAllData () {
|
async getCurrentAllData () {
|
||||||
const params = Object.assign({}, this.queryParam)
|
const params = Object.assign({}, this.queryParam)
|
||||||
|
|||||||
@@ -271,13 +271,23 @@ export default {
|
|||||||
params.order = 'desc'
|
params.order = 'desc'
|
||||||
getAction(this.url.userList, params).then(res => {
|
getAction(this.url.userList, params).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.dataSourceRight = res.result.records || []
|
const arr = this.uniqueByKey([...res.result.records || [], ...this.dataSourceRight || []], 'id')
|
||||||
this.selectedRowKeys = (res.result.records || []).map(item => item.id)
|
this.dataSourceRight = Array.from(arr)
|
||||||
|
this.selectedRowKeys = Array.from(arr).map(item => item.id)
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.loadingLeft = false
|
this.loadingLeft = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 根据某个字段对对象数组去重
|
||||||
|
uniqueByKey (arr, key) {
|
||||||
|
const map = arr.reduce((acc, obj) => {
|
||||||
|
const keyValue = obj[key]
|
||||||
|
acc[keyValue] = obj
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
return Object.values(map)
|
||||||
|
},
|
||||||
// 获取当前查询条件的所有数据
|
// 获取当前查询条件的所有数据
|
||||||
async getCurrentAllData () {
|
async getCurrentAllData () {
|
||||||
const params = Object.assign({}, this.queryParam)
|
const params = Object.assign({}, this.queryParam)
|
||||||
|
|||||||
@@ -340,13 +340,23 @@ export default {
|
|||||||
params.pageSize = this.ipagination.total + 10
|
params.pageSize = this.ipagination.total + 10
|
||||||
getAction(this.url.userList, params).then(res => {
|
getAction(this.url.userList, params).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.dataSourceRight = res.result.records || []
|
const arr = this.uniqueByKey([...res.result.records || [], ...this.dataSourceRight || []], 'userId')
|
||||||
this.selectedRowKeys = (res.result.records || []).map(item => item.userId)
|
this.dataSourceRight = Array.from(arr)
|
||||||
|
this.selectedRowKeys = Array.from(arr).map(item => item.userId)
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.loadingLeft = false
|
this.loadingLeft = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 根据某个字段对对象数组去重
|
||||||
|
uniqueByKey (arr, key) {
|
||||||
|
const map = arr.reduce((acc, obj) => {
|
||||||
|
const keyValue = obj[key]
|
||||||
|
acc[keyValue] = obj
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
return Object.values(map)
|
||||||
|
},
|
||||||
// 获取当前查询条件的所有数据
|
// 获取当前查询条件的所有数据
|
||||||
async getCurrentAllData () {
|
async getCurrentAllData () {
|
||||||
const params = Object.assign({}, this.queryParam)
|
const params = Object.assign({}, this.queryParam)
|
||||||
|
|||||||
@@ -290,14 +290,24 @@ export default {
|
|||||||
params.order = 'desc'
|
params.order = 'desc'
|
||||||
getAction(this.url.userList, params).then(res => {
|
getAction(this.url.userList, params).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.dataSourceRight = res.result.records || []
|
const arr = this.uniqueByKey([...res.result.records || [], ...this.dataSourceRight || []], 'id')
|
||||||
this.selectedRowKeys = (res.result.records || []).map(item => item.id)
|
this.dataSourceRight = Array.from(arr)
|
||||||
|
this.selectedRowKeys = Array.from(arr).map(item => item.id)
|
||||||
this.oldTotal = res.result.total
|
this.oldTotal = res.result.total
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.loadingLeft = false
|
this.loadingLeft = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 根据某个字段对对象数组去重
|
||||||
|
uniqueByKey (arr, key) {
|
||||||
|
const map = arr.reduce((acc, obj) => {
|
||||||
|
const keyValue = obj[key]
|
||||||
|
acc[keyValue] = obj
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
return Object.values(map)
|
||||||
|
},
|
||||||
// 获取当前查询条件的所有数据
|
// 获取当前查询条件的所有数据
|
||||||
async getCurrentAllData () {
|
async getCurrentAllData () {
|
||||||
const params = Object.assign({}, this.queryParam)
|
const params = Object.assign({}, this.queryParam)
|
||||||
|
|||||||
Reference in New Issue
Block a user