45 lines
1.6 KiB
TypeScript
45 lines
1.6 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, 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');
|
||
|
|
};
|