fix: update_buy perm_code=None 导致 NoneType 崩溃 + validateUnique 编辑时排除自身改用 Number() 防类型不一致
This commit is contained in:
@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user