113 lines
2.3 KiB
Plaintext
113 lines
2.3 KiB
Plaintext
import { request } from "@utils";
|
|||
|
|
|
||
|
|
const API_PATH = "/bre/tree_photo";
|
||
|
|
|
||
|
|
const TreePhotoAPI = {
|
||
|
|
getTreePhotoList(query: TreePhotoPageQuery) {
|
||
|
|
return request<ApiResponse<PageResult<TreePhotoTable>>>({
|
||
|
|
url: `${API_PATH}/list`,
|
||
|
|
method: "get",
|
||
|
|
params: query,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
getTreePhotoDetail(query: number) {
|
||
|
|
return request<ApiResponse<TreePhotoTable>>({
|
||
|
|
url: `${API_PATH}/detail/${query}`,
|
||
|
|
method: "get",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
getTreePhotoOptions() {
|
||
|
|
return request<ApiResponse<TreePhotoOption[]>>({
|
||
|
|
url: `${API_PATH}/options`,
|
||
|
|
method: "get",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
createTreePhoto(body: TreePhotoForm) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/create`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
updateTreePhoto(id: number, body: TreePhotoForm) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/update/${id}`,
|
||
|
|
method: "put",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
deleteTreePhoto(body: number[]) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/delete`,
|
||
|
|
method: "delete",
|
||
|
|
data: body,
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
exportTreePhoto(body: TreePhotoPageQuery) {
|
||
|
|
return request<Blob>({
|
||
|
|
url: `${API_PATH}/export`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
responseType: "blob",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
downloadTemplateTreePhoto() {
|
||
|
|
return request<Blob>({
|
||
|
|
url: `${API_PATH}/download/template`,
|
||
|
|
method: "post",
|
||
|
|
responseType: "blob",
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
importTreePhoto(body: FormData) {
|
||
|
|
return request<ApiResponse>({
|
||
|
|
url: `${API_PATH}/import`,
|
||
|
|
method: "post",
|
||
|
|
data: body,
|
||
|
|
headers: {
|
||
|
|
"Content-Type": "multipart/form-data",
|
||
|
|
},
|
||
|
|
});
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export default TreePhotoAPI;
|
||
|
|
|
||
|
|
export interface TreePhotoPageQuery extends PageQuery, UserByQueryParams {
|
||
|
|
combination_id?: number;
|
||
|
|
tree_id?: number;
|
||
|
|
photo_type?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface TreePhotoOption {
|
||
|
|
value: number;
|
||
|
|
label: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface TreePhotoTable extends BaseType {
|
||
|
|
combination_id?: number;
|
||
|
|
combination_name?: string;
|
||
|
|
tree_id?: number;
|
||
|
|
tree_name?: string;
|
||
|
|
photo_type?: string;
|
||
|
|
photo_url?: string;
|
||
|
|
capture_date?: string;
|
||
|
|
remark?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface TreePhotoForm extends BaseFormType {
|
||
|
|
combination_id?: number;
|
||
|
|
tree_id?: number;
|
||
|
|
photo_type?: string;
|
||
|
|
photo_url?: string;
|
||
|
|
capture_date?: string;
|
||
|
|
remark?: string;
|
||
|
|
}
|