feat(wms): 新增报表透视表组件并优化操作状态显示

refactor: 替换select为tag显示操作状态
feat: 添加今天按钮到时间范围选择器
fix: 移除调试用的console.log
style: 调整按钮间距样式
feat: 新增厂家材质透视表和宽度厚度统计表
refactor: 优化导出功能去除orderBy参数
feat: 添加表面处理等查询条件
feat: 在coilTable中添加settings插槽
feat: 使用下拉菜单整合报表操作按钮
This commit is contained in:
2026-05-05 14:52:24 +08:00
parent 723ccc9e58
commit fa198181ee
11 changed files with 491 additions and 91 deletions

View File

@@ -62,6 +62,12 @@
<el-descriptions-item label="均重">{{ summary.avgWeight }}t</el-descriptions-item>
</el-descriptions>
<!-- 厂家材质透视表 -->
<HierarchicalPivot :data="list" :config="hierarchicalPivotConfig" />
<!-- 宽度厚度统计表 -->
<CrossTable :data="list" :config="crossTableConfig" />
<el-descriptions title="明细信息" :column="3" border>
</el-descriptions>
<coil-table :columns="receiveColumns" :data="list"></coil-table>
@@ -90,6 +96,8 @@ import { listDeliveryPlan } from '@/api/wms/deliveryPlan'
import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue";
import CoilTable from "@/views/wms/report/components/coilTable/index.vue";
import TimeRangePicker from "@/views/wms/report/components/timeRangePicker.vue";
import HierarchicalPivot from "@/views/wms/report/components/hierarchicalPivot/index.vue";
import CrossTable from "@/views/wms/report/components/crossTable/index.vue";
import { saveReportFile } from "@/views/wms/report/js/reportFile";
@@ -104,12 +112,13 @@ export default {
ColumnsSetting,
CoilTable,
TimeRangePicker,
HierarchicalPivot,
CrossTable,
},
dicts: ['product_coil_status', 'coil_material', 'coil_itemname', 'coil_manufacturer'],
data() {
// 工具函数:个位数补零,保证格式统一(比如 9 → 095 → 05
const addZero = (num) => num.toString().padStart(2, '0')
const now = new Date() // 当前本地北京时间
// 核心:获取【昨天】的日期对象(自动处理跨月/跨年,无边界问题)
const yesterday = new Date(now)
@@ -151,6 +160,44 @@ export default {
loading: false,
receiveColumns: [],
// 厂家材质透视表配置
hierarchicalPivotConfig: {
groupFields: ['manufacturer', 'material'],
groupLabels: ['厂家', '材质'],
summaryFields: [
{ prop: 'count', label: '求和项:件数', field: '', align: 'center' },
{ prop: 'weight', label: '求和项:重量', field: 'netWeight', align: 'center' }
],
formatValue: (value, summaryField) => {
if (summaryField.field === '') {
return value
}
return value.toFixed(3)
}
},
// 宽度厚度统计表配置
crossTableConfig: {
rowField: 'computedWidth',
rowLabel: '宽度',
rowWidth: 100,
columnField: 'computedThickness',
summaryColumns: [
{ prop: 'count', label: '件数', width: 80, field: '' },
{ prop: 'weight', label: '重量', width: 100, field: 'netWeight' }
],
formatValue: (value, summaryField) => {
if (summaryField.field === '') {
return value
}
return value.toFixed(2)
},
formatKey: (num) => {
if (num === null || num === undefined || isNaN(num)) return null
return parseFloat(num).toFixed(2)
}
}
}
},
computed: {
@@ -167,7 +214,8 @@ export default {
},
coilIds() {
return this.list.map(item => item.coilId).join(',')
}
},
},
methods: {
// 加载列设置
@@ -196,7 +244,6 @@ export default {
}).then(res => {
const actions = res.rows
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',