From c9a10bbac0f075013c70ba85a8a4b060d677bdc3 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Mon, 26 May 2025 10:51:12 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E6=A0=A1=E9=AA=8C=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E7=A7=B0=E6=98=AF=E5=90=A6=E5=94=AF=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/license/customer/index.ts | 8 ++++---- apps/web-antd/src/views/license/customer/data.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/web-antd/src/api/license/customer/index.ts b/apps/web-antd/src/api/license/customer/index.ts index ac1415e..de125ba 100644 --- a/apps/web-antd/src/api/license/customer/index.ts +++ b/apps/web-antd/src/api/license/customer/index.ts @@ -53,12 +53,12 @@ export function exportCustomer(params: any) { return requestClient.download('/license/customer/export-excel', params); } -/** 客户名称是否存在 */ -async function isCustomerNameExists( +/** 客户名称是否唯一 */ +async function isCustomerNameUnique( name: string, id?: CustomerApi.Customer['id'], ) { - return requestClient.get('/license/customer/name-exists', { + return requestClient.get('/license/customer/name-unique', { params: { id, name }, }); } @@ -68,4 +68,4 @@ async function getMaxSn() { return requestClient.get('/license/customer/max-sn'); } -export { getMaxSn, isCustomerNameExists }; +export { getMaxSn, isCustomerNameUnique }; diff --git a/apps/web-antd/src/views/license/customer/data.ts b/apps/web-antd/src/views/license/customer/data.ts index f9a61a0..33145d1 100644 --- a/apps/web-antd/src/views/license/customer/data.ts +++ b/apps/web-antd/src/views/license/customer/data.ts @@ -7,7 +7,7 @@ import { ref } from 'vue'; import { useAccess } from '@vben/access'; import { z } from '#/adapter/form'; -import { isCustomerNameExists } from '#/api/license/customer'; +import { isCustomerNameUnique } from '#/api/license/customer'; import { getAreaTree } from '#/api/system/area'; import { $t } from '#/locales'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils'; @@ -39,7 +39,7 @@ export function useFormSchema(): VbenFormSchema[] { ) .refine( async (value: string) => { - return !(await isCustomerNameExists(value, formData.value?.id)); + return await isCustomerNameUnique(value, formData.value?.id); }, (value) => ({ message: $t('ui.formRules.alreadyExists', [