diff --git a/src/components.d.ts b/src/components.d.ts index 558b652..ed47866 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -28,6 +28,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectTree: typeof import('./components/SelectTree/index.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] SystemInfo: typeof import('./components/SystemInfo/index.vue')['default'] TableContainer: typeof import('./components/TableContainer/index.vue')['default'] diff --git a/src/components.d.ts b/src/components.d.ts index 558b652..ed47866 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -28,6 +28,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectTree: typeof import('./components/SelectTree/index.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] SystemInfo: typeof import('./components/SystemInfo/index.vue')['default'] TableContainer: typeof import('./components/TableContainer/index.vue')['default'] diff --git a/src/components/SelectTree/index.vue b/src/components/SelectTree/index.vue new file mode 100644 index 0000000..98c86df --- /dev/null +++ b/src/components/SelectTree/index.vue @@ -0,0 +1,181 @@ + + + + + + + + + + diff --git a/src/components.d.ts b/src/components.d.ts index 558b652..ed47866 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -28,6 +28,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectTree: typeof import('./components/SelectTree/index.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] SystemInfo: typeof import('./components/SystemInfo/index.vue')['default'] TableContainer: typeof import('./components/TableContainer/index.vue')['default'] diff --git a/src/components/SelectTree/index.vue b/src/components/SelectTree/index.vue new file mode 100644 index 0000000..98c86df --- /dev/null +++ b/src/components/SelectTree/index.vue @@ -0,0 +1,181 @@ + + + + + + + + + + diff --git a/src/views/system/user/select.tree.vue b/src/views/system/user/select.tree.vue index 9d0e751..141d7ac 100644 --- a/src/views/system/user/select.tree.vue +++ b/src/views/system/user/select.tree.vue @@ -72,7 +72,7 @@ const treeSelect = ref(null) const nodeClick = (data: TreeNodeData, node: TreeNode) => { select.currentNodeKey = data.id - select.currentNodeLabel = data.label + select.currentNodeLabel = data.label || data.name select.value = data.id; (treeSelect.value as any).blur() emit('update:modelValue', select.value) diff --git a/src/components.d.ts b/src/components.d.ts index 558b652..ed47866 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -28,6 +28,7 @@ SearchArea: typeof import('./components/SearchArea/index.vue')['default'] SearchBar: typeof import('./components/SearchBar/index.vue')['default'] SearchItem: typeof import('./components/SearchArea/SearchItem.vue')['default'] + SelectTree: typeof import('./components/SelectTree/index.vue')['default'] SvgIcon: typeof import('./components/SvgIcon/index.vue')['default'] SystemInfo: typeof import('./components/SystemInfo/index.vue')['default'] TableContainer: typeof import('./components/TableContainer/index.vue')['default'] diff --git a/src/components/SelectTree/index.vue b/src/components/SelectTree/index.vue new file mode 100644 index 0000000..98c86df --- /dev/null +++ b/src/components/SelectTree/index.vue @@ -0,0 +1,181 @@ + + + + + + + + + + diff --git a/src/views/system/user/select.tree.vue b/src/views/system/user/select.tree.vue index 9d0e751..141d7ac 100644 --- a/src/views/system/user/select.tree.vue +++ b/src/views/system/user/select.tree.vue @@ -72,7 +72,7 @@ const treeSelect = ref(null) const nodeClick = (data: TreeNodeData, node: TreeNode) => { select.currentNodeKey = data.id - select.currentNodeLabel = data.label + select.currentNodeLabel = data.label || data.name select.value = data.id; (treeSelect.value as any).blur() emit('update:modelValue', select.value) diff --git a/src/views/system/user/user.add.vue b/src/views/system/user/user.add.vue index 10b37e6..43547ea 100644 --- a/src/views/system/user/user.add.vue +++ b/src/views/system/user/user.add.vue @@ -5,6 +5,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import { addUser, updateUser } from '@/api/system/user' import { getRoleTreeList } from '@/api/system/role' +import { getDeptTreeList } from '@/api/system/dept' import type { addInfo } from './user_interface' import { getDictByCode } from '@/api/system/dict' import { RSAencrypt } from '@/utils/security' @@ -33,6 +34,7 @@ }) const emits = defineEmits(['resetData']) const roleTreeList = ref([])// 角色树列表数据 +const deptTreeList = ref([]) const sexList = ref([])// 性别选项 const textMap = reactive<{ update: string; create: string }>({ update: '编辑用户', @@ -87,6 +89,7 @@ sexList.value = response.data }) fetchRoleTree() + fetchDeptTree() dialogStatus.value = dialogStatusflag dialogFormVisible.value = true btnLoading.value = false @@ -129,6 +132,14 @@ } }) } +// 加载组织机构树形下拉 +const fetchDeptTree = () => { + getDeptTreeList().then((res) => { + if (res.data) { // 将列表转树结构 + deptTreeList.value = toTreeList(res.data, '0', true) + } + }) +} // 重置表单 const resetForm1 = () => { userForm.account = '' @@ -263,8 +274,10 @@ - + +