|
|
|
|
@ -62,11 +62,23 @@ const ensureSubjectOptionsLoaded = async () => {
|
|
|
|
|
|
|
|
|
|
const parseIds = (value: any): Array<number | string> => {
|
|
|
|
|
if (!value) return []
|
|
|
|
|
if (Array.isArray(value)) return value
|
|
|
|
|
return String(value)
|
|
|
|
|
const raw = Array.isArray(value)
|
|
|
|
|
? value
|
|
|
|
|
: String(value)
|
|
|
|
|
.split(',')
|
|
|
|
|
.map((v) => v.trim())
|
|
|
|
|
.filter((v) => v !== '')
|
|
|
|
|
|
|
|
|
|
return raw
|
|
|
|
|
.map((v) => {
|
|
|
|
|
if (typeof v === 'number') return v
|
|
|
|
|
const s = String(v).trim()
|
|
|
|
|
if (!s) return undefined
|
|
|
|
|
const n = Number(s)
|
|
|
|
|
if (Number.isFinite(n) && String(n) === s) return n
|
|
|
|
|
return s
|
|
|
|
|
})
|
|
|
|
|
.filter((v): v is number | string => v !== undefined)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const initFormData = () => ({
|
|
|
|
|
@ -98,7 +110,7 @@ const open = async (type: 'create' | 'update', row?: Partial<PlanMaintenanceVO>)
|
|
|
|
|
planName: (row.planName as any) ?? '',
|
|
|
|
|
planType: (row.planType as any) ?? undefined,
|
|
|
|
|
description: (row.description as any) ?? '',
|
|
|
|
|
subjectIds: parseIds((row as any).subjectIdS)
|
|
|
|
|
subjectIds: parseIds((row as any).subjectIds ?? (row as any).subjectIdS)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|