diff --git a/src/api/system/dept.ts b/src/api/system/dept.ts new file mode 100644 index 0000000..e16524d --- /dev/null +++ b/src/api/system/dept.ts @@ -0,0 +1,82 @@ +import { http } from "@/utils/http"; + +export interface DeptQuery extends BaseQuery { + deptId?: number; + parentId?: number; +} + +/** + * DeptDTO + */ +export interface DeptDTO { + createTime?: Date; + id?: number; + deptName?: string; + email?: string; + leaderName?: string; + orderNum?: number; + parentId?: number; + phone?: string; + status?: number; + statusStr?: string; +} + +/** + * AddDeptCommand + */ +export interface DeptRequest { + deptName: string; + email?: string; + leaderName?: string; + orderNum: number; + parentId: number; + phone?: string; + status: number; +} + +export interface DeptTreeDTO { + id: number; + parentId: number; + label: string; + children: [DeptTreeDTO]; +} + +/** 获取部门列表 */ +export const getDeptListApi = (params?: DeptQuery) => { + return http.request>>("get", "/system/depts", { + params + }); +}; + +/** 新增部门 */ +export const addDeptApi = (data: DeptRequest) => { + console.log(data); + return http.request>("post", "/system/dept", { + data + }); +}; + +/** 部门详情 */ +export const getDeptInfoApi = (deptId: string) => { + return http.request>("get", `/system/dept/${deptId}`); +}; + +/** 修改部门 */ +export const updateDeptApi = (deptId: string, data: DeptRequest) => { + return http.request>("put", `/system/dept/${deptId}`, { + data + }); +}; + +/** 删除部门 */ +export const deleteDeptApi = (deptId: string) => { + return http.request>("delete", `/system/dept/${deptId}`); +}; + +/** 获取部门树级结构 */ +export const getDeptTree = () => { + return http.request>( + "get", + "/system/depts/dropdown" + ); +}; diff --git a/src/views/system/dept/form.vue b/src/views/system/dept/form.vue new file mode 100644 index 0000000..5cc322c --- /dev/null +++ b/src/views/system/dept/form.vue @@ -0,0 +1,134 @@ + + + diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index ab32c30..3139475 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -1,71 +1,49 @@