feat: reset validation for member form on dialog open and enhance submission validation
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
wxg0103 2025-12-30 09:22:56 +08:00
parent c44b5c9552
commit ca743bacc1

View File

@ -87,6 +87,9 @@ const form = ref<{
function open(ids: string[]) {
form.value = { ...defaultForm, ids }
list.value = [{ role_id: '', workspace_ids: [] }]
if (memberFormContentRef.value) {
memberFormContentRef.value.resetValidation()
}
dialogVisible.value = true
}
@ -96,11 +99,15 @@ const rules = reactive({
is_append: [{ required: true, message: t('common.selectPlaceholder'), trigger: 'blur' }],
})
const memberFormContentRef = ref<InstanceType<typeof MemberFormContent>>()
const loading = ref<boolean>(false)
const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate((valid) => {
await formEl.validate(async (valid) => {
if (valid) {
if (memberFormContentRef.value) {
await memberFormContentRef.value?.validate()
}
if (user.isPE()) {
const data = {
is_append: form.value.is_append,
@ -119,7 +126,7 @@ const submit = async (formEl: FormInstance | undefined) => {
// ['None']
if (isAdminRole) {
return { ...item, workspace_ids: ['None'] }
return {...item, workspace_ids: ['None']}
}
return item
})