53 lines
2.0 KiB
TypeScript
53 lines
2.0 KiB
TypeScript
/*
|
|
* This file is part of the kernelstudio package.
|
|
*
|
|
* (c) 2014-2026 zlin <admin@kernelstudio.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE file
|
|
* that was distributed with this source code.
|
|
*/
|
|
|
|
import { HttpRequestClient } from '@/utils/request';
|
|
import type { ApiDataResponse, BasicResponse } from '@/types';
|
|
import type { RuleConfig, RuleConfigPageableResponse, RuleConfigRequest, RuleDictItem, RuleFourBlocksPayload, RuleGraphPayload, RuleParamMeta } from './types';
|
|
|
|
const req = HttpRequestClient.create<BasicResponse>({
|
|
baseURL: '/api',
|
|
});
|
|
|
|
export const findRuleConfigByQuery = (query: Partial<RuleConfigRequest> = {}): Promise<RuleConfigPageableResponse> => {
|
|
return req.get('/system/rule/config/list', query);
|
|
};
|
|
|
|
export const findRuleConfigByCode = (ruleCode: string): Promise<ApiDataResponse<RuleConfig>> => {
|
|
return req.get(`/system/rule/config/${ruleCode}`);
|
|
};
|
|
|
|
export const createRuleConfig = (ruleConfig: RuleConfig): Promise<BasicResponse> => {
|
|
return req.postJson('/system/rule/config', ruleConfig);
|
|
};
|
|
|
|
export const updateRuleConfig = (ruleConfig: RuleConfig): Promise<BasicResponse> => {
|
|
return req.putJson('/system/rule/config', ruleConfig);
|
|
};
|
|
|
|
export const deleteRuleConfig = (ruleCode: string): Promise<BasicResponse> => {
|
|
return req.delete(`/system/rule/config/${ruleCode}`);
|
|
};
|
|
|
|
export const findRuleDictByType = (dictType: string): Promise<ApiDataResponse<RuleDictItem[]>> => {
|
|
return req.get(`/system/rule/config/dict/${dictType}`);
|
|
};
|
|
|
|
export const findRuleParamMeta = (): Promise<ApiDataResponse<RuleParamMeta[]>> => {
|
|
return req.get('/system/rule/config/param-meta');
|
|
};
|
|
|
|
export const findRuleConfigGraph = (query: Partial<RuleConfigRequest> = {}): Promise<ApiDataResponse<RuleGraphPayload>> => {
|
|
return req.get('/system/rule/config/graph', query);
|
|
};
|
|
|
|
export const findRuleFourBlocksGraph = (): Promise<ApiDataResponse<RuleFourBlocksPayload>> => {
|
|
return req.get('/system/rule/config/graph/four-blocks');
|
|
};
|