This commit is contained in:
2026-07-01 11:05:34 +08:00

View File

@@ -14,6 +14,7 @@
style="width: 100%"
:header-cell-style="{ background: '#f2f2f2', fontWeight: 600, textAlign: 'center' }"
:cell-style="cellStyle"
:span-method="spanMethod"
size="small"
>
<el-table-column label="业务员" prop="dimension" min-width="100" align="center" />
@@ -38,13 +39,15 @@
import { listCoilWithIds } from "@/api/wms/coil";
const CATEGORIES = [
{ key: '冷硬钢卷', label: '冷硬钢卷' },
{ key: '冷轧钢卷', label: '冷轧钢卷' },
{ key: '镀锌钢卷', label: '镀锌钢卷' },
{ key: '镀锌管材', label: '镀锌管材' },
{ key: '花纹板', label: '花纹板' },
{ key: '镀铬', label: '镀铬' },
{ key: '冷硬钢卷', label: '冷硬钢卷', match: ['冷硬'] },
{ key: '冷轧钢卷', label: '冷轧钢卷', match: ['冷轧'] },
{ key: '镀锌钢卷', label: '镀锌钢卷', match: ['镀锌分剪卷', '镀锌卷', '镀锌'] },
{ key: '镀锌管材', label: '镀锌管材', match: ['镀锌管'] },
{ key: '花纹板', label: '花纹板', match: ['花纹板'] },
{ key: '镀铬', label: '镀铬', match: ['镀铬'] },
]
// 匹配优先级:镀锌管材必须在镀锌钢卷之前检查
const MATCH_PRIORITY = ['镀锌管材', '冷硬钢卷', '冷轧钢卷', '镀锌钢卷', '花纹板', '镀铬']
/**
* 品质等级 → 分组映射
@@ -87,7 +90,10 @@ export default {
this.rawList.forEach(item => {
// 匹配钢材品类
const cat = CATEGORIES.find(c => item.itemName && item.itemName.includes(c.key))
const catMap = new Map(CATEGORIES.map(c => [c.key, c]))
const cat = MATCH_PRIORITY.map(k => catMap.get(k)).find(
c => item.itemName && c.match.some(m => item.itemName.includes(m))
)
if (!cat) { unmatchedCount++; return }
// 品质分组
@@ -96,7 +102,7 @@ export default {
const weight = Number(item.netWeight) || 0
if (Number(item.isRelatedToOrder) === 1 && item.saleName) {
if (item.saleName) {
// 订单相关 → 归属业务员
if (!orderData[item.saleName]) orderData[item.saleName] = {}
if (!orderData[item.saleName][cat.key]) orderData[item.saleName][cat.key] = { AB: 0, CDO: 0 }
@@ -208,11 +214,19 @@ export default {
cellStyle({ row }) {
return row.rowType === 'summary' ? { backgroundColor: '#FFFACD' } : {}
},
spanMethod({ row, columnIndex }) {
// 各产品小计行:每个品类 A/B 和 C/D/O 两列合并
if (row.dimension === '各产品小计' && columnIndex >= 1 && columnIndex <= 12) {
if (columnIndex % 2 === 1) return [1, 2] // AB 列 → 向右合并一列
else return [0, 0] // CDO 列 → 隐藏
}
},
getList() {
this.loading = true
this.rawList = []
listCoilWithIds({
selectType: 'product',
status: 0,
dataType: 1,
pageSize: 99999,