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); + } }, });