121 lines
2.7 KiB
Plaintext
121 lines
2.7 KiB
Plaintext
import { request } from "@utils";
|
|
|
|
const API_PATH = "/bre/cross_combination";
|
|
|
|
const CrossCombinationAPI = {
|
|
getCrossCombinationList(query: CrossCombinationPageQuery) {
|
|
return request<ApiResponse<PageResult<CrossCombinationTable>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
getCrossCombinationDetail(query: number) {
|
|
return request<ApiResponse<CrossCombinationTable>>({
|
|
url: `${API_PATH}/detail/${query}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
getCrossCombinationOptions() {
|
|
return request<ApiResponse<CrossCombinationOption[]>>({
|
|
url: `${API_PATH}/options`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
createCrossCombination(body: CrossCombinationForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
updateCrossCombination(id: number, body: CrossCombinationForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
deleteCrossCombination(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
exportCrossCombination(body: CrossCombinationPageQuery) {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/export`,
|
|
method: "post",
|
|
data: body,
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
downloadTemplateCrossCombination() {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/download/template`,
|
|
method: "post",
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
importCrossCombination(body: FormData) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/import`,
|
|
method: "post",
|
|
data: body,
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
export default CrossCombinationAPI;
|
|
|
|
export interface CrossCombinationPageQuery extends PageQuery, UserByQueryParams {
|
|
combination_code?: string;
|
|
cross_year?: number;
|
|
bre_target_id?: number;
|
|
cross_method?: string;
|
|
}
|
|
|
|
export interface CrossCombinationOption {
|
|
value: number;
|
|
label: string;
|
|
}
|
|
|
|
export interface CrossCombinationTable extends BaseType {
|
|
combination_code?: string;
|
|
cross_year?: number;
|
|
bre_target_id?: number;
|
|
bre_target_name?: string;
|
|
female_parent_id?: number;
|
|
female_parent_name?: string;
|
|
male_parent_id?: number;
|
|
male_parent_name?: string;
|
|
cross_method?: string;
|
|
cross_date?: string;
|
|
seed_count?: number;
|
|
remark?: string;
|
|
}
|
|
|
|
export interface CrossCombinationForm extends BaseFormType {
|
|
combination_code?: string;
|
|
cross_year?: number;
|
|
bre_target_id?: number;
|
|
female_parent_id?: number;
|
|
male_parent_id?: number;
|
|
cross_method?: string;
|
|
cross_date?: string;
|
|
seed_count?: number;
|
|
remark?: string;
|
|
}
|