114 lines
2.5 KiB
Plaintext
114 lines
2.5 KiB
Plaintext
import { request } from "@utils";
|
|
|
|
const API_PATH = "/bre/selection_result";
|
|
|
|
const SelectionResultAPI = {
|
|
getSelectionResultList(query: SelectionResultPageQuery) {
|
|
return request<ApiResponse<PageResult<SelectionResultTable>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
getSelectionResultDetail(query: number) {
|
|
return request<ApiResponse<SelectionResultTable>>({
|
|
url: `${API_PATH}/detail/${query}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
getSelectionResultOptions() {
|
|
return request<ApiResponse<SelectionResultOption[]>>({
|
|
url: `${API_PATH}/options`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
createSelectionResult(body: SelectionResultForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
updateSelectionResult(id: number, body: SelectionResultForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
deleteSelectionResult(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
exportSelectionResult(body: SelectionResultPageQuery) {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/export`,
|
|
method: "post",
|
|
data: body,
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
downloadTemplateSelectionResult() {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/download/template`,
|
|
method: "post",
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
importSelectionResult(body: FormData) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/import`,
|
|
method: "post",
|
|
data: body,
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
export default SelectionResultAPI;
|
|
|
|
export interface SelectionResultPageQuery extends PageQuery, UserByQueryParams {
|
|
combination_id?: number;
|
|
tree_id?: number;
|
|
selection_year?: number;
|
|
is_selected?: string;
|
|
}
|
|
|
|
export interface SelectionResultOption {
|
|
value: number;
|
|
label: string;
|
|
}
|
|
|
|
export interface SelectionResultTable extends BaseType {
|
|
combination_id?: number;
|
|
combination_name?: string;
|
|
tree_id?: number;
|
|
tree_name?: string;
|
|
selection_year?: number;
|
|
is_selected?: string;
|
|
reason?: string;
|
|
remark?: string;
|
|
}
|
|
|
|
export interface SelectionResultForm extends BaseFormType {
|
|
combination_id?: number;
|
|
tree_id?: number;
|
|
selection_year?: number;
|
|
is_selected?: string;
|
|
reason?: string;
|
|
remark?: string;
|
|
}
|