From af1ccd0559de152d296811f74d41c3bdd696fe77 Mon Sep 17 00:00:00 2001 From: buaixuexideshitongxue <2936013465@qq.com> Date: Wed, 31 Dec 2025 16:18:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=89=E8=AE=BF=E6=B6=89=E8=AF=89--=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=B6=E5=9B=9E=E6=98=BE=E6=96=87=E4=BB=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/data/ComplaintCollection.vue | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/views/data/ComplaintCollection.vue b/src/views/data/ComplaintCollection.vue index 3b2812c..717968c 100644 --- a/src/views/data/ComplaintCollection.vue +++ b/src/views/data/ComplaintCollection.vue @@ -550,8 +550,31 @@ const updateForm = ref({ handleMethod: "", involveProblemIdList: [], 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 r = JSON.parse(JSON.stringify(row || {})) @@ -580,6 +603,12 @@ const handleUpdate = async (row) => { tags: splitToArray(r.tags ?? r.tag), businessTypeName: r.businessTypeName ?? '', businessTypeCode: r.businessTypeCode ?? '', + thingFiles: normalizeThingFiles(r.thingFiles).map(f => ({ + ...f, + loading: false, + percent: 100, + uid: f.uid || `${f.filePath}-${Math.random()}`, + })), }; updateShow.value = true }