From 4556114b4d6ca9617f542b4cd613295a943d5325 Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Sun, 11 Oct 2026 16:34:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=AE=A1=E6=A0=B8):=20=E9=98=BB=E6=96=AD?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E5=9E=8B=20chainId=20=E5=8D=A0=E4=BD=8D?= =?UTF-8?q?=E7=AC=A6=E5=86=99=E5=85=A5=20yxe=5Fself=5Freport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit normalizeMerchantChain 的兜底链以 `chain_${index}` 结尾,该值是数组下标而非 连锁标识。审核员改门店时 saveMerchantEdit 会把 chain.id 直接写入 chainId, 落库后按连锁筛选(YxeSelfReportMapper.xml: a.chain_id = #{param.chainId} 等值匹配)就再也筛不出这条记录。 存量数据已出现 chain_3/chain_6 等脏值,导致 5 条已通过记录按连锁筛选时 永久漏查。本次修复: - 兜底链结尾改用连锁名(与提交端 create.vue 的 `?? chainName` 对齐) - saveMerchantEdit 写入前拦截 `chain_` 前缀,退回连锁名 后端 MerchantServiceImpl.groupByChain 已返回稳定 chainId,正常路径不再回退。 --- pages/audit/components/AuditSelfReportItem.vue | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pages/audit/components/AuditSelfReportItem.vue b/pages/audit/components/AuditSelfReportItem.vue index 826e660..35e96d7 100644 --- a/pages/audit/components/AuditSelfReportItem.vue +++ b/pages/audit/components/AuditSelfReportItem.vue @@ -702,7 +702,11 @@ export default { }, normalizeMerchantChain(item = {}, index) { const text = item.chainName || item.chain || item.chainAbb || item.name || item.title || `连锁${index + 1}` - const id = item.chainId ?? item.chain_id ?? item.id ?? item.chainCode ?? item.chain_code ?? `chain_${index}` + // 兜底必须用连锁名,不能用 `chain_${index}` 这类位置型占位符: + // 该 id 会被 saveMerchantEdit 写进 yxe_self_report.chain_id,而按连锁筛选走的是 + // 等值匹配(YxeSelfReportMapper.xml: a.chain_id = #{param.chainId}), + // 占位符一旦落库,这条记录就再也筛不出来(后端已返回稳定 chainId,此处为兜底防线)。 + const id = item.chainId ?? item.chain_id ?? item.id ?? item.chainCode ?? item.chain_code ?? text const childKeys = ['children', 'merchantList', 'merchants', 'shopList', 'list', 'records'] let children = [] for (let i = 0; i < childKeys.length; i += 1) { @@ -782,16 +786,22 @@ export default { return } this.merchantEditSaving = true + // 写入前兜底:`chain_${index}` 这类位置型占位符不能落库(详见 normalizeMerchantChain 注释), + // 否则该记录会被按连锁等值筛选永久漏掉。这里退回用连锁名作为标识。 + const chainIdText = String(chain.id ?? '').trim() + const safeChainId = !chainIdText || chainIdText.startsWith('chain_') + ? String(chain.text || '').trim() + : chainIdText try { await selfReportChangeReq({ id: this.currentRecord.id, - chainId: chain.id, + chainId: safeChainId, chainName: chain.text, merchantId: merchant.id, merchantName: merchant.text }) this.detailData = Object.assign({}, this.currentRecord, { - chainId: chain.id, + chainId: safeChainId, chainName: chain.text, merchantId: merchant.id, merchantName: merchant.text