From 15beca11c81e81f550e846cdfe6758cc26c39f85 Mon Sep 17 00:00:00 2001 From: wangyu <823267011@qq.com> Date: Wed, 20 May 2026 14:05:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=B8=E8=BD=A7=E5=AE=9E?= =?UTF-8?q?=E7=BB=A9=E6=8F=90=E4=BA=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acid/components/ActualPerformance.vue | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/klp-ui/src/views/micro/pages/acid/components/ActualPerformance.vue b/klp-ui/src/views/micro/pages/acid/components/ActualPerformance.vue index d67a4ba3..728ffdce 100644 --- a/klp-ui/src/views/micro/pages/acid/components/ActualPerformance.vue +++ b/klp-ui/src/views/micro/pages/acid/components/ActualPerformance.vue @@ -430,6 +430,12 @@ export default { async handleRowClick(row) { // 快速点击防重:每次点击递增版本号,旧的 sync 任务检测到版本号变更后自动放弃 const clickRev = ++this._clickRev + + // 记录点击前的钢卷号,用于判断是否同一行重复点击 + const prevExcoilId = this.selectedRow + ? (this.selectedRow.EXCOILID || this.selectedRow.excoilid || null) + : null + this.selectedRow = row this.segData = null this.gaugeRows = null @@ -450,8 +456,12 @@ export default { // 如果期间又点击了其他行则放弃后续操作 if (this._clickRev !== clickRev) return - // 后台静默同步到规程(不阻塞 UI) - this.autoSyncToActiveSpec(excoilId || encoilId, clickRev) + // 同一钢卷重复点击:跳过规程同步,避免重复写入 + const isSameCoil = excoilId && excoilId === prevExcoilId + if (!isSameCoil) { + // 后台静默同步到规程(不阻塞 UI) + this.autoSyncToActiveSpec(excoilId || encoilId, clickRev) + } await this.$nextTick() // 加载完成后自动选中第一个趋势参数 @@ -879,22 +889,34 @@ export default { for (const item of items) { if (guard()) return - // 确保 plan 点位存在 + // 确保 plan 点位存在(幂等:插入失败时降级重查,应对并发竞态) let planId const ep = planMap[item.pointCode] if (ep) { planId = ep.planId } else { - const r = await addProcessPlan({ - versionId, - segmentType: 'PROCESS', - segmentName: item.groupLabel, - pointName: item.pointName, - pointCode: item.pointCode, - sortOrder: 0 - }) - if (guard()) return - planId = r.data + try { + const r = await addProcessPlan({ + versionId, + segmentType: 'PROCESS', + segmentName: item.groupLabel, + pointName: item.pointName, + pointCode: item.pointCode, + sortOrder: 0 + }) + if (guard()) return + planId = r.data + // 写入本地 map,同一次 sync 内不再重复插入 + planMap[item.pointCode] = { planId } + } catch (_dupErr) { + // 唯一键冲突:该点位已由并发请求写入,重新查询获取真实 planId + const refetch = await listProcessPlan({ versionId, pageNum: 1, pageSize: 500 }) + if (guard()) return + const found = (refetch.rows || []).find(p => p.pointCode === item.pointCode) + if (!found) continue // 极端情况:查不到则跳过本条目 + planId = found.planId + planMap[item.pointCode] = found + } } // 查已存储参数