114 lines
2.2 KiB
Plaintext
114 lines
2.2 KiB
Plaintext
import { request } from "@utils";
|
|
|
|
const API_PATH = "/bre/plan";
|
|
|
|
const PlanAPI = {
|
|
getPlanList(query: PlanPageQuery) {
|
|
return request<ApiResponse<PageResult<PlanTable>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
getPlanDetail(query: number) {
|
|
return request<ApiResponse<PlanTable>>({
|
|
url: `${API_PATH}/detail/${query}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
getPlanOptions() {
|
|
return request<ApiResponse<PlanOption[]>>({
|
|
url: `${API_PATH}/options`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
createPlan(body: PlanForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
updatePlan(id: number, body: PlanForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
deletePlan(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
exportPlan(body: PlanPageQuery) {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/export`,
|
|
method: "post",
|
|
data: body,
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
downloadTemplatePlan() {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/download/template`,
|
|
method: "post",
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
importPlan(body: FormData) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/import`,
|
|
method: "post",
|
|
data: body,
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
export default PlanAPI;
|
|
|
|
export interface PlanPageQuery extends PageQuery, UserByQueryParams {
|
|
plan_code?: string;
|
|
plan_name?: string;
|
|
start_year?: number;
|
|
end_year?: number;
|
|
}
|
|
|
|
export interface PlanOption {
|
|
value: number;
|
|
label: string;
|
|
}
|
|
|
|
export interface PlanTable extends BaseType {
|
|
plan_code?: string;
|
|
plan_name?: string;
|
|
objective?: string;
|
|
start_year?: number;
|
|
end_year?: number;
|
|
leader?: string;
|
|
remark?: string;
|
|
}
|
|
|
|
export interface PlanForm extends BaseFormType {
|
|
plan_code?: string;
|
|
plan_name?: string;
|
|
objective?: string;
|
|
start_year?: number;
|
|
end_year?: number;
|
|
leader?: string;
|
|
remark?: string;
|
|
}
|