feat: 添加部门管理
This commit is contained in:
82
src/api/system.ts
Normal file
82
src/api/system.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import { http } from "@/utils/http";
|
||||
import type { DepartmentInfo } from "types/system";
|
||||
import { filterEmptyObject } from "./utils";
|
||||
|
||||
// ---------------------------部门相关-------------------------------------
|
||||
|
||||
/**
|
||||
* 获取部门列表参数
|
||||
*/
|
||||
type GetDepartmentListParams = {
|
||||
/**当前页 */
|
||||
page: number;
|
||||
/**每页数量 */
|
||||
pageSize: number;
|
||||
/**部门ID */
|
||||
id?: string;
|
||||
/**部门名称 */
|
||||
name?: string;
|
||||
/**附属部门ID */
|
||||
parent_id?: string;
|
||||
/**部门负责人 */
|
||||
principal?: string;
|
||||
/**部门电话 */
|
||||
phone?: number | string;
|
||||
/**部门邮件 */
|
||||
email?: string;
|
||||
/**备注 */
|
||||
remark?: string;
|
||||
/**排序 */
|
||||
sort?: number | string;
|
||||
};
|
||||
/**获取部门列表 */
|
||||
export const getDepartmentListAPI = (params: GetDepartmentListParams) => {
|
||||
return http.request<QueryListResult<DepartmentInfo[]>>(
|
||||
"get",
|
||||
`/api/department/list`,
|
||||
{
|
||||
params: filterEmptyObject(params)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**更新部门数据 */
|
||||
export const putUpdateDepartmentAPI = (
|
||||
data: AddDepartmentParams,
|
||||
id: string
|
||||
) => {
|
||||
return http.request<null>("post", `/api/department/update/${id}`, {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
/**添加部门数据参数 */
|
||||
type AddDepartmentParams = {
|
||||
/**部门名称 */
|
||||
name: string;
|
||||
/**父部门ID */
|
||||
parent_id: string;
|
||||
/**排序 */
|
||||
sort: number;
|
||||
/**部门负责人 */
|
||||
principal: string;
|
||||
/**部门电话 */
|
||||
phone: number | string;
|
||||
/**部门邮件 */
|
||||
email: string;
|
||||
/**备注 */
|
||||
remark: string;
|
||||
/**状态 */
|
||||
status: number;
|
||||
};
|
||||
|
||||
/**添加部门数据 */
|
||||
export const postAddDepartmentAPI = (data: AddDepartmentParams) => {
|
||||
return http.request<null>("post", `/api/department/add`, {
|
||||
data
|
||||
});
|
||||
};
|
||||
/**删除部门及其附属部门 */
|
||||
export const deleteDepartmentAPI = (id: string) => {
|
||||
return http.request<null>("post", `/api/department/delete/${id}`);
|
||||
};
|
||||
Reference in New Issue
Block a user