From 00515c683cd88832c8b0bb8c64c215153b63a9ab Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Fri, 10 Jan 2025 21:37:09 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=A8=A1=E5=9D=97):=20=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E9=83=A8=E9=97=A8=E6=A0=91=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vite.config.dev.ts | 3 +- src/api/dept.ts | 6 + .../system/user/components/dept-tree.vue | 110 ++++ .../system/user/components/user-edit.vue | 6 +- src/views/system/user/index.vue | 471 ++++++++++-------- 5 files changed, 381 insertions(+), 215 deletions(-) create mode 100644 src/views/system/user/components/dept-tree.vue diff --git a/config/vite.config.dev.ts b/config/vite.config.dev.ts index 7ed0243..c462ff3 100644 --- a/config/vite.config.dev.ts +++ b/config/vite.config.dev.ts @@ -14,7 +14,8 @@ export default mergeConfig( proxy: { '/api': { // target: 'http://8.134.75.234:8081', - target: 'http://192.168.3.238:8081', + // target: 'http://192.168.3.238:8081', + target: 'http://localhost:8081', changeOrigin: true, }, }, diff --git a/src/api/dept.ts b/src/api/dept.ts index 70a1ac0..6aa0d42 100644 --- a/src/api/dept.ts +++ b/src/api/dept.ts @@ -11,6 +11,12 @@ export interface DeptRecord extends DeptCreateRecord { id: string; } +export interface DeptTreeData { + id: number; + label: string; + children?: DeptTreeData[]; +} + // 获取部门树 export function getAllDeptTree(id?: number | string) { return axios({ diff --git a/src/views/system/user/components/dept-tree.vue b/src/views/system/user/components/dept-tree.vue new file mode 100644 index 0000000..229c371 --- /dev/null +++ b/src/views/system/user/components/dept-tree.vue @@ -0,0 +1,110 @@ + + + + + + + \ No newline at end of file diff --git a/src/views/system/user/components/user-edit.vue b/src/views/system/user/components/user-edit.vue index a805d27..c0b8702 100644 --- a/src/views/system/user/components/user-edit.vue +++ b/src/views/system/user/components/user-edit.vue @@ -145,7 +145,7 @@ import { computed, PropType, ref } from 'vue'; import { CreateRecord } from '@/api/user'; import { FormInstance } from '@arco-design/web-vue/es/form'; import { queryRoleList } from '@/api/role'; -import { deptList } from '@/api/dept'; +import { deptList, getAllDeptTree } from '@/api/dept'; import { Message } from '@arco-design/web-vue'; import { useUserStore } from '@/store'; @@ -184,8 +184,8 @@ const userStore = useUserStore(); // 部门数据 const deptOptions = ref(); const getDeptData = async () => { - const res = await deptList(); - deptOptions.value = res.data.records; + const res = await getAllDeptTree(0); + deptOptions.value = res.data; }; // 角色数据 const roleOptions = ref(); diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index ff00272..e94efdd 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -1,224 +1,245 @@