|
|
|
@ -2556,6 +2556,14 @@ |
|
|
|
this.chooseItemList = [] |
|
|
|
this.chooseItemList2 = [] |
|
|
|
this.chooseCSItemList = [] |
|
|
|
// 清空 DelegateAccess 的选择(delegateAccessName 是计算属性会自动清空) |
|
|
|
this.selectionDelegateAccess = [] |
|
|
|
this.selectionDelegateAccess2 = [] |
|
|
|
this.baseDelegateAccessList = [] |
|
|
|
this.changeDelegateAccess = { |
|
|
|
delegateAccess: '', |
|
|
|
delegateAccessName: '', |
|
|
|
} |
|
|
|
this.getDepartmentByUserName() |
|
|
|
this.getEcnTypeData() // 获取ECN种类 |
|
|
|
this.chooseDataList = data.rows.chooseDataList |
|
|
|
@ -3357,6 +3365,7 @@ |
|
|
|
searchDelegateAccessByUser(params).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.baseDelegateAccessList = data.rows; |
|
|
|
// 不清空选中状态,依赖 :reserve-selection 保留之前的选择 |
|
|
|
} else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
@ -3366,8 +3375,25 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
handleSelectionChange(val) { |
|
|
|
// 获得选中的 用户 |
|
|
|
this.selectionDelegateAccess2 = val; |
|
|
|
// val 只包含当前数据源中被选中的行 |
|
|
|
// 需要合并历史选择(selectionDelegateAccess)中不在当前数据源的人员 |
|
|
|
|
|
|
|
// 当前数据源中的所有人员编码 |
|
|
|
let currentDataKeys = this.baseDelegateAccessList.map(item => item.delegateAccess); |
|
|
|
|
|
|
|
// 保留历史选择中不在当前数据源的人员(这些人员用户无法在当前对话框中取消选择) |
|
|
|
let historyNotInCurrent = this.selectionDelegateAccess.filter(item => |
|
|
|
!currentDataKeys.includes(item.delegateAccess) |
|
|
|
); |
|
|
|
|
|
|
|
// 合并:历史人员(不在当前数据源)+ 当前选中的人员 |
|
|
|
let merged = [...historyNotInCurrent, ...val]; |
|
|
|
|
|
|
|
// 去重(虽然理论上不会重复) |
|
|
|
let map = new Map(); |
|
|
|
merged.forEach(item => map.set(item.delegateAccess, item)); |
|
|
|
|
|
|
|
this.selectionDelegateAccess2 = Array.from(map.values()); |
|
|
|
}, |
|
|
|
|
|
|
|
handleTableClick(row, column, event, val) { |
|
|
|
@ -3376,15 +3402,19 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
openDelegateAccess() { |
|
|
|
let rows = JSON.parse(JSON.stringify(this.selectionDelegateAccess)) |
|
|
|
if (rows && rows.length > 0) { |
|
|
|
this.$nextTick(() => { |
|
|
|
// 恢复已确认选中的人员状态(仅限当前列表中存在的) |
|
|
|
// 不清空选中状态,让 :reserve-selection 自动保留之前的选择 |
|
|
|
this.$nextTick(() => { |
|
|
|
let rows = JSON.parse(JSON.stringify(this.selectionDelegateAccess)) |
|
|
|
if (rows && rows.length > 0 && this.$refs.delegateAccesstTable) { |
|
|
|
rows.forEach(item => { |
|
|
|
let row = this.baseDelegateAccessList.find(row => row.delegateAccess === item.delegateAccess); |
|
|
|
this.$refs.delegateAccesstTable.toggleRowSelection(row); |
|
|
|
if (row) { // 只对当前列表中存在的行进行选中操作 |
|
|
|
this.$refs.delegateAccesstTable.toggleRowSelection(row, true); // 明确设置为选中状态 |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
closeDelegateAccess() { |
|
|
|
@ -3392,6 +3422,8 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
confirmDelegateAccess() { |
|
|
|
// selectionDelegateAccess2 已经在 handleSelectionChange 中合并了历史选择 |
|
|
|
// 直接保存即可 |
|
|
|
this.selectionDelegateAccess = JSON.parse(JSON.stringify(this.selectionDelegateAccess2)) |
|
|
|
this.delegateAccessVisible = false; |
|
|
|
}, |
|
|
|
|