修复酸轧实绩提交问题
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
// 查已存储参数
|
||||
|
||||
Reference in New Issue
Block a user