|
|
|
@ -414,10 +414,13 @@ export default { |
|
|
|
if (!level) { |
|
|
|
if (!level) { |
|
|
|
console.warn('[积分档位] level 为空,跳过查询,tierOptions 清空') |
|
|
|
console.warn('[积分档位] level 为空,跳过查询,tierOptions 清空') |
|
|
|
this.tierOptions = [] |
|
|
|
this.tierOptions = [] |
|
|
|
|
|
|
|
this.applyTierFallback() |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
this.tierLoading = true |
|
|
|
this.tierLoading = true |
|
|
|
getRulesByLevel(level).then(res => { |
|
|
|
const params = { hazardLevel: level } |
|
|
|
|
|
|
|
if (this.report.factoryDeptId) params.deptId = this.report.factoryDeptId |
|
|
|
|
|
|
|
getRulesByLevel(params).then(res => { |
|
|
|
console.log('[积分档位] getRulesByLevel 原始返回 =', JSON.stringify(res)) |
|
|
|
console.log('[积分档位] getRulesByLevel 原始返回 =', JSON.stringify(res)) |
|
|
|
const data = (res && res.data) || res || {} |
|
|
|
const data = (res && res.data) || res || {} |
|
|
|
console.log('[积分档位] 解析后的 data =', JSON.stringify(data)) |
|
|
|
console.log('[积分档位] 解析后的 data =', JSON.stringify(data)) |
|
|
|
@ -429,15 +432,26 @@ export default { |
|
|
|
label: String(item.hazardCategory || item.ruleName || '').toUpperCase() |
|
|
|
label: String(item.hazardCategory || item.ruleName || '').toUpperCase() |
|
|
|
})) |
|
|
|
})) |
|
|
|
console.log('[积分档位] 最终 tierOptions =', JSON.stringify(this.tierOptions)) |
|
|
|
console.log('[积分档位] 最终 tierOptions =', JSON.stringify(this.tierOptions)) |
|
|
|
|
|
|
|
this.applyTierFallback() |
|
|
|
// 档位列表到达后补一次试算,兼容只有 finalFlowLevelId、没有档位文本的历史数据。 |
|
|
|
// 档位列表到达后补一次试算,兼容只有 finalFlowLevelId、没有档位文本的历史数据。 |
|
|
|
this.loadEstimatedPoints() |
|
|
|
this.loadEstimatedPoints() |
|
|
|
}).catch((err) => { |
|
|
|
}).catch((err) => { |
|
|
|
console.error('[积分档位] getRulesByLevel 请求失败 =', err) |
|
|
|
console.error('[积分档位] getRulesByLevel 请求失败 =', err) |
|
|
|
this.tierOptions = [] |
|
|
|
this.tierOptions = [] |
|
|
|
|
|
|
|
this.applyTierFallback() |
|
|
|
}).finally(() => { |
|
|
|
}).finally(() => { |
|
|
|
this.tierLoading = false |
|
|
|
this.tierLoading = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
applyTierFallback() { |
|
|
|
|
|
|
|
// 后端按厂区查不到档位列表时,用详情已存的档位兜底,避免下拉显示裸规则ID |
|
|
|
|
|
|
|
if (this.tierOptions.length) return |
|
|
|
|
|
|
|
if (!this.form.finalFlowLevelId) return |
|
|
|
|
|
|
|
this.tierOptions = [{ |
|
|
|
|
|
|
|
id: this.form.finalFlowLevelId, |
|
|
|
|
|
|
|
label: String(this.form.finalFlowLevel || this.form.finalFlowLevelId) |
|
|
|
|
|
|
|
}] |
|
|
|
|
|
|
|
}, |
|
|
|
handleTierChange(value) { |
|
|
|
handleTierChange(value) { |
|
|
|
const item = this.tierOptions.find(option => String(option.id) === String(value)) |
|
|
|
const item = this.tierOptions.find(option => String(option.id) === String(value)) |
|
|
|
this.$set(this.form, 'finalFlowLevel', item ? item.label : '') |
|
|
|
this.$set(this.form, 'finalFlowLevel', item ? item.label : '') |
|
|
|
|