feat(mes/roll,cost/trend): 优化轧辊报表和成本趋势页面

1. 轧辊报表:修复产线关联逻辑,通过轧辊映射获取产线信息,移除冗余的lineId请求参数
2. 成本趋势页:重构为迷你多图表布局,优化筛选栏样式和交互细节
This commit is contained in:
砂糖
2026-07-06 15:43:08 +08:00
parent 8839693ccd
commit 72bc19fab2
2 changed files with 211 additions and 152 deletions

View File

@@ -244,8 +244,8 @@ export default {
this.stats = statsRes.data || {}
}
// 2. 获取全部轧辊(用于辊型映射)
const rollRes = await listRollInfo({ pageNum: 1, pageSize: 99999, lineId: this.lineId || undefined })
// 2. 获取全部轧辊(用于辊型映射和产线关联
const rollRes = await listRollInfo({ pageNum: 1, pageSize: 99999 })
const rolls = rollRes.rows || []
const rollMap = {}
rolls.forEach(r => { rollMap[r.rollId] = r })
@@ -270,7 +270,7 @@ export default {
if (this._beginTime) allParams.beginTime = this._beginTime
if (this._endTime) allParams.endTime = this._endTime + ' 23:59:59'
const allGrindRes = await listRollGrindAll(allParams)
this.computeMonthlyPivot(allGrindRes.data || [])
this.computeMonthlyPivot(allGrindRes.data || [], rollMap)
this.updateCharts()
} catch (e) {
@@ -528,13 +528,14 @@ export default {
document.body.removeChild(link)
URL.revokeObjectURL(url)
},
computeMonthlyPivot(records) {
computeMonthlyPivot(records, rollMap) {
const lineMonthMap = {}
const monthSet = new Set()
records.forEach(r => {
if (!r.grindTime) return
const month = r.grindTime.substring(0, 7)
const lid = Number(r.lineId) || 0
const roll = rollMap[r.rollId]
const lid = Number(roll?.lineId) || 0
if (!lineMonthMap[lid]) {
const line = this.productionLines.find(l => Number(l.lineId) === lid)
lineMonthMap[lid] = { lineId: lid, lineName: line ? line.lineName : (r.lineName || '未知产线'), months: {} }