init: 初始化 dpb 桃育种系统代码库
前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/bre/trial";
|
||||
|
||||
const TrialAPI = {
|
||||
getTrialList(query: TrialPageQuery) {
|
||||
return request<ApiResponse<PageResult<TrialTable>>>({
|
||||
url: `${API_PATH}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
getTrialDetail(query: number) {
|
||||
return request<ApiResponse<TrialTable>>({
|
||||
url: `${API_PATH}/detail/${query}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
getTrialOptions() {
|
||||
return request<ApiResponse<TrialOption[]>>({
|
||||
url: `${API_PATH}/options`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createTrial(body: TrialForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateTrial(id: number, body: TrialForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/update/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteTrial(body: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
exportTrial(body: TrialPageQuery) {
|
||||
return request<Blob>({
|
||||
url: `${API_PATH}/export`,
|
||||
method: "post",
|
||||
data: body,
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
downloadTemplateTrial() {
|
||||
return request<Blob>({
|
||||
url: `${API_PATH}/download/template`,
|
||||
method: "post",
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
importTrial(body: FormData) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/import`,
|
||||
method: "post",
|
||||
data: body,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default TrialAPI;
|
||||
|
||||
export interface TrialPageQuery extends PageQuery, UserByQueryParams {
|
||||
trial_name?: string;
|
||||
trial_type?: string;
|
||||
design_type?: string;
|
||||
start_year?: number;
|
||||
end_year?: number;
|
||||
}
|
||||
|
||||
export interface TrialOption {
|
||||
value: number;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface TrialTable extends BaseType {
|
||||
trial_name?: string;
|
||||
trial_type?: string;
|
||||
design_type?: string;
|
||||
start_year?: number;
|
||||
end_year?: number;
|
||||
objective?: string;
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
export interface TrialForm extends BaseFormType {
|
||||
trial_name?: string;
|
||||
trial_type?: string;
|
||||
design_type?: string;
|
||||
start_year?: number;
|
||||
end_year?: number;
|
||||
objective?: string;
|
||||
remark?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user