feat(wms报表): 添加正品率显示并优化异常统计

在报表模板中添加正品率(passRate2)显示项
重构getLossList调用逻辑,改为在getList完成后调用
优化calc.js中的异常统计计算,添加各异常库占比数据
This commit is contained in:
砂糖
2026-03-20 10:33:51 +08:00
parent 7e1e4b7b62
commit e1cb4683af
5 changed files with 54 additions and 18 deletions

View File

@@ -25,6 +25,9 @@ const calcSummary = (list, lossList) => {
return item.warehouseId == '2019583656787259393' || item.warehouseId == '2019583325311414274' || item.warehouseId == '2019583429955104769' || item.warehouseId == '2019583137616310273'
}).length / totalCount : 0
// 正品率1-异常率)
const passRate2 = totalCount != 0 ? (1 - abRate * totalCount) : 0
return {
outCount,
outTotalWeight: outTotalWeight.toFixed(2),
@@ -38,6 +41,7 @@ const calcSummary = (list, lossList) => {
passRate: (passRate * 100)?.toFixed(2) + '%',
lossRate: (lossRate * 100)?.toFixed(2) + '%',
abRate: (abRate * 100)?.toFixed(2) || 0,
passRate2: (passRate2 * 100)?.toFixed(2) || 0,
}
}
@@ -45,14 +49,25 @@ const calcAbSummary = (list) => {
// 异常统计,统计四个异常库中的各自的数量和总重
let o = {
jishuCount: 0,
jishuWeight: 0,
miniCount: 0,
miniWeight: 0,
rubbishCount: 0,
rubbishWeight: 0,
returnCount: 0,
jishuWeight: 0,
miniWeight: 0,
rubbishWeight: 0,
returnWeight: 0,
// 计入技术部的钢卷占比
jishuRate: 0,
// 计入小钢卷库的钢卷占比
miniRate: 0,
// 计入废品库的钢卷占比
rubbishRate: 0,
// 计入退货库的钢卷占比
returnRate: 0,
}
const totalCount = list.length
for (let i = 0; i < list.length; i++) {
// { label: '技术部', value: '2019583656787259393' },
// { label: '小钢卷库', value: '2019583325311414274' },
@@ -83,13 +98,19 @@ const calcAbSummary = (list) => {
}
return [
{ label: '技术部钢卷数', value: o['jishuCount'] },
{ label: '技术部钢卷重量', value: o['jishuWeight'] },
{ label: '小钢卷库钢卷数', value: o['miniCount'] },
{ label: '小钢卷库钢卷重量', value: o['miniWeight'] },
{ label: '废品库钢卷数', value: o['rubbishCount'] },
{ label: '废品库钢卷重量', value: o['rubbishWeight'] },
{ label: '退货库钢卷数', value: o['returnCount'] },
{ label: '技术部钢卷重量', value: o['jishuWeight'] },
{ label: '小钢卷库钢卷重量', value: o['miniWeight'] },
{ label: '废品库钢卷重量', value: o['rubbishWeight'] },
{ label: '退货库钢卷重量', value: o['returnWeight'] },
{ label: '技术部占比', value: (o['jishuCount'] / totalCount * 100).toFixed(2) + '%' },
{ label: '小钢卷库占比', value: (o['miniCount'] / totalCount * 100).toFixed(2) + '%' },
{ label: '废品库占比', value: (o['rubbishCount'] / totalCount * 100).toFixed(2) + '%' },
{ label: '退货库占比', value: (o['returnCount'] / totalCount * 100).toFixed(2) + '%' },
]
}

View File

@@ -62,6 +62,8 @@
<el-descriptions-item label="损耗率">{{ summary.lossRate }}</el-descriptions-item>
<!-- 异常率 -->
<el-descriptions-item label="异常率">{{ summary.abRate }}</el-descriptions-item>
<!-- 正品率 -->
<el-descriptions-item label="正品率">{{ summary.passRate2 }}</el-descriptions-item>
</el-descriptions>
<!-- 异常统计 -->
@@ -229,7 +231,7 @@ export default {
// 统一查询入口(兼容回车和按钮点击)
handleQuery() {
this.getList()
this.getLossList()
// this.getLossList()
},
// 核心查询逻辑
getList() {
@@ -264,7 +266,8 @@ export default {
computedWidth: parseFloat(width),
}
})
this.loading = false
this.getLossList()
// this.loading = false
})
},
async getLossList() {
@@ -333,7 +336,7 @@ export default {
},
mounted() {
this.getList()
this.getLossList()
// this.getLossList()
this.loadColumns()
}
}

View File

@@ -62,6 +62,8 @@
<el-descriptions-item label="损耗率">{{ summary.lossRate }}</el-descriptions-item>
<!-- 异常率 -->
<el-descriptions-item label="异常率">{{ summary.abRate }}</el-descriptions-item>
<!-- 正品率 -->
<el-descriptions-item label="正品率">{{ summary.passRate2 }}</el-descriptions-item>
</el-descriptions>
<!-- 异常统计 -->
@@ -259,7 +261,7 @@ export default {
// 统一查询入口(兼容回车和按钮点击)
handleQuery() {
this.getList()
this.getLossList()
// this.getLossList()
},
// 核心查询逻辑
getList() {
@@ -294,7 +296,9 @@ export default {
computedWidth: parseFloat(width),
}
})
this.loading = false
// this.loading = false
this.getLossList()
// this.loading = false
})
},
async getLossList() {
@@ -363,7 +367,7 @@ export default {
},
mounted() {
this.getList()
this.getLossList()
// this.getLossList()
this.loadColumns()
}
}

View File

@@ -67,6 +67,8 @@
<el-descriptions-item label="成品率">{{ summary.passRate }}</el-descriptions-item>
<el-descriptions-item label="损耗率">{{ summary.lossRate }}</el-descriptions-item>
<el-descriptions-item label="异常率">{{ summary.abRate }}</el-descriptions-item>
<!-- 正品率 -->
<el-descriptions-item label="正品率">{{ summary.passRate2 }}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="异常统计" :column="4" border>
@@ -243,7 +245,7 @@ export default {
},
handleQuery() {
this.getList();
this.getLossList();
// this.getLossList();
},
getList() {
this.loading = true;
@@ -273,7 +275,9 @@ export default {
computedWidth: parseFloat(width),
}
});
this.loading = false;
// this.loading = false;
this.getLossList()
// this.loading = false;
}).catch(err => {
console.error('查询失败:', err);
this.loading = false;
@@ -349,7 +353,7 @@ export default {
},
mounted() {
this.getList();
this.getLossList();
// this.getLossList();
this.loadColumns();
}
};

View File

@@ -62,6 +62,8 @@
<el-descriptions-item label="损耗率">{{ summary.lossRate }}</el-descriptions-item>
<!-- 异常率 -->
<el-descriptions-item label="异常率">{{ summary.abRate }}</el-descriptions-item>
<!-- 正品率 -->
<el-descriptions-item label="正品率">{{ summary.passRate2 }}</el-descriptions-item>
</el-descriptions>
<!-- 异常统计 -->
@@ -238,7 +240,7 @@ export default {
// 统一查询入口(兼容回车和按钮点击)
handleQuery() {
this.getList()
this.getLossList()
// this.getLossList()
},
// 核心查询逻辑
getList() {
@@ -273,7 +275,9 @@ export default {
computedWidth: parseFloat(width),
}
})
this.loading = false
// this.loading = false
this.getLossList()
// this.loading = false
})
},
async getLossList() {
@@ -342,7 +346,7 @@ export default {
},
mounted() {
this.getList()
this.getLossList()
// this.getLossList()
this.loadColumns()
}
}