Files
dpb/backend/scripts/_backup_query_param/selection_rule__api.ts.bak
T

121 lines
2.5 KiB
Plaintext
Raw Normal View History

import { request } from "@utils";
const API_PATH = "/bre/selection_rule";
const SelectionRuleAPI = {
getSelectionRuleList(query: SelectionRulePageQuery) {
return request<ApiResponse<PageResult<SelectionRuleTable>>>({
url: `${API_PATH}/list`,
method: "get",
params: query,
});
},
getSelectionRuleDetail(query: number) {
return request<ApiResponse<SelectionRuleTable>>({
url: `${API_PATH}/detail/${query}`,
method: "get",
});
},
getSelectionRuleOptions() {
return request<ApiResponse<SelectionRuleOption[]>>({
url: `${API_PATH}/options`,
method: "get",
});
},
createSelectionRule(body: SelectionRuleForm) {
return request<ApiResponse>({
url: `${API_PATH}/create`,
method: "post",
data: body,
});
},
updateSelectionRule(id: number, body: SelectionRuleForm) {
return request<ApiResponse>({
url: `${API_PATH}/update/${id}`,
method: "put",
data: body,
});
},
deleteSelectionRule(body: number[]) {
return request<ApiResponse>({
url: `${API_PATH}/delete`,
method: "delete",
data: body,
});
},
exportSelectionRule(body: SelectionRulePageQuery) {
return request<Blob>({
url: `${API_PATH}/export`,
method: "post",
data: body,
responseType: "blob",
});
},
downloadTemplateSelectionRule() {
return request<Blob>({
url: `${API_PATH}/download/template`,
method: "post",
responseType: "blob",
});
},
importSelectionRule(body: FormData) {
return request<ApiResponse>({
url: `${API_PATH}/import`,
method: "post",
data: body,
headers: {
"Content-Type": "multipart/form-data",
},
});
},
};
export default SelectionRuleAPI;
export interface SelectionRulePageQuery extends PageQuery, UserByQueryParams {
rule_name?: string;
target_id?: number;
stage?: string;
logic?: string;
action?: string;
enabled?: string;
}
export interface SelectionRuleOption {
value: number;
label: string;
}
export interface SelectionRuleTable extends BaseType {
rule_name?: string;
target_id?: number;
target_name?: string;
stage?: string;
conditions_json?: string;
logic?: string;
action?: string;
priority?: number;
enabled?: string;
remark?: string;
}
export interface SelectionRuleForm extends BaseFormType {
rule_name?: string;
target_id?: number;
stage?: string;
conditions_json?: string;
logic?: string;
action?: string;
priority?: number;
enabled?: string;
remark?: string;
}