|
38 | 38 | <template #default="{ node, data }"> |
39 | 39 | <div class="custom-tree-node flex"> |
40 | 40 | <el-icon size="28"> |
41 | | - <avatar_organize v-if="Array.isArray(data.children)"></avatar_organize> |
| 41 | + <avatar_organize v-if="!data.options.is_user"></avatar_organize> |
42 | 42 | <avatar_personal v-else></avatar_personal> |
43 | 43 | </el-icon> |
44 | 44 | <span class="ml-8 ellipsis" style="max-width: 40%" :title="node.label"> |
@@ -160,17 +160,26 @@ const filterNode: FilterNodeMethodFunction = (value: string, data: any) => { |
160 | 160 | } |
161 | 161 |
|
162 | 162 | function isLeafNode(node: any) { |
163 | | - return !Array.isArray(node.children) |
| 163 | + return node.options.is_user |
164 | 164 | } |
165 | 165 |
|
166 | 166 | const handleCheck = () => { |
167 | | - checkTableList.value = organizationUserRef.value |
168 | | - .getCheckedNodes() |
169 | | - .filter((ele: any) => isLeafNode(ele)) |
| 167 | + const userList = organizationUserRef.value.getCheckedNodes() |
| 168 | + let idArr = [...new Set(userList.map((ele: any) => ele.id))] |
| 169 | +
|
| 170 | + checkTableList.value = userList |
| 171 | + .filter((ele: any) => { |
| 172 | + if (idArr.includes(ele.id) && isLeafNode(ele)) { |
| 173 | + idArr = idArr.filter((itx: any) => itx !== ele.id) |
| 174 | + return true |
| 175 | + } |
| 176 | + return false |
| 177 | + }) |
170 | 178 | .map((ele: any) => ({ |
171 | 179 | name: ele.name, |
172 | 180 | id: ele.id, |
173 | 181 | account: ele.id, |
| 182 | + email: ele.options.email, |
174 | 183 | })) |
175 | 184 | } |
176 | 185 |
|
@@ -214,7 +223,11 @@ const emits = defineEmits(['refresh']) |
214 | 223 | const handleConfirm = () => { |
215 | 224 | modelApi |
216 | 225 | .userSync({ |
217 | | - user_list: checkTableList.value.map((ele: any) => ({ id: ele.id, name: ele.name })), |
| 226 | + user_list: checkTableList.value.map((ele: any) => ({ |
| 227 | + id: ele.id, |
| 228 | + name: ele.name, |
| 229 | + email: ele.email || '', |
| 230 | + })), |
218 | 231 | origin: oid, |
219 | 232 | cover: existingUser.value, |
220 | 233 | }) |
|
0 commit comments