|
|
|
@ -550,8 +550,31 @@ const updateForm = ref({ |
|
|
|
handleMethod: "", |
|
|
|
handleMethod: "", |
|
|
|
involveProblemIdList: [], |
|
|
|
involveProblemIdList: [], |
|
|
|
tags: [], |
|
|
|
tags: [], |
|
|
|
|
|
|
|
thingFiles:[], |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function normalizeThingFiles(val) { |
|
|
|
|
|
|
|
if (!val) return [] |
|
|
|
|
|
|
|
if (Array.isArray(val)) return val |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 后端可能返回 JSON 字符串 |
|
|
|
|
|
|
|
if (typeof val === 'string' && val.trim().startsWith('[')) { |
|
|
|
|
|
|
|
try { return JSON.parse(val) } catch { /* ignore */ } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 后端可能返回 "path1,path2" |
|
|
|
|
|
|
|
if (typeof val === 'string') { |
|
|
|
|
|
|
|
return val.split(/[,,]/).map(s => s.trim()).filter(Boolean).map(p => ({ |
|
|
|
|
|
|
|
filePath: p, |
|
|
|
|
|
|
|
fileName: p.split('/').pop() || p, |
|
|
|
|
|
|
|
loading: false, |
|
|
|
|
|
|
|
percent: 100, |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 修改按钮点击事件 |
|
|
|
// 修改按钮点击事件 |
|
|
|
const handleUpdate = async (row) => { |
|
|
|
const handleUpdate = async (row) => { |
|
|
|
const r = JSON.parse(JSON.stringify(row || {})) |
|
|
|
const r = JSON.parse(JSON.stringify(row || {})) |
|
|
|
@ -580,6 +603,12 @@ const handleUpdate = async (row) => { |
|
|
|
tags: splitToArray(r.tags ?? r.tag), |
|
|
|
tags: splitToArray(r.tags ?? r.tag), |
|
|
|
businessTypeName: r.businessTypeName ?? '', |
|
|
|
businessTypeName: r.businessTypeName ?? '', |
|
|
|
businessTypeCode: r.businessTypeCode ?? '', |
|
|
|
businessTypeCode: r.businessTypeCode ?? '', |
|
|
|
|
|
|
|
thingFiles: normalizeThingFiles(r.thingFiles).map(f => ({ |
|
|
|
|
|
|
|
...f, |
|
|
|
|
|
|
|
loading: false, |
|
|
|
|
|
|
|
percent: 100, |
|
|
|
|
|
|
|
uid: f.uid || `${f.filePath}-${Math.random()}`, |
|
|
|
|
|
|
|
})), |
|
|
|
}; |
|
|
|
}; |
|
|
|
updateShow.value = true |
|
|
|
updateShow.value = true |
|
|
|
} |
|
|
|
} |
|
|
|
|