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

@@ -38,10 +38,20 @@
:options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList">查询</el-button>
<el-button type="primary" @click="exportData">导出产出钢卷</el-button>
<!-- <el-button type="primary" @click="exportLossData">导出消耗钢卷</el-button> -->
<el-button type="primary" @click="settingVisible = true">列设置</el-button>
<!-- <el-button type="primary" @click="getList">查询</el-button> -->
<el-dropdown split-button type="primary" @click="getList" @command="handleCommand">
查询
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="exportData">导出产出钢卷</el-dropdown-item>
<el-dropdown-item command="exportLossData">导出消耗钢卷</el-dropdown-item>
<el-dropdown-item command="saveOutputReport">保存产出报表</el-dropdown-item>
<el-dropdown-item command="saveLossReport">保存消耗报表</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button type="primary" @click="exportData">导出产出钢卷</el-button>
<el-button type="primary" @click="exportLossData">导出消耗钢卷</el-button>
<el-button type="primary" @click="saveOutputReport">保存产出报表</el-button>
<el-button type="primary" @click="saveLossReport">保存消耗报表</el-button> -->
</el-form-item>
</el-form>
</el-row>
@@ -86,19 +96,24 @@
<el-descriptions title="明细信息" :column="3" border>
</el-descriptions>
<el-tabs v-model="activeTab">
<el-tab-pane label="投入钢卷" name="loss">
<coil-table :data="lossList" :columns="lossColumns" :loading="loading" height="calc(100vh - 360px)" />
</el-tab-pane>
<el-tab-pane label="产出钢卷" name="output">
<coil-table :data="outList" :columns="outputColumns" :loading="loading" height="calc(100vh - 360px)" />
<coil-table :data="outList" :columns="outputColumns" :loading="loading" height="calc(100vh - 360px)">
<template slot="settings">
<el-button icon="el-icon-setting" @click="() => {settingVisible = true; activeColumnConfig = 'coil-report-output';}">列设置</el-button>
</template>
</coil-table>
</el-tab-pane>
<el-tab-pane label="投入钢卷" name="loss">
<coil-table :data="lossList" :columns="lossColumns" :loading="loading" height="calc(100vh - 360px)">
<template slot="settings">
<el-button icon="el-icon-setting" @click="() => {settingVisible = true; activeColumnConfig = 'coil-report-loss';}">列设置</el-button>
</template>
</coil-table>
</el-tab-pane>
</el-tabs>
<el-dialog title="列设置" :visible.sync="settingVisible" width="50%">
<el-radio-group v-model="activeColumnConfig">
<!-- <el-radio-button label="coil-report-loss">投入明细配置</el-radio-button> -->
<el-radio-button label="coil-report-output">产出明细配置</el-radio-button>
</el-radio-group>
<columns-setting :reportType="activeColumnConfig"></columns-setting>
</el-dialog>
</div>
@@ -118,6 +133,7 @@ import { calcSummary, calcMSummary } from "@/views/wms/report/js/calc";
import CoilTable from "@/views/wms/report/components/coilTable";
import ColumnsSetting from "@/views/wms/report/components/setting/columns";
import TimeRangePicker from "@/views/wms/report/components/timeRangePicker.vue";
import { saveReportFile } from "@/views/wms/report/js/reportFile";
export default {
name: 'MergeTemplate',
@@ -182,8 +198,8 @@ export default {
return {
lossList: [],
outList: [],
activeTab: 'loss',
activeColumnConfig: 'coil-report-loss',
activeTab: 'output',
activeColumnConfig: 'coil-report-output',
settingVisible: false,
loading: false,
timeRangeParams: {
@@ -201,7 +217,7 @@ export default {
itemSpecification: '',
itemMaterial: '',
itemManufacturer: '',
pageSize: 9999,
pageSize: 99999,
pageNum: 1,
},
lossColumns: [],
@@ -243,6 +259,48 @@ export default {
handleQuery() {
this.getList()
},
// 保存产出报表
saveOutputReport() {
this.loading = true
saveReportFile(this.outList.map(item => item.coilId).join(','), {
reportParams: this.queryParams,
reportType: '产出报表,异常报表',
productionLine: this.productionLine,
}).then(res => {
this.$message({
message: '保存成功',
type: 'success',
})
}).catch(err => {
this.$message({
message: '保存失败',
type: 'error',
})
}).finally(() => {
this.loading = false
})
},
// 保存消耗报表
saveLossReport() {
this.loading = true
saveReportFile(this.lossList.map(item => item.coilId).join(','), {
reportParams: this.queryParams,
reportType: '消耗报表,异常报表',
productionLine: this.productionLine,
}).then(res => {
this.$message({
message: '保存成功',
type: 'success',
})
}).catch(err => {
this.$message({
message: '保存失败',
type: 'error',
})
}).finally(() => {
this.loading = false
})
},
async getList() {
this.loading = true;
const actions = await listPendingAction({ ...this.queryParams, actionTypes: this.actionTypes, actionStatus: 2 });
@@ -282,68 +340,9 @@ export default {
}
});
// if (!lossIds) {
// this.lossList = []
// } else {
// const lossRes = await listCoilWithIds({ ...this.queryParams, coilIds: lossIds || '', startTime: '', endTime: '' });
// this.lossList = lossRes.rows.map(item => {
// // 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
// const [thickness, width] = item.specification?.split('*') || []
// return {
// ...item,
// computedThickness: parseFloat(thickness),
// computedWidth: parseFloat(width),
// }
// });
// }
this.loading = false;
// this.loading = true;
// const res1 = await listPendingAction({ ...this.queryParams, actionTypes: '201,202,203,204,205,206', actionStatus: 2 });
// const res = res1.rows;
// // 获取两层数据
// const lossIds = res.map(item => item.coilId);
// // 使用new Set去重
// const outIds = [...new Set(res.map(item => item.processedCoilIds))];
// if (lossIds.length === 0 || outIds.length === 0) {
// this.$message({
// message: '查询结果为空',
// type: 'warning'
// })
// this.loading = false;
// return
// }
// const [lossRes, outRes] = await Promise.all([
// listCoilWithIds({ ...this.queryParams, coilIds: lossIds.join(',') || '', startTime: '', endTime: '' }),
// listCoilWithIds({ ...this.queryParams, coilIds: outIds.join(',') || '', startTime: '', endTime: '' }),
// ]);
// this.lossList = lossRes.rows.map(item => {
// // 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
// const [thickness, width] = item.specification?.split('*') || []
// return {
// ...item,
// computedThickness: parseFloat(thickness),
// computedWidth: parseFloat(width),
// }
// });
// this.outList = outRes.rows.map(item => {
// // 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
// const [thickness, width] = item.specification?.split('*') || []
// return {
// ...item,
// computedThickness: parseFloat(thickness),
// computedWidth: parseFloat(width),
// }
// });
// this.loading = false;
},
// 导出
// 导出产出钢卷
exportData() {
if (this.outList.length === 0) {
this.$message.warning('暂无数据可导出')
@@ -353,6 +352,8 @@ export default {
coilIds: this.outList.map(item => item.coilId).join(',')
}, `materialCoil_${new Date().getTime()}.xlsx`)
},
// 导出消耗钢卷
exportLossData() {
if (this.lossList.length === 0) {
this.$message.warning('暂无数据可导出')
@@ -362,9 +363,21 @@ export default {
coilIds: this.lossList.map(item => item.coilId).join(',')
}, `materialCoil_${new Date().getTime()}.xlsx`)
},
// 处理命令
handleCommand(command) {
if (command === 'exportData') {
this.exportData()
} else if (command === 'exportLossData') {
this.exportLossData()
} else if (command === 'saveOutputReport') {
this.saveOutputReport()
} else if (command === 'saveLossReport') {
this.saveLossReport()
}
},
// 加载列设置
loadColumns() {
// this.lossColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-loss') || '[]') || []
this.lossColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-loss') || '[]') || []
this.outputColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-output') || '[]') || []
}
}