116 lines
2.5 KiB
Plaintext
116 lines
2.5 KiB
Plaintext
import { request } from "@utils";
|
|||
|
|
|
||
|
|
const API_PATH = "/bre/pollination";
|
||
|
|
|
||
|
|
const PollinationAPI = {
|
||
|
|
getPollinationList(query: PollinationPageQuery) {
|
||
|
|
return request<ApiResponse<PageResult<PollinationTable>>>({
|
||
|
|
url: `${API_PATH}/list`,
|
||
|
|
method: "get",
|
||
|
|
params: query,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
getPollinationDetail(query: number) {
|
||
|
|
return request<ApiResponse<PollinationTable>>({
|
||
|
|
url: `${API_PATH}/detail/${query}`,
|
||
|
|
method: "get",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
getPollinationOptions() {
|
||
|
|
return request<ApiResponse<PollinationOption[]>>({
|
||
|
|
url: `${API_PATH}/options`,
|
||
|
|
method: "get",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
createPollination(body: PollinationForm) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/create`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
updatePollination(id: number, body: PollinationForm) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/update/${id}`,
|
||
|
|
method: "put",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
deletePollination(body: number[]) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/delete`,
|
||
|
|
method: "delete",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
exportPollination(body: PollinationPageQuery) {
|
||
|
|
return request<Blob>({
|
||
|
|
url: `${API_PATH}/export`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
responseType: "blob",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
downloadTemplatePollination() {
|
||
|
|
return request<Blob>({
|
||
|
|
url: `${API_PATH}/download/template`,
|
||
|
|
method: "post",
|
||
|
|
responseType: "blob",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
importPollination(body: FormData) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/import`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
headers: {
|
||
|
|
"Content-Type": "multipart/form-data",
|
||
|
|
},
|
||
|
|
});
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export default PollinationAPI;
|
||
|
|
|
||
|
|
export interface PollinationPageQuery extends PageQuery, UserByQueryParams {
|
||
|
|
combination_id?: number;
|
||
|
|
plot_id?: number;
|
||
|
|
bre_personnel_id?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface PollinationOption {
|
||
|
|
value: number;
|
||
|
|
label: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface PollinationTable extends BaseType {
|
||
|
|
combination_id?: number;
|
||
|
|
combination_name?: string;
|
||
|
|
plot_id?: number;
|
||
|
|
plot_name?: string;
|
||
|
|
pollination_date?: string;
|
||
|
|
flower_count?: number;
|
||
|
|
effective_count?: number;
|
||
|
|
bre_personnel_id?: number;
|
||
|
|
bre_personnel_name?: string;
|
||
|
|
remark?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface PollinationForm extends BaseFormType {
|
||
|
|
combination_id?: number;
|
||
|
|
plot_id?: number;
|
||
|
|
pollination_date?: string;
|
||
|
|
flower_count?: number;
|
||
|
|
effective_count?: number;
|
||
|
|
bre_personnel_id?: number;
|
||
|
|
remark?: string;
|
||
|
|
}
|