mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-12 05:01:39 +08:00
优化:优化后端 CRUD 公共组件(移除 BaseService 中无用的默认实现,抽取 BaseRequest 基类来方便使用分组校验),并同步调整部门管理 API
This commit is contained in:
@@ -27,21 +27,22 @@ export function getDeptList(params: DeptParams) {
|
||||
});
|
||||
}
|
||||
|
||||
export interface CreateDeptReq {
|
||||
export interface DeptReq {
|
||||
parentId: number;
|
||||
deptName: string;
|
||||
deptSort: number;
|
||||
description: string;
|
||||
}
|
||||
export function createDept(req: CreateDeptReq) {
|
||||
export function createDept(req: DeptReq) {
|
||||
return axios.post('/system/dept', req);
|
||||
}
|
||||
|
||||
export interface UpdateDeptStatusReq {
|
||||
status: number;
|
||||
export interface UpdateDeptReq extends Partial<DeptReq> {
|
||||
deptId: number;
|
||||
status?: number;
|
||||
}
|
||||
export function updateDeptStatus(ids: Array<number>, req: UpdateDeptStatusReq) {
|
||||
return axios.patch(`/system/dept/${ids}`, req);
|
||||
export function updateDept(req: UpdateDeptReq) {
|
||||
return axios.put(`/system/dept`, req);
|
||||
}
|
||||
|
||||
export function deleteDept(ids: Array<number>) {
|
||||
|
@@ -281,7 +281,7 @@
|
||||
DeptRecord,
|
||||
DeptParams,
|
||||
createDept,
|
||||
updateDeptStatus,
|
||||
updateDept,
|
||||
deleteDept,
|
||||
} from '@/api/system/dept';
|
||||
import getDeptTree from '@/api/common';
|
||||
@@ -405,7 +405,7 @@
|
||||
// 改变状态
|
||||
const handleChangeStatus = async (record: DeptRecord, val: number) => {
|
||||
if (record.deptId) {
|
||||
const res = await updateDeptStatus([record.deptId], { status: val });
|
||||
const res = await updateDept({ deptId: record.deptId, status: val });
|
||||
if (res.success) {
|
||||
Message.success(res.msg);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user