diff --git a/src/pages/chooseByDeps/index.vue b/src/pages/chooseByDeps/index.vue
index 209076a..dc18c99 100644
--- a/src/pages/chooseByDeps/index.vue
+++ b/src/pages/chooseByDeps/index.vue
@@ -402,10 +402,15 @@
class="flex flex-col"
>
-
+
@@ -465,6 +470,7 @@ const {
crumbsIndex,
depCheckedKeys,
getDepMembers,
+ memberDepCheckedKeys,
membersCheckedKeys,
allChooseMembers,
} = useGroupTypeStore()
@@ -851,14 +857,18 @@ const handleConfirm = async () => {
})
if (res.status == 0 && res.data?.data?.length) {
res.data?.data.forEach((v) => {
- listT.push(v)
+ // 检查是否已存在相同 ID 的成员
+ if (!listT.some((item) => item.ID === v.ID)) {
+ listT.push(v)
+ }
})
}
}
allChooseMembers.value = listT
+ memberDepCheckedKeys.value = lodash.cloneDeep(allCheckedList.value) // 存储人员选择模式下的部门
+ } else {
+ depCheckedKeys.value = lodash.cloneDeep(allCheckedList.value) // 存储部门选择模式下的部门
}
- depCheckedKeys.value = lodash.cloneDeep(allCheckedList.value)
- console.log('depCheckedKeys', depCheckedKeys.value)
uni.navigateBack()
}
@@ -897,8 +907,8 @@ const init = async () => {
}
if (state.chooseMode === 2) {
- // 恢复部门选中状态,但只显示父部门
- depCheckedKeys.value.forEach((item) => {
+ // 恢复人员选择模式下的部门状态,但只显示父部门
+ memberDepCheckedKeys.value.forEach((item) => {
const node = findNodeById(depTreeMyList.value[0], item.ID)
if (node) {
node.checkStatus = 'checked'
diff --git a/src/store/groupType/index.js b/src/store/groupType/index.js
index 1fe7362..bbb9944 100644
--- a/src/store/groupType/index.js
+++ b/src/store/groupType/index.js
@@ -22,8 +22,9 @@ export const useGroupTypeStore = createGlobalState(() => {
const departmentAllPositions = ref([]) //部门下所有岗位
const crumbs = ref([])
const crumbsIndex = ref(0)
- const depCheckedKeys = ref([]) // 选中的部门keys
+ const depCheckedKeys = ref([]) // 部门选择模式下,选中的部门keys
const groupAdmins = ref([]) // 选中的管理员
+ const memberDepCheckedKeys = ref([]) // 人员选择模式下,选中的部门keys
const membersCheckedKeys = ref([]) // 选中的人员keys
const allChooseMembers = ref([])
@@ -63,6 +64,7 @@ export const useGroupTypeStore = createGlobalState(() => {
crumbsIndex.value = 0
depCheckedKeys.value = []
groupAdmins.value = []
+ memberDepCheckedKeys.value = []
membersCheckedKeys.value = []
allChooseMembers.value = []
}
@@ -132,6 +134,7 @@ export const useGroupTypeStore = createGlobalState(() => {
createDepGroup,
getDepMembers,
membersCheckedKeys,
+ memberDepCheckedKeys,
allChooseMembers,
getDepartmentPositionsById,
}