131 lines
2.8 KiB
Plaintext
131 lines
2.8 KiB
Plaintext
import { request } from "@utils";
|
|||
|
|
|
||
|
|
const API_PATH = "/bre/seedling";
|
||
|
|
|
||
|
|
const SeedlingAPI = {
|
||
|
|
getSeedlingList(query: SeedlingPageQuery) {
|
||
|
|
return request<ApiResponse<PageResult<SeedlingTable>>>({
|
||
|
|
url: `${API_PATH}/list`,
|
||
|
|
method: "get",
|
||
|
|
params: query,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
getSeedlingDetail(query: number) {
|
||
|
|
return request<ApiResponse<SeedlingTable>>({
|
||
|
|
url: `${API_PATH}/detail/${query}`,
|
||
|
|
method: "get",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
getSeedlingOptions() {
|
||
|
|
return request<ApiResponse<SeedlingOption[]>>({
|
||
|
|
url: `${API_PATH}/options`,
|
||
|
|
method: "get",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
createSeedling(body: SeedlingForm) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/create`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
updateSeedling(id: number, body: SeedlingForm) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/update/${id}`,
|
||
|
|
method: "put",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
deleteSeedling(body: number[]) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/delete`,
|
||
|
|
method: "delete",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
exportSeedling(body: SeedlingPageQuery) {
|
||
|
|
return request<Blob>({
|
||
|
|
url: `${API_PATH}/export`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
responseType: "blob",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
downloadTemplateSeedling() {
|
||
|
|
return request<Blob>({
|
||
|
|
url: `${API_PATH}/download/template`,
|
||
|
|
method: "post",
|
||
|
|
responseType: "blob",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
importSeedling(body: FormData) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/import`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
headers: {
|
||
|
|
"Content-Type": "multipart/form-data",
|
||
|
|
},
|
||
|
|
});
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export default SeedlingAPI;
|
||
|
|
|
||
|
|
export interface SeedlingPageQuery extends PageQuery, UserByQueryParams {
|
||
|
|
combination_id?: number;
|
||
|
|
treatment_id?: number;
|
||
|
|
batch_no?: string;
|
||
|
|
tray_no?: string;
|
||
|
|
nursery?: string;
|
||
|
|
bre_personnel_id?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface SeedlingOption {
|
||
|
|
value: number;
|
||
|
|
label: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface SeedlingTable extends BaseType {
|
||
|
|
combination_id?: number;
|
||
|
|
combination_name?: string;
|
||
|
|
treatment_id?: number;
|
||
|
|
treatment_batch_no?: string;
|
||
|
|
batch_no?: string;
|
||
|
|
sowing_date?: string;
|
||
|
|
tray_no?: string;
|
||
|
|
nursery?: string;
|
||
|
|
seedling_count?: number;
|
||
|
|
emergence_date?: string;
|
||
|
|
strong_seedling_date?: string;
|
||
|
|
strong_seedling_count?: number;
|
||
|
|
stage?: string;
|
||
|
|
bre_personnel_id?: number;
|
||
|
|
bre_personnel_name?: string;
|
||
|
|
remark?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface SeedlingForm extends BaseFormType {
|
||
|
|
combination_id?: number;
|
||
|
|
treatment_id?: number;
|
||
|
|
batch_no?: string;
|
||
|
|
sowing_date?: string;
|
||
|
|
tray_no?: string;
|
||
|
|
nursery?: string;
|
||
|
|
seedling_count?: number;
|
||
|
|
emergence_date?: string;
|
||
|
|
strong_seedling_date?: string;
|
||
|
|
strong_seedling_count?: number;
|
||
|
|
stage?: string;
|
||
|
|
bre_personnel_id?: number;
|
||
|
|
remark?: string;
|
||
|
|
}
|