feat(mes/roll/report): 优化磨辊人员统计报表,按辊型拆分统计数据
该提交重构了磨辊报表的操作人员统计模块,将原有的总统计拆分为中间辊(CR)、支撑辊(BR)、工作辊(WR)的分项统计,并增加了合计栏,同时完善了辊型识别逻辑,新增了对应的数据计算和表格展示。
This commit is contained in:
@@ -81,14 +81,43 @@
|
||||
</div>
|
||||
<el-table :data="operatorStats" size="small" border stripe style="width:100%"
|
||||
v-if="operatorStats.length" :default-sort="{ prop: 'totalGrindAmount', order: 'descending' }">
|
||||
<el-table-column label="序号" type="index" width="50" align="center" />
|
||||
<el-table-column label="磨辊人" prop="operator" min-width="120" sortable />
|
||||
<el-table-column label="磨削次数" prop="grindCount" width="110" align="center" sortable />
|
||||
<el-table-column label="磨削总量(mm)" prop="totalGrindAmount" width="130" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.totalGrindAmount.toFixed(2) }}</template>
|
||||
<el-table-column label="序号" type="index" align="center" />
|
||||
<el-table-column label="磨辊人" prop="operator" sortable />
|
||||
<el-table-column label="CR(中间辊)" align="center">
|
||||
<el-table-column label="磨削次数" prop="crGrindCount" align="center" sortable />
|
||||
<el-table-column label="磨削总量(mm)" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.crTotalGrindAmount.toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平均磨削量(mm)" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.crAvgGrindAmount.toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="平均磨削量(mm)" prop="avgGrindAmount" width="140" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.avgGrindAmount.toFixed(2) }}</template>
|
||||
<el-table-column label="BR(支撑辊)" align="center">
|
||||
<el-table-column label="磨削次数" prop="brGrindCount" align="center" sortable />
|
||||
<el-table-column label="磨削总量(mm)" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.brTotalGrindAmount.toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平均磨削量(mm)" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.brAvgGrindAmount.toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="WR(工作辊)" align="center">
|
||||
<el-table-column label="磨削次数" prop="wrGrindCount" align="center" sortable />
|
||||
<el-table-column label="磨削总量(mm)" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.wrTotalGrindAmount.toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平均磨削量(mm)" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.wrAvgGrindAmount.toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="合计" align="center">
|
||||
<el-table-column label="磨削次数" prop="grindCount" align="center" sortable />
|
||||
<el-table-column label="磨削总量(mm)" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.totalGrindAmount.toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平均磨削量(mm)" align="right" sortable>
|
||||
<template slot-scope="{row}">{{ row.avgGrindAmount.toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty v-else description="暂无磨削记录" />
|
||||
@@ -175,7 +204,7 @@ export default {
|
||||
this.computeSummary(allRecords, rollMap)
|
||||
this.computeDailyTrend(allRecords)
|
||||
this.computeRollTypeDist(allRecords, rollMap)
|
||||
this.computeOperatorStats(allRecords)
|
||||
this.computeOperatorStats(allRecords, rollMap)
|
||||
this.updateCharts()
|
||||
} catch (e) {
|
||||
console.error('加载报表数据失败', e)
|
||||
@@ -214,25 +243,50 @@ export default {
|
||||
const typeMap = {}
|
||||
records.forEach(r => {
|
||||
const roll = rollMap[r.rollId]
|
||||
const type = roll ? (roll.rollType === 'WR' ? '工作辊' : roll.rollType === 'BR' ? '支撑辊' : roll.rollType || '未知') : '未知'
|
||||
const type = roll ? (roll.rollType === 'WR' ? '工作辊' : roll.rollType === 'BR' ? '支撑辊' : roll.rollType === 'CR' ? '中间辊' : roll.rollType || '未知') : '未知'
|
||||
if (!typeMap[type]) typeMap[type] = { name: type, value: 0, grindCount: 0 }
|
||||
typeMap[type].value += Number(r.grindAmount || 0)
|
||||
typeMap[type].grindCount++
|
||||
})
|
||||
this.rollTypeDist = Object.values(typeMap)
|
||||
},
|
||||
computeOperatorStats(records) {
|
||||
computeOperatorStats(records, rollMap) {
|
||||
const opMap = {}
|
||||
records.forEach(r => {
|
||||
const name = r.operator || '未知'
|
||||
if (!opMap[name]) opMap[name] = { operator: name, grindCount: 0, totalGrindAmount: 0 }
|
||||
if (!opMap[name]) opMap[name] = {
|
||||
operator: name,
|
||||
grindCount: 0, totalGrindAmount: 0,
|
||||
crGrindCount: 0, crTotalGrindAmount: 0,
|
||||
brGrindCount: 0, brTotalGrindAmount: 0,
|
||||
wrGrindCount: 0, wrTotalGrindAmount: 0
|
||||
}
|
||||
opMap[name].grindCount++
|
||||
opMap[name].totalGrindAmount += Number(r.grindAmount || 0)
|
||||
const roll = rollMap[r.rollId]
|
||||
const rollType = roll ? (roll.rollType || '') : ''
|
||||
const amount = Number(r.grindAmount || 0)
|
||||
if (rollType === 'CR') {
|
||||
opMap[name].crGrindCount++
|
||||
opMap[name].crTotalGrindAmount += amount
|
||||
} else if (rollType === 'BR') {
|
||||
opMap[name].brGrindCount++
|
||||
opMap[name].brTotalGrindAmount += amount
|
||||
} else if (rollType === 'WR') {
|
||||
opMap[name].wrGrindCount++
|
||||
opMap[name].wrTotalGrindAmount += amount
|
||||
}
|
||||
})
|
||||
this.operatorStats = Object.values(opMap).map(item => ({
|
||||
...item,
|
||||
totalGrindAmount: Number(item.totalGrindAmount.toFixed(2)),
|
||||
avgGrindAmount: item.grindCount > 0 ? Number((item.totalGrindAmount / item.grindCount).toFixed(2)) : 0
|
||||
avgGrindAmount: item.grindCount > 0 ? Number((item.totalGrindAmount / item.grindCount).toFixed(2)) : 0,
|
||||
crTotalGrindAmount: Number(item.crTotalGrindAmount.toFixed(2)),
|
||||
crAvgGrindAmount: item.crGrindCount > 0 ? Number((item.crTotalGrindAmount / item.crGrindCount).toFixed(2)) : 0,
|
||||
brTotalGrindAmount: Number(item.brTotalGrindAmount.toFixed(2)),
|
||||
brAvgGrindAmount: item.brGrindCount > 0 ? Number((item.brTotalGrindAmount / item.brGrindCount).toFixed(2)) : 0,
|
||||
wrTotalGrindAmount: Number(item.wrTotalGrindAmount.toFixed(2)),
|
||||
wrAvgGrindAmount: item.wrGrindCount > 0 ? Number((item.wrTotalGrindAmount / item.wrGrindCount).toFixed(2)) : 0
|
||||
})).sort((a, b) => b.totalGrindAmount - a.totalGrindAmount)
|
||||
},
|
||||
initCharts() {
|
||||
@@ -272,7 +326,7 @@ export default {
|
||||
data: [],
|
||||
emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0,0,0,0.5)' } }
|
||||
}],
|
||||
color: ['#409eff', '#e6a23c', '#909399']
|
||||
color: ['#409eff', '#e6a23c', '#67c23a', '#909399']
|
||||
})
|
||||
},
|
||||
updateCharts() {
|
||||
|
||||
Reference in New Issue
Block a user