From 701c56e0b302996cc72d0967895f6fe9f5e57a05 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Mon, 26 May 2025 10:19:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=96=E5=AE=A2=E6=88=B7=E6=9C=80?= =?UTF-8?q?=E5=A4=A7sn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/license/customer/index.ts | 7 ++++++- apps/web-antd/src/views/license/customer/modules/form.vue | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/web-antd/src/api/license/customer/index.ts b/apps/web-antd/src/api/license/customer/index.ts index fa3319c..ac1415e 100644 --- a/apps/web-antd/src/api/license/customer/index.ts +++ b/apps/web-antd/src/api/license/customer/index.ts @@ -63,4 +63,9 @@ async function isCustomerNameExists( }); } -export { isCustomerNameExists }; +/** 查询当前最大sn */ +async function getMaxSn() { + return requestClient.get('/license/customer/max-sn'); +} + +export { getMaxSn, isCustomerNameExists }; diff --git a/apps/web-antd/src/views/license/customer/modules/form.vue b/apps/web-antd/src/views/license/customer/modules/form.vue index c94c51f..c72b7bb 100644 --- a/apps/web-antd/src/views/license/customer/modules/form.vue +++ b/apps/web-antd/src/views/license/customer/modules/form.vue @@ -11,6 +11,7 @@ import { useVbenForm } from '#/adapter/form'; import { createCustomer, getCustomer, + getMaxSn, updateCustomer, } from '#/api/license/customer'; import { $t } from '#/locales'; @@ -78,9 +79,16 @@ const [Modal, modalApi] = useVbenModal({ modalApi.unlock(); } } + // 设置到 values formData.value = data; await formApi.setValues(formData.value); + + // 设置最大SN + const maxSn = await getMaxSn(); + if (!formData.value?.code) { + formApi.setFieldValue('code', maxSn); + } }, });