Browse Source

feat: 完成组织管理

louhangfei 11 months ago
parent
commit
c0cadfcf65

+ 8 - 0
src/api/auth/auth.ts

@@ -0,0 +1,8 @@
+import { http } from '@/utils/http/axios';
+
+export const getAuthValid = () => {
+  return http.request({
+    url: '/onplay/justAuth',
+    method: 'get',
+  });
+};

+ 112 - 0
src/api/auth/dept.ts

@@ -0,0 +1,112 @@
+import { http } from '@/utils/http/axios';
+import { DeptTreeItem , addDeptProps, editDeptProps} from '@/types/dept/type';
+
+/**
+ * @description: 部门列表
+ */
+export function deptList(params) {
+  return http.request({
+    url: '/dept/list',
+    method: 'get',
+    params,
+  });
+}
+
+/**
+ * @description: 部门树形列表
+ */
+export function deptTreeList(params?) {
+  return http.request({
+    url: '/dept/queryRegionTree',
+    method: 'get',
+    params,
+  });
+}
+
+/**
+ * @description: 添加部门
+ */
+export function addDept(params) {
+  return http.request({
+    url: '/dept/add',
+    method: 'post',
+    params,
+  });
+}
+
+/**
+ * @description: 编辑部门
+ */
+export function editDept(params) {
+  return http.request({
+    url: '/dept/update',
+    method: 'post',
+    params,
+  });
+}
+
+/**
+ * @description: 部门详情
+ */
+export function deptInfo(params) {
+  return http.request({
+    url: '/dept/view',
+    method: 'get',
+    params,
+  });
+}
+
+/**
+ * @description: 删除部门
+ */
+export function deleteDept(params) {
+  return http.request({
+    url: '/dept/delete',
+    method: 'post',
+    params,
+  });
+}
+
+
+/**
+ * @description: V4: 添加组织
+ */
+export function saveDept(params:addDeptProps) {
+  return http.request({
+    url: '/admin/dept/saveDept',
+    method: 'post',
+    params,
+  });
+}
+
+/**
+ * @description: V4:编辑组织
+ */
+export function updateDepartments(params:editDeptProps) {
+  return http.request({
+    url: '/admin/dept/updateDept',
+    method: 'post',
+    params,
+  });
+}
+
+// v4: 获取所有组织
+export function getAllDepartments(): Promise<DeptTreeItem[]> {
+  return http.request({
+    url: '/admin/dept/queryAllDeptTree',
+    method: 'post',
+  });
+}
+
+
+/**
+ * @description:V4: 删除部门
+ */
+export function deleteDepartments(deptId:number) {
+  return http.request({
+    url: `/admin/dept/deleteDept?deptId=${deptId}`,
+    method: 'DELETE',
+  }, {
+    isTransformResponse: false,
+  });
+}

+ 56 - 0
src/api/auth/post.ts

@@ -0,0 +1,56 @@
+import { http } from '@/utils/http/axios';
+
+/**
+ * @description: 岗位列表
+ */
+export function postList(params) {
+  return http.request({
+    url: '/post/list',
+    method: 'get',
+    params,
+  });
+}
+
+/**
+ * @description: 添加岗位
+ */
+export function addPost(params) {
+  return http.request({
+    url: '/post/add',
+    method: 'post',
+    params,
+  });
+}
+
+/**
+ * @description: 编辑岗位
+ */
+export function editPost(params) {
+  return http.request({
+    url: '/post/update',
+    method: 'post',
+    params,
+  });
+}
+
+/**
+ * @description: 岗位详情
+ */
+export function postInfo(params) {
+  return http.request({
+    url: '/post/view',
+    method: 'get',
+    params,
+  });
+}
+
+/**
+ * @description: 删除岗位
+ */
+export function deletePost(params) {
+  return http.request({
+    url: '/post/delete',
+    method: 'post',
+    params,
+  });
+}

+ 9 - 0
src/api/deptInfo/index.ts

@@ -0,0 +1,9 @@
+import { http } from '@/utils/http/axios';
+
+// 查询部门信息列表
+export function getDeptInfoList() {
+  return http.request({
+    url: '/admin/dept/queryDeptPullDownList',
+    method: 'get',
+  });
+}

BIN
src/assets/icons/delete.png


BIN
src/assets/icons/edit.png


+ 88 - 57
src/router/full-routes.ts

@@ -323,61 +323,61 @@ export const disasterPreventionRoute = {
   redirect: '',
 };
 
-export const userRoutes: AppRouteRecordRaw =
-  /**
-   * 用户管理
-   */
-  {
-    path: '/user',
-    name: 'User',
-    component: 'LAYOUT',
-    meta: {
-      icon: 'UserOutlined',
-      title: '用户管理',
-    },
-    children: [
-      {
-        // 账号管理
-        path: 'account',
-        name: 'UserAccount',
-        component: '/system/user/user',
-        meta: {
-          icon: '',
-          title: '账号管理',
-        },
-      },
-      {
-        // 角色管理
-        path: 'role',
-        name: 'UserRole',
-        component: '/system/role/role',
-        meta: {
-          icon: '',
-          title: '角色管理',
-        },
-      },
-      {
-        // 组织管理
-        path: 'department',
-        name: 'UserDepartment',
-        component: '/auth/dept/dept',
-        meta: {
-          icon: '',
-          title: '组织管理',
-        },
-      },
-      {
-        // 岗位管理 (目前不需要)
-        path: 'post',
-        name: 'UserPost',
-        component: '/auth/post/post',
-        meta: {
-          icon: '',
-          title: '岗位管理',
-        },
-      },
-    ],
-  };
+// export const userRoutesOld: AppRouteRecordRaw =
+//   /**
+//    * 用户管理
+//    */
+//   {
+//     path: '/user',
+//     name: 'User',
+//     component: 'LAYOUT',
+//     meta: {
+//       icon: 'UserOutlined',
+//       title: '用户管理',
+//     },
+//     children: [
+//       {
+//         // 账号管理
+//         path: 'account',
+//         name: 'UserAccount',
+//         component: '/system/user/user',
+//         meta: {
+//           icon: '',
+//           title: '账号管理',
+//         },
+//       },
+//       {
+//         // 角色管理
+//         path: 'role',
+//         name: 'UserRole',
+//         component: '/system/role/role',
+//         meta: {
+//           icon: '',
+//           title: '角色管理',
+//         },
+//       },
+//       {
+//         // 组织管理
+//         path: 'department',
+//         name: 'UserDepartment',
+//         component: '/auth/dept/dept',
+//         meta: {
+//           icon: '',
+//           title: '组织管理',
+//         },
+//       },
+//       {
+//         // 岗位管理 (目前不需要)
+//         path: 'post',
+//         name: 'UserPost',
+//         component: '/auth/post/post',
+//         meta: {
+//           icon: '',
+//           title: '岗位管理',
+//         },
+//       },
+//     ],
+//   };
 
 // export const systemRoutesOld =
 //   /**
@@ -495,7 +495,38 @@ export const platformRoutes = {
         icon: 'UserOutlined',
         title: '用户管理',
       },
-      children: [],
+      children: [
+        {
+          // 组织管理
+          path: 'department',
+          name: 'UserDepartment',
+          component: '/auth/dept/dept',
+          meta: {
+            icon: '',
+            title: '组织管理',
+          },
+        },
+        {
+          // 角色管理
+          path: 'role',
+          name: 'UserRole',
+          component: '/system/role/role',
+          meta: {
+            icon: '',
+            title: '角色管理',
+          },
+        },
+        {
+          // 账号管理
+          path: 'account',
+          name: 'UserAccount',
+          component: '/system/user/user',
+          meta: {
+            icon: '',
+            title: '账号管理',
+          },
+        },
+      ],
     },
     {
       // 菜单管理
@@ -570,7 +601,7 @@ export const exceptionRouters =
 export const fullRoutes: AppRouteRecordRaw[] = [
   disasterPreventionRoute,
 
-  userRoutes,
+  // userRoutes,
 
   // systemRoutes,
   platformRoutes,

+ 2 - 2
src/views/auth/dept/dept.vue

@@ -72,8 +72,8 @@
   import CreateDrawer_shangfei from './CreateDrawer-shangfei.vue';
   import { useGlobSetting } from '@/hooks/setting';
   import type { DeptTreeItem } from '@/types/dept/type';
-  import editIcon from '@/assets/images/reportmessage/edit.png';
-  import deleteIcon from '@/assets/images/reportmessage/delete.png';
+  import editIcon from '@/assets/icons/edit.png';
+  import deleteIcon from '@/assets/icons/delete.png';
   import { PERM_USER } from '@/types/permission/constants';
   import { ResultEnum } from '@/enums/httpEnum';
 

+ 9 - 3
src/views/system/user/user.vue

@@ -26,7 +26,13 @@
             </template>
             添加用户
           </el-button>
-          <el-button color="#1890FF" @click="openAddMultipleDrawer" style="margin-left: 18px" plain  v-permission="{ action: [PERM_USER.ACCOUNT_ADD] }">
+          <el-button
+            color="#1890FF"
+            @click="openAddMultipleDrawer"
+            style="margin-left: 18px"
+            plain
+            v-permission="{ action: [PERM_USER.ACCOUNT_ADD] }"
+          >
             <template #icon>
               <el-icon>
                 <DocumentAdd />
@@ -184,8 +190,8 @@
   import CreateDrawer from './CreateDrawer.vue';
   import ResetCodeDrawer from './ResetCodeDrawer.vue';
   import CreateAdminDrawer from './CreateAdminDrawer.vue';
-  import editIcon from '@/assets/images/reportmessage/edit.png';
-  import deleteIcon from '@/assets/images/reportmessage/delete.png';
+  import editIcon from '@/assets/icons/edit.png';
+  import deleteIcon from '@/assets/icons/delete.png';
   import { SYS_TENANT_ID } from '@/utils/useTargetTenantIdSetting';
   import { PERM_USER } from '@/types/permission/constants';