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