diff --git a/apps/web-antd/src/api/infra/autocode/gencode/index.ts b/apps/web-antd/src/api/infra/autocode/gencode/index.ts index b79d1d537..0cac76727 100644 --- a/apps/web-antd/src/api/infra/autocode/gencode/index.ts +++ b/apps/web-antd/src/api/infra/autocode/gencode/index.ts @@ -1,17 +1,18 @@ import { requestClient } from '#/api/request'; -export const genCodeApi = { - /** - * 获取自动生成的编号 - * @param ruleCode 规则代码 - * @param inputCharacter 输入字符(可选) - * @returns 生成的编号字符串 - */ - getAutoCode: async (ruleCode: string, inputCharacter?: string) => { - // 根据是否有输入字符拼接不同的URL +/** + * 自动生成编码规则 API + */ +export function genCodeApi() { + async function getAutoCode( + ruleCode: string, + inputCharacter?: string, + ): Promise { const url = inputCharacter ? `/infra/auto-code/get/${ruleCode}/${inputCharacter}` : `/infra/auto-code/get/${ruleCode}`; - return await requestClient.get(url); - }, -}; + return requestClient.get(url); + } + + return { getAutoCode }; +}