feat(报表): 增强报表功能并优化标签显示
- 新增镀锌1预填接口和报表字段 - 优化标签材质显示逻辑,移除content前缀 - 增加报表分页大小选项和耗时格式化 - 扩展报表可选列和默认列配置 - 改进报表统计计算逻辑,考虑质量状态 - 调整报表页面大小限制为99999
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
<template v-else-if="column.prop === 'status'">
|
||||
{{ scope.row.status === 0 ? '在库' : '已出库' }}
|
||||
</template>
|
||||
<!-- 生产耗时,单位分钟,渲染为xx天xx小时xx分钟 -->
|
||||
<template v-else-if="column.prop === 'productionDuration'">
|
||||
{{ formatProductionDuration(scope.row.productionDuration) }}
|
||||
</template>
|
||||
<!-- 默认渲染 -->
|
||||
<template v-else>
|
||||
{{ scope.row[column.prop] }}
|
||||
@@ -30,6 +34,7 @@
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
:page-size.sync="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100, 200, 500, 1000]"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
@@ -92,6 +97,26 @@ export default {
|
||||
handleCurrentChange(val) {
|
||||
this.pageNum = val
|
||||
},
|
||||
// 生产耗时,单位分钟,渲染为xx天xx小时xx分钟
|
||||
formatProductionDuration(duration) {
|
||||
if (!duration || isNaN(duration)) {
|
||||
return '0分钟'
|
||||
}
|
||||
const days = Math.floor(duration / 1440)
|
||||
const hours = Math.floor((duration - days * 1440) / 60)
|
||||
const minutes = duration - days * 1440 - hours * 60
|
||||
let result = ''
|
||||
if (days > 0) {
|
||||
result += `${days}天`
|
||||
}
|
||||
if (hours > 0) {
|
||||
result += `${hours}小时`
|
||||
}
|
||||
if (minutes > 0 || (days === 0 && hours === 0)) {
|
||||
result += `${minutes}分钟`
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user