2026-04-15 15:30:20 +08:00
|
|
|
/*
|
|
|
|
|
* 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';
|
2026-04-17 14:52:10 +08:00
|
|
|
import type { RuleConfig, RuleConfigPageableResponse, RuleConfigRequest, RuleDictItem, RuleGraphPayload, RuleParamMeta } from './types';
|
2026-04-15 15:30:20 +08:00
|
|
|
|
|
|
|
|
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');
|
|
|
|
|
};
|
2026-04-17 14:52:10 +08:00
|
|
|
|
|
|
|
|
export const findRuleConfigGraph = (query: Partial<RuleConfigRequest> = {}): Promise<ApiDataResponse<RuleGraphPayload>> => {
|
|
|
|
|
return req.get('/system/rule/config/graph', query);
|
|
|
|
|
};
|