refactor(wms/report): 重构报表模块数据获取逻辑,提取公共方法到fetch.js

feat(wms/report): 新增报表结果存储页面,支持JSON数据横向对比

style(wms/coil/do): 调整钢卷修正页面样式和代码格式

fix(wms/coil/do): 修复操作记录查询参数传递问题,优化钢卷选择逻辑
This commit is contained in:
砂糖
2026-03-27 16:37:59 +08:00
parent c294149274
commit cd00b9562d
7 changed files with 448 additions and 313 deletions

View File

@@ -181,13 +181,11 @@
</div> </div>
</div> </div>
<el-button v-if="item.dataType == 1 && item.status == 0" <el-button v-if="item.dataType == 1 && item.status == 0"
style="position: absolute; bottom: 10px; right: 10px;" type="success" icon="el-icon-refresh" style="position: absolute; bottom: 10px; right: 10px;" type="success" icon="el-icon-refresh" size="mini"
size="mini" @click="handleRestoreMaterial(item)" :loading="item.cancelling" @click="handleRestoreMaterial(item)" :loading="item.cancelling" class="action-btn">回滚</el-button>
class="action-btn">回滚</el-button>
<el-button v-if="item.dataType == 10 && item.status == 0" <el-button v-if="item.dataType == 10 && item.status == 0"
style="position: absolute; bottom: 10px; right: 10px;" type="success" icon="el-icon-refresh" style="position: absolute; bottom: 10px; right: 10px;" type="success" icon="el-icon-refresh" size="mini"
size="mini" @click="handleForceInMaterial(item)" :loading="item.cancelling" @click="handleForceInMaterial(item)" :loading="item.cancelling" class="action-btn">强制入库</el-button>
class="action-btn">强制入库</el-button>
</div> </div>
<div class="card-footer"> <div class="card-footer">
@@ -207,7 +205,8 @@
@click="handleDeleteAction">删除</el-button> @click="handleDeleteAction">删除</el-button>
<el-button type="warning" plain icon="el-icon-refresh" size="mini" @click="handleRefreshAction" <el-button type="warning" plain icon="el-icon-refresh" size="mini" @click="handleRefreshAction"
:disabled="buttonLoading" v-loading="buttonLoading">刷新</el-button> :disabled="buttonLoading" v-loading="buttonLoading">刷新</el-button>
<el-checkbox style="margin-left: 10px;" v-model="rubbish" label="1" @change="getActionList">查看被删除操作</el-checkbox> <el-checkbox style="margin-left: 10px;" v-model="rubbish" label="1"
@change="getActionList">查看被删除操作</el-checkbox>
</div> </div>
</div> </div>
@@ -215,7 +214,8 @@
<el-form :model="actionQueryParams" ref="actionQueryForm" size="small" :inline="true" class="query-form mb10"> <el-form :model="actionQueryParams" ref="actionQueryForm" size="small" :inline="true" class="query-form mb10">
<el-form-item label="操作类型" prop="actionType"> <el-form-item label="操作类型" prop="actionType">
<el-select v-model="actionQueryParams.actionType" placeholder="请选择操作类型" clearable filterable> <el-select v-model="actionQueryParams.actionType" placeholder="请选择操作类型" clearable filterable>
<el-option v-for="item in dict.type.action_type" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in dict.type.action_type" :key="item.value" :label="item.label"
:value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="操作状态" prop="actionStatus"> <el-form-item label="操作状态" prop="actionStatus">
@@ -249,7 +249,8 @@
<el-table-column label="操作状态" align="center" prop="actionStatus" width="120"> <el-table-column label="操作状态" align="center" prop="actionStatus" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.actionStatus" placeholder="请选择操作状态" @change="handleStatusChange(scope.row)"> <el-select v-model="scope.row.actionStatus" placeholder="请选择操作状态"
@change="handleStatusChange(scope.row)">
<el-option label="待处理" :value="0" /> <el-option label="待处理" :value="0" />
<el-option label="处理中" :value="1" /> <el-option label="处理中" :value="1" />
<el-option label="已完成" :value="2" /> <el-option label="已完成" :value="2" />
@@ -286,12 +287,14 @@
<el-table-column label="操作人" align="center" prop="updateBy" width="100" /> <el-table-column label="操作人" align="center" prop="updateBy" width="100" />
<el-table-column label="创建人" align="center" prop="createByName" width="140"> <el-table-column label="创建人" align="center" prop="createByName" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select @change="handleProcessTimeChange(scope.row)" v-model="scope.row.createBy" placeholder="请选择创建人" filterable> <el-select @change="handleProcessTimeChange(scope.row)" v-model="scope.row.createBy"
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userName" /> placeholder="请选择创建人" filterable>
<el-option v-for="item in userList" :key="item.userId" :label="item.nickName"
:value="item.userName" />
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="完成时间" align="center" prop="completeTime" width="220" :show-overflow-tooltip="true"> <el-table-column label="完成时间" align="center" prop="completeTime" width="220" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker @change="handleProcessTimeChange(scope.row)" value-format="yyyy-MM-dd HH:mm:ss" <el-date-picker @change="handleProcessTimeChange(scope.row)" value-format="yyyy-MM-dd HH:mm:ss"
@@ -467,11 +470,11 @@ export default {
// 搜索状态 // 搜索状态
searched: false, searched: false,
// 钢卷类型 // 钢卷类型
coilType: 'all', coilType: 'all',
title: '钢卷信息修正', title: '钢卷信息修正',
// 物料列表相关 // 物料列表相关
materialLoading: false, materialLoading: false,
materialCoilList: [], materialCoilList: [],
@@ -483,7 +486,7 @@ export default {
currentCoilNo: null, currentCoilNo: null,
warehouseId: null, warehouseId: null,
}, },
// 标签预览相关 // 标签预览相关
labelRender: { labelRender: {
visible: false, visible: false,
@@ -496,7 +499,7 @@ export default {
correctVisible: false, correctVisible: false,
buttonLoading: false, buttonLoading: false,
userList: [], userList: [],
// 操作记录相关 // 操作记录相关
actionDialogVisible: false, actionDialogVisible: false,
actionLoading: false, actionLoading: false,
@@ -520,7 +523,7 @@ export default {
rubbish: false, rubbish: false,
// 钢卷选择器可见性 // 钢卷选择器可见性
coilSelectorVisible: false, coilSelectorVisible: false,
// 表单校验 // 表单校验
rules: { rules: {
enterCoilNo: [ enterCoilNo: [
@@ -570,6 +573,7 @@ export default {
{ required: true, message: '请选择操作类型', trigger: 'change' } { required: true, message: '请选择操作类型', trigger: 'change' }
] ]
}, },
coilIds: ''
} }
}, },
computed: { computed: {
@@ -613,14 +617,14 @@ export default {
}, },
methods: { methods: {
parseTime, parseTime,
/** 查询用户列表 */ /** 查询用户列表 */
getUsers() { getUsers() {
listUser({ pageNum: 1, pageSize: 1000 }).then(response => { listUser({ pageNum: 1, pageSize: 1000 }).then(response => {
this.userList = response.rows || [] this.userList = response.rows || []
}) })
}, },
// 处理材料类型变化 // 处理材料类型变化
handleMaterialTypeChange(value) { handleMaterialTypeChange(value) {
// 清空物品选择 // 清空物品选择
@@ -633,7 +637,7 @@ export default {
this.form.itemType = 'raw_material'; this.form.itemType = 'raw_material';
} }
}, },
/** 预览标签 */ /** 预览标签 */
handlePreviewLabel(row) { handlePreviewLabel(row) {
this.labelRender.visible = true; this.labelRender.visible = true;
@@ -644,7 +648,7 @@ export default {
updateTime: row.updateTime?.split(' ')[0] || '', updateTime: row.updateTime?.split(' ')[0] || '',
}; };
}, },
/** 追溯按钮操作 */ /** 追溯按钮操作 */
handleTrace(row) { handleTrace(row) {
this.traceOpen = true; this.traceOpen = true;
@@ -662,21 +666,14 @@ export default {
this.traceLoading = false; this.traceLoading = false;
}); });
}, },
/** 查看操作记录 */
handleViewActions(row) {
this.currentCoilId = row.coilId;
this.actionDialogVisible = true;
this.actionQueryParams.pageNum = 1;
this.getActionList();
},
/** 查询操作记录 */ /** 查询操作记录 */
getActionList() { getActionList() {
this.actionLoading = true; this.actionLoading = true;
const payload = { const payload = {
...this.materialQueryParams,
...this.actionQueryParams, ...this.actionQueryParams,
coilId: this.currentCoilId, coilIds: this.coilIds,
includeDeleted: this.rubbish ? 2 : 0 includeDeleted: this.rubbish ? 2 : 0
}; };
listPendingAction(payload).then(response => { listPendingAction(payload).then(response => {
@@ -687,13 +684,13 @@ export default {
this.actionLoading = false; this.actionLoading = false;
}); });
}, },
/** 操作记录搜索 */ /** 操作记录搜索 */
handleActionQuery() { handleActionQuery() {
this.actionQueryParams.pageNum = 1; this.actionQueryParams.pageNum = 1;
this.getActionList(); this.getActionList();
}, },
/** 重置操作记录搜索 */ /** 重置操作记录搜索 */
resetActionQuery() { resetActionQuery() {
this.resetForm('actionQueryForm'); this.resetForm('actionQueryForm');
@@ -701,7 +698,7 @@ export default {
this.actionQueryParams.actionStatus = null; this.actionQueryParams.actionStatus = null;
this.handleActionQuery(); this.handleActionQuery();
}, },
// ========== 物料列表相关方法 ========== // ========== 物料列表相关方法 ==========
/** 查询物料列表 */ /** 查询物料列表 */
getMaterialCoil() { getMaterialCoil() {
@@ -721,10 +718,10 @@ export default {
this.materialCoilList = response.rows || [] this.materialCoilList = response.rows || []
this.materialTotal = response.total || 0 this.materialTotal = response.total || 0
this.materialLoading = false this.materialLoading = false
// 如果有钢卷数据,自动获取第一个钢卷的操作记录 // 如果有钢卷数据,自动获取第一个钢卷的操作记录
if (this.materialCoilList.length > 0) { if (this.materialCoilList.length > 0) {
this.currentCoilId = this.materialCoilList[0].coilId; this.coilIds = this.materialCoilList.map(item => item.coilId).join(',');
this.getActionList(); this.getActionList();
} else { } else {
// 清空操作记录 // 清空操作记录
@@ -735,7 +732,7 @@ export default {
this.materialLoading = false this.materialLoading = false
}) })
}, },
/** 物料搜索 */ /** 物料搜索 */
handleMaterialQuery() { handleMaterialQuery() {
// 检查是否至少填写了一个钢卷号 // 检查是否至少填写了一个钢卷号
@@ -743,18 +740,18 @@ export default {
this.$message.warning('请至少填写一个钢卷号进行搜索'); this.$message.warning('请至少填写一个钢卷号进行搜索');
return; return;
} }
this.materialQueryParams.pageNum = 1; this.materialQueryParams.pageNum = 1;
this.searched = true; this.searched = true;
this.getMaterialCoil(); this.getMaterialCoil();
// 同时获取操作记录 // 同时获取操作记录
if (this.materialCoilList.length > 0) { // if (this.materialCoilList.length > 0) {
this.currentCoilId = this.materialCoilList[0].coilId; // this.currentCoilId = this.materialCoilList[0].coilId;
this.getActionList(); // this.getActionList();
} // }
}, },
/** 重置物料搜索 */ /** 重置物料搜索 */
resetMaterialQuery() { resetMaterialQuery() {
this.resetForm('materialQueryForm'); this.resetForm('materialQueryForm');
@@ -764,7 +761,7 @@ export default {
this.materialCoilList = []; this.materialCoilList = [];
this.actionList = []; this.actionList = [];
}, },
/** 回滚操作 */ /** 回滚操作 */
handleRestoreMaterial(row) { handleRestoreMaterial(row) {
this.$modal.confirm('是否要将改钢卷还原到上次加工的状态(会删除该钢卷并将上一步的历史钢卷还原)').then(_ => { this.$modal.confirm('是否要将改钢卷还原到上次加工的状态(会删除该钢卷并将上一步的历史钢卷还原)').then(_ => {
@@ -782,7 +779,7 @@ export default {
}) })
}) })
}, },
/** 强制入库操作 */ /** 强制入库操作 */
handleForceInMaterial(row) { handleForceInMaterial(row) {
this.$modal.confirm('是否要强制入库改钢卷?').then(_ => { this.$modal.confirm('是否要强制入库改钢卷?').then(_ => {
@@ -803,7 +800,7 @@ export default {
}) })
}) })
}, },
/** 修正按钮操作 */ /** 修正按钮操作 */
handleCorrectMaterial(row) { handleCorrectMaterial(row) {
this.form = { this.form = {
@@ -812,12 +809,12 @@ export default {
this.title = "钢卷信息修正"; this.title = "钢卷信息修正";
this.correctVisible = true this.correctVisible = true
}, },
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.correctVisible = false this.correctVisible = false
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
@@ -836,7 +833,7 @@ export default {
}); });
}) })
}, },
// ========== 操作记录相关方法 ========== // ========== 操作记录相关方法 ==========
/** 处理操作状态变化 */ /** 处理操作状态变化 */
handleStatusChange(row) { handleStatusChange(row) {
@@ -845,28 +842,28 @@ export default {
this.getActionList(); this.getActionList();
}); });
}, },
/** 完成时间改变时触发 */ /** 完成时间改变时触发 */
handleProcessTimeChange(row) { handleProcessTimeChange(row) {
updatePendingAction(row).then(response => { updatePendingAction(row).then(response => {
this.$message.success('更新成功'); this.$message.success('更新成功');
}); });
}, },
/** 多选框选中数据 */ /** 多选框选中数据 */
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.actionId); this.ids = selection.map(item => item.actionId);
this.single = selection.length !== 1; this.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
/** 新增操作 */ /** 新增操作 */
handleAddAction() { handleAddAction() {
this.resetActionForm(); this.resetActionForm();
this.actionOpen = true; this.actionOpen = true;
this.actionTitle = '添加操作记录'; this.actionTitle = '添加操作记录';
}, },
/** 修改操作 */ /** 修改操作 */
handleUpdateAction(row) { handleUpdateAction(row) {
this.resetActionForm(); this.resetActionForm();
@@ -877,7 +874,7 @@ export default {
this.actionTitle = '修改操作记录'; this.actionTitle = '修改操作记录';
}); });
}, },
/** 删除操作 */ /** 删除操作 */
handleDeleteAction(row) { handleDeleteAction(row) {
const actionIds = row.actionId || this.ids; const actionIds = row.actionId || this.ids;
@@ -892,7 +889,7 @@ export default {
this.$message.success('删除成功'); this.$message.success('删除成功');
}).catch(() => { }); }).catch(() => { });
}, },
/** 还原操作 */ /** 还原操作 */
handleRestoreAction(row) { handleRestoreAction(row) {
const actionId = row.actionId; const actionId = row.actionId;
@@ -907,24 +904,24 @@ export default {
}); });
}); });
}, },
/** 刷新操作记录 */ /** 刷新操作记录 */
handleRefreshAction() { handleRefreshAction() {
this.getActionList(); this.getActionList();
this.$message.success('刷新成功'); this.$message.success('刷新成功');
}, },
/** 显示钢卷选择器 */ /** 显示钢卷选择器 */
showCoilSelector() { showCoilSelector() {
this.coilSelectorVisible = true; this.coilSelectorVisible = true;
}, },
/** 钢卷选择回调 */ /** 钢卷选择回调 */
handleCoilSelect(coil) { handleCoilSelect(coil) {
this.actionForm.coilId = coil.coilId; this.actionForm.coilId = coil.coilId;
this.actionForm.currentCoilNo = coil.currentCoilNo; this.actionForm.currentCoilNo = coil.currentCoilNo;
}, },
/** 提交操作表单 */ /** 提交操作表单 */
submitActionForm() { submitActionForm() {
this.$refs['actionForm'].validate(valid => { this.$refs['actionForm'].validate(valid => {
@@ -948,13 +945,13 @@ export default {
} }
}); });
}, },
/** 取消操作表单 */ /** 取消操作表单 */
cancelAction() { cancelAction() {
this.actionOpen = false; this.actionOpen = false;
this.resetActionForm(); this.resetActionForm();
}, },
/** 重置操作表单 */ /** 重置操作表单 */
resetActionForm() { resetActionForm() {
this.actionForm = { this.actionForm = {
@@ -971,7 +968,7 @@ export default {
this.$refs['actionForm'].resetFields(); this.$refs['actionForm'].resetFields();
} }
}, },
/** 获取边框样式 */ /** 获取边框样式 */
getBorderStyle(row) { getBorderStyle(row) {
// 已发货 // 已发货
@@ -992,7 +989,7 @@ export default {
} }
return { border: '1.5px solid #e4e7ed' } return { border: '1.5px solid #e4e7ed' }
}, },
/** 获取钢卷类型标签 */ /** 获取钢卷类型标签 */
getTypeLabel(row) { getTypeLabel(row) {
if (row.status == 1) { if (row.status == 1) {
@@ -1009,7 +1006,7 @@ export default {
} }
return '未知' return '未知'
}, },
/** 根据操作类型获取图标 */ /** 根据操作类型获取图标 */
getActionIcon(actionType) { getActionIcon(actionType) {
const value = parseInt(actionType); const value = parseInt(actionType);
@@ -1043,19 +1040,19 @@ export default {
border-radius: 4px; border-radius: 4px;
padding: 20px; padding: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
.page-title { .page-title {
margin: 0 0 16px 0; margin: 0 0 16px 0;
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
color: #303133; color: #303133;
} }
.search-form { .search-form {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12px; gap: 12px;
.search-tip { .search-tip {
font-size: 12px; font-size: 12px;
color: #909399; color: #909399;
@@ -1071,14 +1068,14 @@ export default {
padding: 80px 20px; padding: 80px 20px;
text-align: center; text-align: center;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
i { i {
font-size: 48px; font-size: 48px;
margin-bottom: 16px; margin-bottom: 16px;
display: block; display: block;
color: #c0c4cc; color: #c0c4cc;
} }
p { p {
margin: 0; margin: 0;
font-size: 16px; font-size: 16px;
@@ -1165,7 +1162,7 @@ export default {
overflow-y: auto; overflow-y: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 6px; width: 6px;
} }
@@ -1183,12 +1180,12 @@ export default {
background: #a8a8a8; background: #a8a8a8;
} }
} }
::v-deep .el-table { ::v-deep .el-table {
flex: 1; flex: 1;
min-height: 200px; min-height: 200px;
} }
::v-deep .el-table__body-wrapper { ::v-deep .el-table__body-wrapper {
overflow-y: auto; overflow-y: auto;
} }

View File

@@ -0,0 +1,324 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="开始日期" prop="reportStartDate">
<el-date-picker clearable
v-model="queryParams.reportStartDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择报表日期">
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期" prop="reportEndDate">
<el-date-picker clearable
v-model="queryParams.reportEndDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择报表日期">
</el-date-picker>
</el-form-item>
<el-form-item label="产线类型" prop="productionLine">
<el-select
v-model="queryParams.productionLine"
placeholder="请选择产线类型"
clearable
@keyup.enter.native="handleQuery"
>
<el-option v-for="item in dict.type.sys_lines" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="报表类型" prop="reportType">
<el-select
v-model="queryParams.reportType"
placeholder="请选择报表类型"
clearable
@keyup.enter.native="handleQuery"
>
<el-option v-for="item in reportTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="reportResultStorageList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="报表日期" align="center" prop="reportDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.reportDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="报表类型" align="center" prop="reportType" />
<el-table-column label="产线类型" align="center" prop="productionLine" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改报结果存储JSON+横向对比专用对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="报表日期" prop="reportDate">
<el-date-picker clearable
v-model="form.reportDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择报表日期">
</el-date-picker>
</el-form-item>
<el-form-item label="产线类型" prop="productionLine">
<el-select v-model="form.productionLine" placeholder="请选择产线类型">
<el-option v-for="item in dict.type.sys_lines" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="报表类型" prop="reportType">
<el-select v-model="form.reportType" placeholder="请选择报表类型">
<el-option v-for="item in reportTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listReportResultStorage, getReportResultStorage, delReportResultStorage, addReportResultStorage, updateReportResultStorage } from "@/api/wms/reportResultStorage";
export default {
name: "ReportResultStorage",
dicts: ['sys_lines'],
data() {
// 默认选中当前月的第一天到最后一天使用parseTime函数格式化日期{y}-{m}-{d}
const now = new Date();
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);
const startDate = this.parseTime(firstDay, '{y}-{m}-{d}');
const endDate = this.parseTime(lastDay, '{y}-{m}-{d}');
return {
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 报结果存储JSON+横向对比专用)表格数据
reportResultStorageList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
reportStartDate: startDate,
reportEndDate: endDate,
reportType: undefined,
productionLine: undefined,
reportJson: undefined,
},
// 表单参数
form: {},
// 表单校验
rules: {
reportDate: [
{ required: true, message: "报表日期不能为空", trigger: "blur" }
],
reportType: [
{ required: true, message: "报表类型不能为空", trigger: "change" }
],
productionLine: [
{ required: true, message: "产线类型不能为空", trigger: "blur" }
],
},
reportTypeOptions: [
{ label: '产出消耗统计信息', value: '产出消耗统计信息' },
{ label: '产出消耗统计信息(处理M)', value: '产出消耗统计信息(处理M)' },
{ label: '产出异常信息', value: '产出异常信息' },
{ label: '班组产出汇总', value: '班组产出汇总' },
]
};
},
created() {
this.getList();
},
methods: {
/** 查询报结果存储JSON+横向对比专用)列表 */
getList() {
this.loading = true;
listReportResultStorage(this.queryParams).then(response => {
this.reportResultStorageList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
storageId: undefined,
reportDate: undefined,
reportType: undefined,
productionLine: undefined,
reportJson: undefined,
remark: undefined,
delFlag: undefined,
createTime: undefined,
createBy: undefined,
updateTime: undefined,
updateBy: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.storageId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加报结果存储JSON+横向对比专用)";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const storageId = row.storageId || this.ids
getReportResultStorage(storageId).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改报结果存储JSON+横向对比专用)";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.storageId != null) {
updateReportResultStorage(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addReportResultStorage(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const storageIds = row.storageId || this.ids;
this.$modal.confirm('是否确认删除报结果存储JSON+横向对比专用)编号为"' + storageIds + '"的数据项?').then(() => {
this.loading = true;
return delReportResultStorage(storageIds);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/reportResultStorage/export', {
...this.queryParams
}, `reportResultStorage_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@@ -38,12 +38,6 @@
<muti-select style="width: 200px;" v-model="queryParams.itemManufacturer" <muti-select style="width: 200px;" v-model="queryParams.itemManufacturer"
:options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" /> :options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="收货计划" prop="planId">
<el-select style="width: 200px;" v-model="queryParams.planId" placeholder="请输入计划名称搜索收货计划" filterable remote
:remote-method="remoteMethod">
<el-option v-for="item in planList" :key="item.planId" :label="item.planName" :value="item.planId" />
</el-select>
</el-form-item> -->
<el-form-item prop="endTime"> <el-form-item prop="endTime">
<el-button type="primary" @click="getList">查询</el-button> <el-button type="primary" @click="getList">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button> <el-button type="primary" @click="exportData">导出</el-button>
@@ -85,6 +79,8 @@ import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { listDeliveryPlan } from '@/api/wms/deliveryPlan' import { listDeliveryPlan } from '@/api/wms/deliveryPlan'
import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue"; import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue";
import CoilTable from "@/views/wms/report/components/coilTable/index.vue"; import CoilTable from "@/views/wms/report/components/coilTable/index.vue";
import { fetchLossList } from "@/views/wms/report/js/fetch";
export default { export default {
name: 'LossTemplate', name: 'LossTemplate',
@@ -186,44 +182,11 @@ export default {
}, },
async getList() { async getList() {
this.loading = true this.loading = true
const resultList = await Promise.all(this.actionTypes.map(actionType => { fetchLossList(this.actionTypes, {
return listPendingAction({
actionStatus: 2,
warehouseId: this.queryParams.planId,
actionType,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
...this.actionQueryParams,
})
}))
const actions = resultList.flatMap(item => item.rows)
const actionIds = actions.map(item => item.actionId).join(',')
if (!actionIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.list = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams, ...this.queryParams,
byCreateTimeStart: undefined, ...this.actionQueryParams,
byCreateTimeEnd: undefined,
actionIds: actionIds,
}).then(res => { }).then(res => {
this.list = res.rows.map(item => { this.list = res
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification?.split('*') || [undefined, undefined]
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.loading = false this.loading = false
}) })
}, },

View File

@@ -92,7 +92,7 @@
<!-- 异常统计 --> <!-- 异常统计 -->
<el-descriptions title="异常统计" :column="4" border> <el-descriptions title="异常统计" :column="4" border>
<el-descriptions-item v-for="item in abSummary" :key="item.label" :label="item.label">{{ item.value <el-descriptions-item v-for="item in abSummary" :key="item.label" :label="item.label">{{ item.value
}}</el-descriptions-item> }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-descriptions title="明细信息" :column="3" border> <el-descriptions title="明细信息" :column="3" border>
@@ -130,6 +130,7 @@ import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { calcSummary, calcAbSummary, calcMSummary } from "@/views/wms/report/js/calc"; import { calcSummary, calcAbSummary, calcMSummary } from "@/views/wms/report/js/calc";
import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue"; import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue";
import CoilTable from "@/views/wms/report/components/coilTable/index.vue"; import CoilTable from "@/views/wms/report/components/coilTable/index.vue";
import { fetchLossList, fetchOutputList } from "@/views/wms/report/js/fetch";
export default { export default {
name: 'MonthTemplate', name: 'MonthTemplate',
@@ -389,9 +390,18 @@ export default {
fetchData() { fetchData() {
this.loading = true this.loading = true
Promise.all([ Promise.all([
this.getList(), fetchLossList(this.actionTypes, {
this.getLossList() ...this.queryParams,
]).then(() => { ...this.actionQueryParams
}),
fetchOutputList({
...this.queryParams,
...this.baseQueryParams,
warehouseIds: this.warehouseIds.join(','),
}),
]).then(([lossList, outputList]) => {
this.lossList = lossList
this.list = outputList
this.loading = false this.loading = false
}) })
}, },

View File

@@ -40,7 +40,7 @@
:options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" /> :options="dict.type.coil_manufacturer" placeholder="请选择厂家" clearable @keyup.enter.native="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item prop="endTime"> <el-form-item prop="endTime">
<el-button type="primary" @click="getList">查询</el-button> <el-button type="primary" @click="handleQuery">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button> <el-button type="primary" @click="exportData">导出</el-button>
<el-button type="primary" @click="settingVisible = true">列设置</el-button> <el-button type="primary" @click="settingVisible = true">列设置</el-button>
</el-form-item> </el-form-item>
@@ -76,6 +76,8 @@ import MutiSelect from "@/components/MutiSelect";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect"; import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue"; import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue";
import CoilTable from "@/views/wms/report/components/coilTable/index.vue"; import CoilTable from "@/views/wms/report/components/coilTable/index.vue";
import { fetchOutputList } from "@/views/wms/report/js/fetch";
export default { export default {
name: 'OutTemplate', name: 'OutTemplate',
@@ -160,7 +162,7 @@ export default {
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal !== oldVal) { if (newVal !== oldVal) {
this.warehouseIds = newVal.map(item => item.value) this.warehouseIds = newVal.map(item => item.value)
this.getList() this.handleQuery()
} }
}, },
immediate: true, immediate: true,
@@ -186,40 +188,13 @@ export default {
}, },
// 统一查询入口 // 统一查询入口
handleQuery() { handleQuery() {
this.getList()
},
getList() {
this.loading = true this.loading = true
Promise.all([ fetchOutputList({
listCoilWithIds({ ...this.queryParams,
selectType: 'raw_material', ...this.baseQueryParams,
itemType: 'raw_material', warehouseIds: this.warehouseIds.join(','),
warehouseIds: this.warehouseIds.join(','), }).then((resList) => {
...this.queryParams, this.list = resList
...this.baseQueryParams,
}),
listCoilWithIds({
selectType: 'product',
itemType: 'product',
warehouseIds: this.warehouseIds.join(','),
...this.queryParams,
...this.baseQueryParams,
}),
]).then((resList) => {
console.log(resList)
const list = resList.flatMap(res => res.rows)
// 按照createTime 降序排序
this.list = list.sort(
(a, b) => new Date(b.createTime) - new Date(a.createTime)
).map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.loading = false this.loading = false
}) })
}, },
@@ -231,7 +206,7 @@ export default {
}, },
}, },
mounted() { mounted() {
this.getList() this.handleQuery()
this.loadColumns() this.loadColumns()
} }
} }

View File

@@ -135,6 +135,7 @@ import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { calcSummary, calcAbSummary, calcTeamSummary, calcMSummary } from "@/views/wms/report/js/calc"; import { calcSummary, calcAbSummary, calcTeamSummary, calcMSummary } from "@/views/wms/report/js/calc";
import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue"; import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue";
import CoilTable from "@/views/wms/report/components/coilTable/index.vue"; import CoilTable from "@/views/wms/report/components/coilTable/index.vue";
import { fetchLossList, fetchOutputList } from "@/views/wms/report/js/fetch";
export default { export default {
name: 'TeamTemplate', name: 'TeamTemplate',
@@ -263,94 +264,24 @@ export default {
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') || '[]') || [] this.outputColumns = JSON.parse(localStorage.getItem('preference-tableColumns-coil-report-output') || '[]') || []
}, },
// 统一查询入口(兼容回车和按钮点击)
handleQuery() { handleQuery() {
this.getList(); this.loading = true
// this.getLossList();
},
getList() {
this.loading = true;
Promise.all([ Promise.all([
listCoilWithIds({ fetchLossList(this.actionTypes, {
selectType: 'raw_material',
itemType: 'raw_material',
warehouseIds: this.warehouseIds.join(','),
...this.queryParams, ...this.queryParams,
...this.baseQueryParams ...this.actionQueryParams
}), }),
listCoilWithIds({ fetchOutputList({
selectType: 'product', ...this.queryParams,
itemType: 'product', ...this.baseQueryParams,
warehouseIds: this.warehouseIds.join(','), warehouseIds: this.warehouseIds.join(','),
...this.queryParams, }),
...this.baseQueryParams ]).then(([lossList, outputList]) => {
}) this.lossList = lossList
]).then(resList => { this.list = outputList
const list = resList.flatMap(res => res.rows); this.loading = false
this.list = list.sort((a, b) => new Date(b.createTime) - new Date(a.createTime)).map(item => { })
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
});
// this.loading = false;
this.getLossList()
// this.loading = false;
}).catch(err => {
console.error('查询失败:', err);
this.loading = false;
});
},
async getLossList() {
this.loading = true;
try {
const resultList = await Promise.all(this.actionTypes.map(actionType => {
return listPendingAction({
actionStatus: 2,
warehouseId: this.queryParams.planId,
actionType,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
...this.actionQueryParams
});
}));
const actions = resultList.flatMap(item => item.rows);
const coilIds = actions.map(item => item.coilId).join(',');
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning'
});
this.lossList = [];
this.loading = false;
return;
}
const res = await listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds
});
this.lossList = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
});
this.loading = false;
} catch (err) {
console.error('查询失败:', err);
this.loading = false;
}
}, },
exportData() { exportData() {
if (this.list.length === 0) { if (this.list.length === 0) {
@@ -372,8 +303,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.getList(); this.handleQuery()
// this.getLossList();
this.loadColumns(); this.loadColumns();
} }
}; };

View File

@@ -130,6 +130,7 @@ import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { calcSummary, calcAbSummary, calcMSummary } from "@/views/wms/report/js/calc"; import { calcSummary, calcAbSummary, calcMSummary } from "@/views/wms/report/js/calc";
import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue"; import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue";
import CoilTable from "@/views/wms/report/components/coilTable/index.vue"; import CoilTable from "@/views/wms/report/components/coilTable/index.vue";
import { fetchLossList, fetchOutputList } from "@/views/wms/report/js/fetch";
export default { export default {
name: 'YearTemplate', name: 'YearTemplate',
@@ -264,84 +265,20 @@ export default {
}, },
// 统一查询入口(兼容回车和按钮点击) // 统一查询入口(兼容回车和按钮点击)
handleQuery() { handleQuery() {
this.getList()
// this.getLossList()
},
// 核心查询逻辑
getList() {
this.loading = true this.loading = true
Promise.all([ Promise.all([
listCoilWithIds({ fetchLossList(this.actionTypes, {
selectType: 'raw_material', ...this.queryParams,
itemType: 'raw_material', ...this.actionQueryParams
warehouseIds: this.warehouseIds.join(','), }),
fetchOutputList({
...this.queryParams, ...this.queryParams,
...this.baseQueryParams, ...this.baseQueryParams,
}),
listCoilWithIds({
selectType: 'product',
itemType: 'product',
warehouseIds: this.warehouseIds.join(','), warehouseIds: this.warehouseIds.join(','),
...this.queryParams,
...this.baseQueryParams,
}), }),
]).then((resList) => { ]).then(([lossList, outputList]) => {
const list = resList.flatMap(res => res.rows) this.lossList = lossList
// 按照createTime 降序排序 this.list = outputList
this.list = list.sort(
(a, b) => new Date(b.createTime) - new Date(a.createTime)
).map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification?.split('*') || [0, 0]
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.getLossList()
})
},
async getLossList() {
this.loading = true
const resultList = await Promise.all(this.actionTypes.map(actionType => {
return listPendingAction({
actionStatus: 2,
warehouseId: this.queryParams.planId,
actionType,
pageSize: 99999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
...this.actionQueryParams,
})
}))
const actions = resultList.flatMap(item => item.rows)
const coilIds = actions.map(item => item.coilId).join(',')
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.lossList = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification?.split('*') || [0, 0]
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.loading = false this.loading = false
}) })
}, },
@@ -366,8 +303,7 @@ export default {
}, },
}, },
mounted() { mounted() {
this.getList() this.handleQuery()
// this.getLossList()
this.loadColumns() this.loadColumns()
} }
} }