133 lines
2.9 KiB
Plaintext
133 lines
2.9 KiB
Plaintext
import { request } from "@utils";
|
|
|
|
const API_PATH = "/bre/germplasm";
|
|
|
|
const GermplasmAPI = {
|
|
getGermplasmList(query: GermplasmPageQuery) {
|
|
return request<ApiResponse<PageResult<GermplasmTable>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
getGermplasmDetail(query: number) {
|
|
return request<ApiResponse<GermplasmTable>>({
|
|
url: `${API_PATH}/detail/${query}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
createGermplasm(body: GermplasmForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
updateGermplasm(id: number, body: GermplasmForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
deleteGermplasm(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
exportGermplasm(body: GermplasmPageQuery) {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/export`,
|
|
method: "post",
|
|
data: body,
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
downloadTemplateGermplasm() {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/download/template`,
|
|
method: "post",
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
importGermplasm(body: FormData) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/import`,
|
|
method: "post",
|
|
data: body,
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
},
|
|
});
|
|
},
|
|
|
|
getGermplasmOptions() {
|
|
return request<ApiResponse<GermplasmOption[]>>({
|
|
url: `${API_PATH}/options`,
|
|
method: "get",
|
|
});
|
|
},
|
|
};
|
|
|
|
export default GermplasmAPI;
|
|
|
|
export interface GermplasmPageQuery extends PageQuery, UserByQueryParams {
|
|
cultivar_name?: string;
|
|
origin?: string;
|
|
variety_type?: string;
|
|
firmness?: string;
|
|
maturity_period?: string;
|
|
can_be_female?: boolean;
|
|
can_be_male?: boolean;
|
|
}
|
|
|
|
export interface GermplasmTable extends BaseType {
|
|
cultivar_name?: string;
|
|
variety_type?: string;
|
|
origin?: string;
|
|
preservation_site?: string;
|
|
avg_fruit_weight?: number;
|
|
ssc?: number;
|
|
firmness?: string;
|
|
maturity_period?: string;
|
|
flowering_period?: string;
|
|
chilling_requirement?: number;
|
|
disease_resistance?: string;
|
|
can_be_female?: boolean;
|
|
can_be_male?: boolean;
|
|
pedigree_note?: string;
|
|
photo_path?: string;
|
|
}
|
|
|
|
export interface GermplasmForm extends BaseFormType {
|
|
cultivar_name?: string;
|
|
variety_type?: string;
|
|
origin?: string;
|
|
preservation_site?: string;
|
|
avg_fruit_weight?: number;
|
|
ssc?: number;
|
|
firmness?: string;
|
|
maturity_period?: string;
|
|
flowering_period?: string;
|
|
chilling_requirement?: number;
|
|
disease_resistance?: string;
|
|
can_be_female?: boolean;
|
|
can_be_male?: boolean;
|
|
pedigree_note?: string;
|
|
photo_path?: string;
|
|
}
|
|
|
|
export interface GermplasmOption {
|
|
value: number;
|
|
label: string;
|
|
}
|