import { request } from "@utils"; const API_PATH = "/bre/plan"; const PlanAPI = { getPlanList(query: PlanPageQuery) { return request>>({ url: `${API_PATH}/list`, method: "get", params: query, }); }, getPlanDetail(query: number) { return request>({ url: `${API_PATH}/detail/${query}`, method: "get", }); }, getPlanOptions() { return request>({ url: `${API_PATH}/options`, method: "get", }); }, createPlan(body: PlanForm) { return request({ url: `${API_PATH}/create`, method: "post", data: body, }); }, updatePlan(id: number, body: PlanForm) { return request({ url: `${API_PATH}/update/${id}`, method: "put", data: body, }); }, deletePlan(body: number[]) { return request({ url: `${API_PATH}/delete`, method: "delete", data: body, }); }, exportPlan(body: PlanPageQuery) { return request({ url: `${API_PATH}/export`, method: "post", data: body, responseType: "blob", }); }, downloadTemplatePlan() { return request({ url: `${API_PATH}/download/template`, method: "post", responseType: "blob", }); }, importPlan(body: FormData) { return request({ url: `${API_PATH}/import`, method: "post", data: body, headers: { "Content-Type": "multipart/form-data", }, }); }, }; export default PlanAPI; export interface PlanPageQuery extends PageQuery, UserByQueryParams { plan_code?: string; plan_name?: string; start_year?: number; end_year?: number; } export interface PlanOption { value: number; label: string; } export interface PlanTable extends BaseType { plan_code?: string; plan_name?: string; objective?: string; start_year?: number; end_year?: number; leader?: string; remark?: string; } export interface PlanForm extends BaseFormType { plan_code?: string; plan_name?: string; objective?: string; start_year?: number; end_year?: number; leader?: string; remark?: string; }