Browse Source

涉访涉诉--修改时回显文件列表

master
buaixuexideshitongxue 1 month ago
parent
commit
af1ccd0559
  1. 29
      src/views/data/ComplaintCollection.vue

29
src/views/data/ComplaintCollection.vue

@ -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
} }

Loading…
Cancel
Save