diff --git a/.env b/.env
index 45ea218..1bf40c9 100644
--- a/.env
+++ b/.env
@@ -1,4 +1,4 @@
-VITE_HOME_REDIRECT = '/menu' # 默认路由
+VITE_HOME_REDIRECT = '/dept' # 默认路由
VITE_TITLE = '星撰玉衡' # 项目名称
VITE_BASE_URL = '/api' # 请求默认前缀
VITE_HTTP_TIMEOUT = 30000
diff --git a/src/api/Auth/AuthDept/index.js b/src/api/Auth/AuthDept/index.js
new file mode 100644
index 0000000..fb44c3a
--- /dev/null
+++ b/src/api/Auth/AuthDept/index.js
@@ -0,0 +1,98 @@
+// | ------------------------------------------------------------
+// | @版本: version 0.1
+// | @创建人: 【Nie-x7129】
+// | @E-mail: x71291@outlook.com
+// | @所在项目: hoto-auth-vue3
+// | @文件描述: index.js -
+// | @创建时间: 2024-07-12 10:45
+// | @更新时间: 2024-07-12 10:45
+// | @修改记录:
+// | -*-*-*- (时间--修改人--修改说明) -*-*-*-
+// | =
+// | ------------------------------------------------------------
+
+
+
+import HTTP from '@/api/http.js';
+import { PageData } from '@utils/DefaultData.js';
+
+export const AuthDept = {
+ /**
+ * Name: createDept
+ * Desc: 新增组织部门
+ * Time: 2024-07-12 10:47:05 -
+ * */
+ createDept: async (data) => {
+ return HTTP({
+ method: 'post',
+ url: '/authDept',
+ data,
+ });
+ },
+
+ /**
+ * Name: getDept
+ * Desc: 获取组织部门的分页或列表
+ * Time: 2024-07-02 22:45:11 -
+ * */
+ getDept: async (
+ params = {
+ ...PageData,
+ },
+ ) => {
+ return HTTP({
+ method: 'get',
+ url: '/authDept',
+ params,
+ });
+ },
+
+ /**
+ * Name: getDeptMore
+ * Desc: 获取组织部门详情
+ * Time: 2024-07-02 22:45:11 -
+ * */
+ getDeptMore: async (deptId) => {
+ return HTTP({
+ method: 'get',
+ url: `/authDept/${deptId}`,
+ });
+ },
+
+ /**
+ * Name: getDeptTree
+ * Desc: 获取组织部门树
+ * Time: 2024-07-02 22:45:11 -
+ * */
+ getDeptTree: async (deptId = 0) => {
+ return HTTP({
+ method: 'get',
+ url: `/authDept/tree/${deptId}`,
+ });
+ },
+
+ /**
+ * Name: removeDept
+ * Desc: 删除组织部门
+ * Time: 2024-07-02 22:45:06 -
+ * */
+ removeDept: async (deptId) => {
+ return HTTP({
+ method: 'delete',
+ url: `/authDept/${deptId}`,
+ });
+ },
+
+ /**
+ * Name: updateDept
+ * Desc: 编辑组织部门
+ * Time: 2024-07-02 22:45:03 -
+ * */
+ updateDept: async (deptId, data) => {
+ return HTTP({
+ method: 'patch',
+ url: `/authDept/${deptId}`,
+ data,
+ });
+ },
+};
diff --git a/src/api/index.js b/src/api/index.js
index 4f6caea..e78bbfd 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -16,5 +16,6 @@ import { CoreService } from '@/api/Core/CoreService/index.js';
import { CoreDict } from '@/api/Core/CoreDict/index.js';
import { CoreEnv } from '@/api/Core/CoreEnv/index.js';
import { CoreMenu } from '@/api/Core/CoreMenu/index.js';
+import { AuthDept } from '@/api/Auth/AuthDept/index.js';
-export { Sign, DefaultSign, CoreService, CoreDict, CoreEnv, CoreMenu };
+export { Sign, DefaultSign, CoreService, CoreDict, CoreEnv, CoreMenu, AuthDept };
diff --git a/src/components/AntDesignVue/CustomAntDesignVue/TableColumChoose/index.vue b/src/components/AntDesignVue/CustomAntDesignVue/TableColumChoose/index.vue
index f578789..70011a6 100644
--- a/src/components/AntDesignVue/CustomAntDesignVue/TableColumChoose/index.vue
+++ b/src/components/AntDesignVue/CustomAntDesignVue/TableColumChoose/index.vue
@@ -42,12 +42,12 @@ function chooseAll() {
diff --git a/src/components/AntDesignVue/index.js b/src/components/AntDesignVue/index.js
index 2a8095d..b8c84cb 100644
--- a/src/components/AntDesignVue/index.js
+++ b/src/components/AntDesignVue/index.js
@@ -40,6 +40,8 @@ import {
CheckboxGroup,
Popconfirm,
Divider,
+ List,
+ ListItem, ListItemMeta,
} from 'ant-design-vue';
import 'ant-design-vue/dist/reset.css';
@@ -85,6 +87,9 @@ export function setupCustomAntDesignVueComponents(app) {
CheckboxGroup,
Popconfirm, // ! 气泡确认框
Divider, // ! 分割线
+ List, // ! 列表
+ ListItem, // ! 列表子项
+ ListItemMeta, // ! 列表子项详细信息
];
for (let component of componentList) {
app.component(component.name, component);
diff --git a/src/router/index.js b/src/router/index.js
index 870e3be..c29b284 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -56,6 +56,15 @@ export default function createRoutering() {
},
component: () => import('@/views/Auth/Env/EnvPage.vue')
},
+ {
+ path: '/dept',
+ name: 'Dept',
+ meta:{
+ title: '部门管理',
+ icon: ''
+ },
+ component: () => import('@/views/Auth/Dept/DeptPage.vue')
+ },
{
path: '/about',
name: 'about',
diff --git a/src/stores/baseData.js b/src/stores/baseData.js
index c3a4bf8..a3cfea4 100644
--- a/src/stores/baseData.js
+++ b/src/stores/baseData.js
@@ -13,7 +13,7 @@
import { defineStore } from 'pinia';
import { computed, reactive } from 'vue';
-import { CoreDict, CoreEnv, CoreMenu, CoreService } from '@/api/index.js';
+import { AuthDept, CoreDict, CoreEnv, CoreMenu, CoreService } from '@/api/index.js';
export const useBaseDataStore = defineStore('baseData', () => {
const state = reactive({
@@ -46,6 +46,14 @@ export const useBaseDataStore = defineStore('baseData', () => {
menuTypeList: [],
// ! 菜单类型树
menuTypeTree: [],
+ // ! 部门列表
+ deptList: [],
+ // ! 部门树
+ deptTree: [],
+ // ! 部门类型列表
+ deptTypeList: [],
+ // ! 部门类型树
+ deptTypeTree: [],
// ! 防抖
// 防抖获取服务列表
@@ -58,6 +66,10 @@ export const useBaseDataStore = defineStore('baseData', () => {
canGetMenuList: true,
// 防抖获取菜单Menu类型列表
canGetMenuTypeList: true,
+ // 防抖获取部门Dept列表
+ canGetDeptList: true,
+ // 防抖获取部门Dept类型列表
+ canGetDeptTypeList: true,
});
// ! 获取服务列表
@@ -146,6 +158,46 @@ export const useBaseDataStore = defineStore('baseData', () => {
const [list] = getDictTree(resd);
state.menuTypeTree = Array.isArray(list) && list.length > 0 ? list[0].children : [];
};
+
+
+ // ! 获取部门列表
+ const getDeptList = async () => {
+ if (!state.canGetDeptList) return;
+ state.canGetDeptList = false;
+ setTimeout(() => {
+ state.canGetDeptList = true;
+ }, 2000);
+ const resd = await AuthDept.getDeptTree(0);
+ state.deptList = resd;
+ const [list, otherList] = getDeptTree(resd);
+ list.push({
+ meta: {},
+ label: '其他部门',
+ value: '-1',
+ id: '-1',
+ disabled: true,
+ children: otherList,
+ });
+ state.deptTree = list;
+ };
+
+
+ // ! 获取部门类型
+ const getDeptTypeList = async () => {
+ if (!state.canGetDeptTypeList) return;
+ state.canGetDeptTypeList = false;
+ setTimeout(() => {
+ state.canGetDeptTypeList = true;
+ }, 2000);
+ // ! todo DeptType时固定字段,初始字典
+ const resd = await CoreDict.getDictTree({
+ dictKey: 'DeptType',
+ isTree: true,
+ });
+ state.deptTypeList = resd;
+ const [list] = getDictTree(resd);
+ state.deptTypeTree = Array.isArray(list) && list.length > 0 ? list[0].children : [];
+ };
return {
state,
getServiceList,
@@ -153,6 +205,8 @@ export const useBaseDataStore = defineStore('baseData', () => {
getEnvList,
getMenuList,
getMenuTypeList,
+ getDeptList,
+ getDeptTypeList
};
});
@@ -230,3 +284,28 @@ function getMenuTree(list, pid = 0) {
}
return [newList, noList];
}
+
+// ! 格式化Dept树
+function getDeptTree(list, pid = 0) {
+ const newList = [];
+ let noList = [];
+ for (let i in list) {
+ const obj = list[i];
+ if (obj.pid == pid) {
+ newList.push({
+ meta: { ...obj },
+ label: obj.deptName,
+ value: obj.deptId,
+ id: obj.deptId,
+ });
+ } else {
+ noList.push(obj);
+ }
+ }
+ for (let obj of newList) {
+ const [children, ls] = getDeptTree(noList, obj.id);
+ obj.children = children;
+ noList = ls;
+ }
+ return [newList, noList];
+}
diff --git a/src/views/Auth/Dept/DataModal.js b/src/views/Auth/Dept/DataModal.js
new file mode 100644
index 0000000..5bd5b9b
--- /dev/null
+++ b/src/views/Auth/Dept/DataModal.js
@@ -0,0 +1,221 @@
+// | ------------------------------------------------------------
+// | @版本: version 0.1
+// | @创建人: 【Nie-x7129】
+// | @E-mail: x71291@outlook.com
+// | @所在项目: hoto-auth-vue3
+// | @文件描述: DataModal.js -
+// | @创建时间: 2024-07-12 10:53
+// | @更新时间: 2024-07-12 10:53
+// | @修改记录:
+// | -*-*-*- (时间--修改人--修改说明) -*-*-*-
+// | =
+// | ------------------------------------------------------------
+
+import { h } from 'vue';
+// 表单数据
+export class DeptFormType {
+ constructor() {
+ return new Object({
+ // 上级部门Id
+ pid: undefined,
+ // 部门名称
+ deptName: '',
+ // 部门描述
+ deptDesc: '',
+ // 部门类型
+ deptType: undefined,
+ // 部门负责人 todo 等账户添加
+ deptLeader: undefined,
+ // 默认角色 todo 等角色添加
+ defaultRole: undefined,
+ // 排序
+ orderNum: 0,
+ });
+ }
+}
+
+// 查询数据
+export class DeptSearchType {
+ constructor() {
+ return new Object({
+ // 每页数量
+ pageSize: 10,
+ // 页码
+ pageNumber: 1,
+ // 是否是列表
+ isList: false,
+ // 排序方式
+ isAsc: false,
+ // 部门信息
+ deptInfo: undefined,
+ // 部门类型
+ deptType: undefined,
+ // 状态
+ status: undefined,
+ // 根据pid查
+ hierarchy: [],
+ });
+ }
+}
+
+// 表单规则
+export class DeptFormRulesType {
+ constructor() {
+ // todo
+ return new Object({});
+ }
+}
+
+// Dept表格列数据
+export class DeptTableColumnType {
+ constructor() {
+ return new Object({
+ index: {
+ title: '序号',
+ key: 'index',
+ width: 70, // 你可以根据需要设置列宽
+ customRender: ({ text, record, index, column }) => `${index + 1}`, // 使用索引 + 1 来显示序号
+ },
+ deptName: {
+ title: '名称',
+ dataIndex: 'deptName',
+ key: 'deptName',
+ link: 'details',
+ },
+ deptTypeName: {
+ title: '类型',
+ dataIndex: 'deptTypeName',
+ key: 'deptTypeName',
+ },
+ deptLeaderName: {
+ title: '负责人',
+ dataIndex: 'deptLeaderName',
+ key: 'deptLeaderName',
+ },
+ defaultRoleName: {
+ title: '默认角色',
+ dataIndex: 'defaultRoleName',
+ key: 'defaultRoleName',
+ },
+ grade: {
+ title: '级别',
+ dataIndex: 'grade',
+ key: 'grade',
+ },
+ haveChildren: {
+ title: '子项',
+ dataIndex: 'haveChildren',
+ key: 'haveChildren',
+ width: '50px',
+ },
+ createtime: {
+ title: '创建时间',
+ dataIndex: 'createtime',
+ key: 'createtime',
+ width: '140px',
+ sorter: true,
+ },
+ createName: {
+ title: '创建人',
+ dataIndex: 'createName',
+ key: 'createName',
+ },
+ updatetime: {
+ title: '更新时间',
+ dataIndex: 'updatetime',
+ key: 'updatetime',
+ maxWidth: '140px',
+ minWidth: '140px',
+ },
+ updateName: {
+ title: '更新人',
+ dataIndex: 'updateName',
+ key: 'updateName',
+ },
+ action: {
+ title: '操作',
+ dataIndex: 'action',
+ key: 'action',
+ width: 100,
+ align: 'center',
+ },
+ });
+ }
+}
+
+// Dept可选表格列
+export class DeptTableColumnChooseType {
+ constructor() {
+ const excludeColumn = ['updateName', 'updatetime', 'createName'];
+ const tableColumn = new DeptTableColumnType();
+ return Object.keys(tableColumn).map((i) => ({
+ title: tableColumn[i].title,
+ key: tableColumn[i].key,
+ status: excludeColumn.includes(i) ? false : true,
+ }));
+ }
+}
+
+// Dept详细信息列表
+export class DeptDetailsType {
+ constructor() {
+ return new Array(
+ {
+ title: '部门名称',
+ key: 'deptName',
+ },
+ {
+ title: '类型',
+ key: 'deptTypeName',
+ },
+ {
+ title: '部门等级',
+ key: 'grade',
+ },
+ {
+ title: '子部门数量',
+ key: 'haveChildren',
+ },
+ {
+ title: '部门人员数量',
+ key: 'userCount',
+ },
+ {
+ title: '部门负责人',
+ key: 'deptLeaderName',
+ },
+ {
+ title: '部门默认分配角色',
+ key: 'defaultRoleName',
+ },
+ {
+ title: '部门描述',
+ key: 'deptDesc',
+ },
+ {
+ title: '部门状态',
+ key: 'status',
+ },
+ {
+ title: '排序',
+ key: 'orderNum',
+ },
+ {
+ title: '创建人',
+ key: 'createName',
+ },
+ {
+ title: '创建时间',
+ key: 'createtime',
+ },
+ {
+ title: '修改人',
+ key: 'updateName',
+ },
+ {
+ title: '修改时间',
+ key: 'updatetime',
+ },
+ );
+ }
+}
diff --git a/src/views/Auth/Dept/DeptForm.vue b/src/views/Auth/Dept/DeptForm.vue
new file mode 100644
index 0000000..972db9d
--- /dev/null
+++ b/src/views/Auth/Dept/DeptForm.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+
+
+
+
+
+
diff --git a/src/views/Auth/Dept/DeptPage.vue b/src/views/Auth/Dept/DeptPage.vue
new file mode 100644
index 0000000..81f7ff1
--- /dev/null
+++ b/src/views/Auth/Dept/DeptPage.vue
@@ -0,0 +1,259 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.data === '' ? '暂无数据' : item.data}}
+
+
+
+
+
+
+
+
+
diff --git a/src/views/Auth/Dept/DeptTable.vue b/src/views/Auth/Dept/DeptTable.vue
new file mode 100644
index 0000000..3ee6f10
--- /dev/null
+++ b/src/views/Auth/Dept/DeptTable.vue
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/Auth/Dept/DeptTree.vue b/src/views/Auth/Dept/DeptTree.vue
new file mode 100644
index 0000000..4abb827
--- /dev/null
+++ b/src/views/Auth/Dept/DeptTree.vue
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
diff --git a/src/views/Auth/Menu/MenuPage.vue b/src/views/Auth/Menu/MenuPage.vue
index 2286d0c..b8a0dee 100644
--- a/src/views/Auth/Menu/MenuPage.vue
+++ b/src/views/Auth/Menu/MenuPage.vue
@@ -37,9 +37,6 @@ const formData = reactive({
const tableData = reactive({
dataSource: [],
pageInfo: new MenuSearchType(),
- searchBase:{
- menuType: []
- },
total: 0,
methods: {
handleTableChange,
diff --git a/src/views/Auth/Role/RolePage.vue b/src/views/Auth/Role/RolePage.vue
new file mode 100644
index 0000000..922df2b
--- /dev/null
+++ b/src/views/Auth/Role/RolePage.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+