2024-11-12 15:44:05 +08:00
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
export interface DeptCreateRecord {
|
|
|
|
remark: string;
|
|
|
|
createTime: string;
|
|
|
|
name: string;
|
|
|
|
enabled: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface DeptRecord extends DeptCreateRecord {
|
|
|
|
id: string;
|
|
|
|
}
|
|
|
|
|
2025-01-08 11:13:44 +08:00
|
|
|
// 获取部门树
|
|
|
|
export function getAllDeptTree(id: number | string) {
|
|
|
|
return axios({
|
|
|
|
method: 'get',
|
|
|
|
url: '/api/rest/dept/tree',
|
|
|
|
params: {
|
|
|
|
id,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-11-12 15:44:05 +08:00
|
|
|
// 添加区域
|
|
|
|
export function create(data: DeptCreateRecord) {
|
|
|
|
return axios.post(`/api/rest/dept`, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 更新区域信息
|
|
|
|
export function update(data: DeptRecord) {
|
|
|
|
return axios.patch(`/api/rest/dept/${data.id}`, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 删除区域
|
|
|
|
export function remove(id: string) {
|
|
|
|
return axios.delete(`/api/rest/dept/${id}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 模糊查询获取区域列表
|
|
|
|
export function queryDeptList(data: DeptRecord) {
|
|
|
|
return axios({
|
|
|
|
url: '/api/rest/dept',
|
|
|
|
method: 'get',
|
|
|
|
params: data,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取区域列表
|
|
|
|
export function deptList() {
|
|
|
|
return axios.get(`/api/rest/dept`);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 启用状态
|
|
|
|
export function enabled(id: string) {
|
|
|
|
return axios.patch(`/api/rest/dept/toggle/${id}`, id);
|
|
|
|
}
|
|
|
|
|
|
|
|
// export function getDeptTree(params?: Partial<DeptRecord>) {
|
|
|
|
// return axios.get<DeptRecord[]>(`/api/dept/trees`, {
|
|
|
|
// params,
|
|
|
|
// paramsSerializer: (obj) => {
|
|
|
|
// return qs.stringify(obj);
|
|
|
|
// },
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// export function listDepts(params?: ListParams<Partial<DeptRecord>>) {
|
|
|
|
// return axios.get<DeptRecord[]>(`/api/dept`, {
|
|
|
|
// params,
|
|
|
|
// paramsSerializer: (obj) => {
|
|
|
|
// return qs.stringify(obj);
|
|
|
|
// },
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// export function queryDepts(params?: ListParams<Partial<DeptRecord>>) {
|
|
|
|
// return queryList(`/api/dept`, params);
|
|
|
|
// }
|