Commit 5d4673ac00019b89d86ba892277ecc6dc4857d66

Authored by xingyu
1 parent 7cabf0ea

fix: deptTree

yudao-ui-admin-vue3/src/views/system/dept/index.vue
... ... @@ -129,7 +129,7 @@ import { nextTick, onMounted, reactive, ref, unref } from 'vue'
129 129 import { useI18n } from '@/hooks/web/useI18n'
130 130 import { useMessage } from '@/hooks/web/useMessage'
131 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 133 import { modelSchema } from './dept.data'
134 134 import * as DeptApi from '@/api/system/dept'
135 135 import { getListSimpleUsersApi } from '@/api/system/user'
... ... @@ -171,9 +171,11 @@ const defaultProps = {
171 171 }
172 172 // 获取下拉框[上级]的数据
173 173 const getTree = async () => {
  174 + deptOptions.value = []
174 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 180 const getUserList = async () => {
179 181 const res = await getListSimpleUsersApi()
... ... @@ -225,8 +227,7 @@ const handleUpdate = async (rowId: number) => {
225 227 setDialogTile('update')
226 228 // 设置数据
227 229 const res = await DeptApi.getDeptApi(rowId)
228   - console.info(res)
229   - deptParentId.value = res.deptParentId
  230 + deptParentId.value = res.parentId
230 231 leaderUserId.value = res.leaderUserId
231 232 await nextTick()
232 233 unref(formRef)?.setValues(res)
... ...