Commit 5d4673ac00019b89d86ba892277ecc6dc4857d66
1 parent
7cabf0ea
fix: deptTree
Showing
1 changed file
with
6 additions
and
5 deletions
yudao-ui-admin-vue3/src/views/system/dept/index.vue
| @@ -129,7 +129,7 @@ import { nextTick, onMounted, reactive, ref, unref } from 'vue' | @@ -129,7 +129,7 @@ import { nextTick, onMounted, reactive, ref, unref } from 'vue' | ||
| 129 | import { useI18n } from '@/hooks/web/useI18n' | 129 | import { useI18n } from '@/hooks/web/useI18n' |
| 130 | import { useMessage } from '@/hooks/web/useMessage' | 130 | import { useMessage } from '@/hooks/web/useMessage' |
| 131 | import { ElForm, ElFormItem, ElInput, ElSelect, ElTreeSelect, ElOption } from 'element-plus' | 131 | import { ElForm, ElFormItem, ElInput, ElSelect, ElTreeSelect, ElOption } from 'element-plus' |
| 132 | -import { VxeColumn, VxeTable, VxeTableInstance, VxeToolbar } from 'vxe-table' | 132 | +import { VxeTableInstance } from 'vxe-table' |
| 133 | import { modelSchema } from './dept.data' | 133 | import { modelSchema } from './dept.data' |
| 134 | import * as DeptApi from '@/api/system/dept' | 134 | import * as DeptApi from '@/api/system/dept' |
| 135 | import { getListSimpleUsersApi } from '@/api/system/user' | 135 | import { getListSimpleUsersApi } from '@/api/system/user' |
| @@ -171,9 +171,11 @@ const defaultProps = { | @@ -171,9 +171,11 @@ const defaultProps = { | ||
| 171 | } | 171 | } |
| 172 | // 获取下拉框[上级]的数据 | 172 | // 获取下拉框[上级]的数据 |
| 173 | const getTree = async () => { | 173 | const getTree = async () => { |
| 174 | + deptOptions.value = [] | ||
| 174 | const res = await DeptApi.listSimpleDeptApi() | 175 | const res = await DeptApi.listSimpleDeptApi() |
| 175 | - deptOptions.value = handleTree(res) | ||
| 176 | - console.info(deptOptions.value) | 176 | + let dept: Tree = { id: 0, name: '顶级部门', children: [] } |
| 177 | + dept.children = handleTree(res) | ||
| 178 | + deptOptions.value.push(dept) | ||
| 177 | } | 179 | } |
| 178 | const getUserList = async () => { | 180 | const getUserList = async () => { |
| 179 | const res = await getListSimpleUsersApi() | 181 | const res = await getListSimpleUsersApi() |
| @@ -225,8 +227,7 @@ const handleUpdate = async (rowId: number) => { | @@ -225,8 +227,7 @@ const handleUpdate = async (rowId: number) => { | ||
| 225 | setDialogTile('update') | 227 | setDialogTile('update') |
| 226 | // 设置数据 | 228 | // 设置数据 |
| 227 | const res = await DeptApi.getDeptApi(rowId) | 229 | const res = await DeptApi.getDeptApi(rowId) |
| 228 | - console.info(res) | ||
| 229 | - deptParentId.value = res.deptParentId | 230 | + deptParentId.value = res.parentId |
| 230 | leaderUserId.value = res.leaderUserId | 231 | leaderUserId.value = res.leaderUserId |
| 231 | await nextTick() | 232 | await nextTick() |
| 232 | unref(formRef)?.setValues(res) | 233 | unref(formRef)?.setValues(res) |