114 lines
2.3 KiB
Plaintext
114 lines
2.3 KiB
Plaintext
import { request } from "@utils";
|
|
|
|
const API_PATH = "/bre/trial_study";
|
|
|
|
const TrialStudyAPI = {
|
|
getTrialStudyList(query: TrialStudyPageQuery) {
|
|
return request<ApiResponse<PageResult<TrialStudyTable>>>({
|
|
url: `${API_PATH}/list`,
|
|
method: "get",
|
|
params: query,
|
|
});
|
|
},
|
|
|
|
getTrialStudyDetail(query: number) {
|
|
return request<ApiResponse<TrialStudyTable>>({
|
|
url: `${API_PATH}/detail/${query}`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
getTrialStudyOptions() {
|
|
return request<ApiResponse<TrialStudyOption[]>>({
|
|
url: `${API_PATH}/options`,
|
|
method: "get",
|
|
});
|
|
},
|
|
|
|
createTrialStudy(body: TrialStudyForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/create`,
|
|
method: "post",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
updateTrialStudy(id: number, body: TrialStudyForm) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/update/${id}`,
|
|
method: "put",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
deleteTrialStudy(body: number[]) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/delete`,
|
|
method: "delete",
|
|
data: body,
|
|
});
|
|
},
|
|
|
|
exportTrialStudy(body: TrialStudyPageQuery) {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/export`,
|
|
method: "post",
|
|
data: body,
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
downloadTemplateTrialStudy() {
|
|
return request<Blob>({
|
|
url: `${API_PATH}/download/template`,
|
|
method: "post",
|
|
responseType: "blob",
|
|
});
|
|
},
|
|
|
|
importTrialStudy(body: FormData) {
|
|
return request<ApiResponse>({
|
|
url: `${API_PATH}/import`,
|
|
method: "post",
|
|
data: body,
|
|
headers: {
|
|
"Content-Type": "multipart/form-data",
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
export default TrialStudyAPI;
|
|
|
|
export interface TrialStudyPageQuery extends PageQuery, UserByQueryParams {
|
|
trial_id?: number;
|
|
study_name?: string;
|
|
site_id?: number;
|
|
}
|
|
|
|
export interface TrialStudyOption {
|
|
value: number;
|
|
label: string;
|
|
}
|
|
|
|
export interface TrialStudyTable extends BaseType {
|
|
trial_id?: number;
|
|
trial_name?: string;
|
|
study_name?: string;
|
|
site_id?: number;
|
|
year?: number;
|
|
block_count?: number;
|
|
design_type?: string;
|
|
remark?: string;
|
|
}
|
|
|
|
export interface TrialStudyForm extends BaseFormType {
|
|
trial_id?: number;
|
|
study_name?: string;
|
|
site_id?: number;
|
|
year?: number;
|
|
block_count?: number;
|
|
design_type?: string;
|
|
remark?: string;
|
|
}
|