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