108 lines
2.1 KiB
Plaintext
108 lines
2.1 KiB
Plaintext
import { request } from "@utils";
|
|
|
|
const API_PATH = "/bre/target";
|
|
|
|
const TargetAPI = {
|
|
getTargetList(query: TargetPageQuery) {
|
|
return request<ApiResponse<PageResult<TargetTable>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
getTargetDetail(query: number) {
|
|
return request<ApiResponse<TargetTable>>({
|
|
url: `${API_PATH}/detail/${query}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
getTargetOptions() {
|
|
return request<ApiResponse<TargetOption[]>>({
|
|
url: `${API_PATH}/options`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
createTarget(body: TargetForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
updateTarget(id: number, body: TargetForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
deleteTarget(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
exportTarget(body: TargetPageQuery) {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/export`,
|
|
method: "post",
|
|
data: body,
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
downloadTemplateTarget() {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/download/template`,
|
|
method: "post",
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
importTarget(body: FormData) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/import`,
|
|
method: "post",
|
|
data: body,
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
export default TargetAPI;
|
|
|
|
export interface TargetPageQuery extends PageQuery, UserByQueryParams {
|
|
target_name?: string;
|
|
series?: string;
|
|
}
|
|
|
|
export interface TargetOption {
|
|
value: number;
|
|
label: string;
|
|
}
|
|
|
|
export interface TargetTable extends BaseType {
|
|
target_name?: string;
|
|
series?: string;
|
|
description?: string;
|
|
is_preset?: string;
|
|
remark?: string;
|
|
}
|
|
|
|
export interface TargetForm extends BaseFormType {
|
|
target_name?: string;
|
|
series?: string;
|
|
description?: string;
|
|
is_preset?: string;
|
|
remark?: string;
|
|
}
|