Showing
1 changed file
with
13 additions
and
1 deletions
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | v-model:value="model[field]" | 14 | v-model:value="model[field]" |
15 | :treeData="organizationTreeData" | 15 | :treeData="organizationTreeData" |
16 | :checked-keys="checkGroup" | 16 | :checked-keys="checkGroup" |
17 | - default-expand-all | 17 | + :expandedKeys="treeExpandData" |
18 | ref="basicTreeRef" | 18 | ref="basicTreeRef" |
19 | checkable | 19 | checkable |
20 | toolbar | 20 | toolbar |
@@ -46,6 +46,7 @@ | @@ -46,6 +46,7 @@ | ||
46 | const organizationTreeData = ref<TreeItem[]>([]); | 46 | const organizationTreeData = ref<TreeItem[]>([]); |
47 | const basicTreeRef = ref(); | 47 | const basicTreeRef = ref(); |
48 | const checkGroup = ref<string[]>([]); | 48 | const checkGroup = ref<string[]>([]); |
49 | + const treeExpandData = ref([]); | ||
49 | const olderPhoneNumber = ref(); | 50 | const olderPhoneNumber = ref(); |
50 | const postData = reactive({}); | 51 | const postData = reactive({}); |
51 | const singleEditPostPhoneNumber = reactive({ | 52 | const singleEditPostPhoneNumber = reactive({ |
@@ -63,6 +64,13 @@ | @@ -63,6 +64,13 @@ | ||
63 | span: 18, | 64 | span: 18, |
64 | }, | 65 | }, |
65 | }); | 66 | }); |
67 | + //获取所有父级id | ||
68 | + function findForAllId(data = [], arr = []) { | ||
69 | + for (const item of data) { | ||
70 | + arr.push(item.id); | ||
71 | + } | ||
72 | + return arr; | ||
73 | + } | ||
66 | 74 | ||
67 | const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { | 75 | const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { |
68 | await resetFields(); | 76 | await resetFields(); |
@@ -72,6 +80,9 @@ | @@ -72,6 +80,9 @@ | ||
72 | if (!unref(organizationTreeData).length) { | 80 | if (!unref(organizationTreeData).length) { |
73 | copyTransTreeFun(groupListModel); | 81 | copyTransTreeFun(groupListModel); |
74 | organizationTreeData.value = groupListModel; | 82 | organizationTreeData.value = groupListModel; |
83 | + const getAllIds = findForAllId(organizationTreeData.value as any, []); | ||
84 | + //设置要展开的id | ||
85 | + treeExpandData.value = getAllIds; | ||
75 | } | 86 | } |
76 | if (unref(isUpdate)) { | 87 | if (unref(isUpdate)) { |
77 | rowId.value = data.record.id; | 88 | rowId.value = data.record.id; |
@@ -149,6 +160,7 @@ | @@ -149,6 +160,7 @@ | ||
149 | organizationTreeData, | 160 | organizationTreeData, |
150 | checkGroup, | 161 | checkGroup, |
151 | basicTreeRef, | 162 | basicTreeRef, |
163 | + treeExpandData, | ||
152 | }; | 164 | }; |
153 | }, | 165 | }, |
154 | }); | 166 | }); |