diff --git a/frontend/src/views/system/tenants/Index.vue b/frontend/src/views/system/tenants/Index.vue index 8e82475..18c25e8 100644 --- a/frontend/src/views/system/tenants/Index.vue +++ b/frontend/src/views/system/tenants/Index.vue @@ -571,8 +571,19 @@ const handleDelete = (record: Tenant) => { }) } +/** 提交前去除表单字符串字段首尾空格,再执行校验与保存 */ +const trimTenantFormStrings = () => { + form.name = (form.name ?? '').trim() + form.code = (form.code ?? '').trim() + form.domain = (form.domain ?? '').trim() + form.description = (form.description ?? '').trim() + form.adminUsername = (form.adminUsername ?? '').trim() + form.adminPassword = (form.adminPassword ?? '').trim() +} + const handleSubmit = async () => { try { + trimTenantFormStrings() await formRef.value?.validate() submitLoading.value = true