feat: 取客户最大sn

This commit is contained in:
caiyuchao
2025-05-26 10:19:36 +08:00
parent 588709c589
commit 701c56e0b3
2 changed files with 14 additions and 1 deletions

View File

@@ -63,4 +63,9 @@ async function isCustomerNameExists(
}); });
} }
export { isCustomerNameExists }; /** 查询当前最大sn */
async function getMaxSn() {
return requestClient.get<boolean>('/license/customer/max-sn');
}
export { getMaxSn, isCustomerNameExists };

View File

@@ -11,6 +11,7 @@ import { useVbenForm } from '#/adapter/form';
import { import {
createCustomer, createCustomer,
getCustomer, getCustomer,
getMaxSn,
updateCustomer, updateCustomer,
} from '#/api/license/customer'; } from '#/api/license/customer';
import { $t } from '#/locales'; import { $t } from '#/locales';
@@ -78,9 +79,16 @@ const [Modal, modalApi] = useVbenModal({
modalApi.unlock(); modalApi.unlock();
} }
} }
// 设置到 values // 设置到 values
formData.value = data; formData.value = data;
await formApi.setValues(formData.value); await formApi.setValues(formData.value);
// 设置最大SN
const maxSn = await getMaxSn();
if (!formData.value?.code) {
formApi.setFieldValue('code', maxSn);
}
}, },
}); });
</script> </script>