fix: update_buy perm_code=None 导致 NoneType 崩溃 + validateUnique 编辑时排除自身改用 Number() 防类型不一致

This commit is contained in:
yueli
2026-07-17 16:57:46 +08:00
parent a8fb0cfc94
commit 9bcd02c742
4 changed files with 12 additions and 15 deletions

View File

@ -1028,8 +1028,9 @@ const hasFormFieldPermission = (fieldName: string) => {
// ------------------------------------
const validateUnique = (rule: any, value: string, callback: any) => {
if (!value) return callback()
const currentId = form.id != null ? Number(form.id) : null
const isDuplicate = tableData.value.some((row: any) => {
if (dialogStatus.value === 'update' && row.id === form.id) return false
if (dialogStatus.value === 'update' && currentId != null && Number(row.id) === currentId) return false
if (rule.field === 'serial_number' && row.serial_number === value) return true
return false
})