feat: 新增收货计划功能并优化入库界面

fix(ui): 修正发货单和收货单界面显示问题

docs: 添加KLPTable组件使用文档

refactor: 重构入库记录显示为表格形式

style: 清理无用代码并统一命名规范
This commit is contained in:
砂糖
2025-11-29 17:24:46 +08:00
parent 1c10423429
commit 6c37c934bc
6 changed files with 497 additions and 92 deletions

View File

@@ -8,6 +8,18 @@
<h3 class="section-title">新增入库</h3>
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="收货计划" prop="planId">
<el-select style="width: 100%;" v-model="form.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-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="入场钢卷号" prop="enterCoilNo">
@@ -33,12 +45,12 @@
clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="实际库区" prop="actualWarehouseId">
<actual-warehouse-select v-model="form.actualWarehouseId" placeholder="请选择实际库区" style="width: 100%;"
clearable />
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="12">
<el-form-item label="班组" prop="team">
<el-input v-model="form.team" placeholder="请输入班组" />
@@ -121,7 +133,7 @@
<el-col :span="12">
<div class="section-card">
<!-- 入库记录 -->
<div class="section-header">
<div class="section-header">
<h3 class="section-title">入库记录</h3>
<el-button size="mini" icon="el-icon-refresh" @click="getList">刷新</el-button>
</div>
@@ -133,45 +145,46 @@
<el-button type="primary" @click="getList">查询</el-button>
</el-form-item>
</el-form>
<!-- 待操作卡片列表 -->
<div class="card-grid-container">
<div v-if="pendingActions.length === 0" class="empty-state">
<i class="el-icon-document"></i>
<p>暂无入库记录</p>
</div>
<div
v-for="(item, index) in pendingActions"
:key="item.actionId || index"
class="action-card"
:class="{
'urgent-card': item.priority === 2,
'important-card': item.priority === 1
}"
>
<div class="card-header">
<el-tag type="info" size="small" class="coil-no-tag">{{ item.currentCoilNo }}</el-tag>
</div>
<div class="card-body">
<div class="info-list">
<div class="info-item">
<span class="info-label">创建人</span>
<span class="info-value">{{ item.createBy || '—' }}</span>
</div>
<div class="info-item">
<span class="info-label">创建时间</span>
<span class="info-value">{{ parseTime(item.createTime, '{m}-{d} {h}:{i}') || '—' }}</span>
</div>
</div>
</div>
</div>
</div>
<Pagination v-show="total > 0" :total="total" :page.sync="pagination.currentPage"
<!-- 待操作卡片列表 -->
<div v-if="pendingActions.length === 0" v-loading="loading" class="empty-state">
<i class="el-icon-document"></i>
<p>暂无入库记录</p>
</div>
<el-table v-else v-loading="loading" border :data="pendingActions" highlight-current-row>
<el-table-column label="钢卷号" align="center" prop="currentCoilNo" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-tag type="info" size="small">{{ scope.row.currentCoilNo }}</el-tag>
</template>
</el-table-column>
<el-table-column label="优先级" align="center" prop="priority" width="90">
<template slot-scope="scope">
<el-tag v-if="scope.row.priority === 0" type="info" size="mini">普通</el-tag>
<el-tag v-else-if="scope.row.priority === 1" type="warning" size="mini">重要</el-tag>
<el-tag v-else-if="scope.row.priority === 2" type="danger" size="mini">紧急</el-tag>
</template>
</el-table-column>
<el-table-column label="新增时间" align="center" prop="createTime" width="155" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" width="100" />
<el-table-column label="操作状态" align="center" prop="actionStatus" width="120">
<template slot-scope="scope">
<el-tag v-if="scope.row.actionStatus === 2" type="success">已收货</el-tag>
<el-tag v-else type="primary">未收货</el-tag>
</template>
</el-table-column>
</el-table>
<Pagination v-show="total > 0" :total="total" :page.sync="pagination.pageNum"
:limit.sync="pagination.pageSize" @pagination="getList" />
</div>
</div>
</el-col>
</el-row>
</div>
@@ -186,6 +199,7 @@ import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import ProductSelect from "@/components/KLPService/ProductSelect";
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
import { Pagination } from 'element-ui';
import { listDeliveryPlan } from '@/api/wms/deliveryPlan'
// 键值为[400, 500), 不包含在字典中但后续可以加入的特殊操作这类操作录入后会立刻完成例如入库401和发货402
@@ -211,6 +225,7 @@ export default {
netWeight: null,
grossWeight: null,
remark: null,
dataType: 10, // 表示将要入库但是还未入库的钢卷,一般用于钢卷入库的操作去创建一个无法被检索到的钢卷
trimmingRequirement: null,
packingStatus: null,
packagingRequirement: null,
@@ -222,12 +237,15 @@ export default {
},
// 分页参数
pagination: {
currentPage: 1,
pageNum: 1,
pageSize: 10,
},
total: 0,
// 表单校验
rules: {
planId: [
{ required: true, message: "请选择收货计划", trigger: "change" }
],
enterCoilNo: [
{ required: true, message: "入场钢卷号不能为空", trigger: "blur" }
],
@@ -248,6 +266,7 @@ export default {
{ required: true, message: "毛重不能为空", trigger: "blur" }
],
},
planList: [],
}
},
mounted() {
@@ -276,6 +295,11 @@ export default {
this.form.itemType = 'raw_material';
}
},
remoteMethod(query) {
listDeliveryPlan({ planName: query, pageNum: 1, pageSize: 5, planType: 1 }).then(res => {
this.planList = res.rows
})
},
getList() {
// 获取入库历史
this.loading = true
@@ -292,13 +316,16 @@ export default {
this.buttonLoading = true;
addMaterialCoil(this.form).then(response => {
addPendingAction({
// 计划ID 对应 warehouseId warehouseId字段并不是仓库ID而是一个根据操作类型自适应的查询字段
warehouseId: this.form.planId,
actionType: 401,
currentCoilNo: this.form.currentCoilNo,
sourceType: 'manual',
coilId: response.data.coilId,
// coilId: 0,
priority: 0,
remark: this.form.remark,
actionStatus: 2,
actionStatus: 0,
}).then(res => {
this.$modal.msgSuccess("入库成功");
this.getList()
@@ -306,6 +333,8 @@ export default {
}).finally(() => {
this.buttonLoading = false;
});
}
});
},
@@ -354,6 +383,7 @@ export default {
.section-header {
border-bottom-color: #409eff;
}
.section-title {
color: #409eff;
}
@@ -363,6 +393,7 @@ export default {
.section-header {
border-bottom-color: #67c23a;
}
.section-title {
color: #67c23a;
}
@@ -384,25 +415,25 @@ export default {
max-height: calc(100vh - 320px);
overflow-y: auto;
padding-right: 4px;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 3px;
}
&::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 3px;
&:hover {
background: #a8a8a8;
}
}
@media (min-width: 1600px) {
grid-template-columns: repeat(4, 1fr);
}
@@ -413,14 +444,14 @@ export default {
text-align: center;
padding: 60px 20px;
color: #909399;
i {
font-size: 48px;
margin-bottom: 16px;
display: block;
color: #c0c4cc;
}
p {
margin: 0;
font-size: 14px;
@@ -436,51 +467,51 @@ export default {
flex-direction: column;
transition: all 0.3s ease;
height: 100%;
&:hover {
border-color: #409eff;
box-shadow: 0 2px 6px rgba(64, 158, 255, 0.12);
}
.card-header {
padding: 6px 8px;
border-bottom: 1px solid #e4e7ed;
background-color: #fafafa;
.header-left {
display: flex;
align-items: center;
gap: 6px;
}
.coil-no-tag {
font-weight: 600;
font-size: 11px;
padding: 2px 6px;
}
.material-type {
font-size: 11px;
color: #606266;
font-weight: 500;
}
.param-icon {
font-size: 13px;
color: #909399;
cursor: pointer;
transition: color 0.3s;
&:hover {
color: #409eff;
}
}
}
.card-body {
padding: 8px;
flex: 1;
.info-list {
.info-item {
display: flex;
@@ -488,11 +519,11 @@ export default {
margin-bottom: 4px;
font-size: 11px;
line-height: 1.4;
&:last-child {
margin-bottom: 0;
}
.info-label {
color: #909399;
white-space: nowrap;
@@ -500,7 +531,7 @@ export default {
min-width: 40px;
font-size: 11px;
}
.info-value {
color: #303133;
flex: 1;
@@ -512,14 +543,14 @@ export default {
}
}
}
.card-footer {
padding: 6px 8px;
border-top: 1px solid #e4e7ed;
background-color: #fafafa;
display: flex;
justify-content: center;
.action-btn {
width: 100%;
padding: 5px 10px;
@@ -537,32 +568,32 @@ export default {
flex-direction: column;
transition: all 0.3s ease;
height: 100%;
&:hover {
border-color: #67c23a;
box-shadow: 0 2px 8px rgba(103, 194, 58, 0.15);
}
&.urgent-card {
border-left: 4px solid #f56c6c;
background-color: #fef0f0;
&:hover {
border-color: #f56c6c;
box-shadow: 0 2px 8px rgba(245, 108, 108, 0.2);
}
}
&.important-card {
border-left: 4px solid #e6a23c;
background-color: #fdf6ec;
&:hover {
border-color: #e6a23c;
box-shadow: 0 2px 8px rgba(230, 162, 60, 0.2);
}
}
.card-header {
padding: 10px 12px;
border-bottom: 1px solid #e4e7ed;
@@ -570,41 +601,41 @@ export default {
display: flex;
justify-content: space-between;
align-items: center;
.coil-no-tag {
font-weight: 600;
font-size: 12px;
}
.status-tags {
display: flex;
gap: 4px;
flex-wrap: wrap;
}
}
.card-body {
padding: 12px;
flex: 1;
.info-list {
.info-item {
display: flex;
align-items: center;
margin-bottom: 8px;
font-size: 12px;
&:last-child {
margin-bottom: 0;
}
.info-label {
color: #909399;
white-space: nowrap;
margin-right: 6px;
min-width: 50px;
}
.info-value {
color: #303133;
flex: 1;
@@ -612,14 +643,14 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
}
.action-type-tag {
font-size: 11px;
}
}
}
}
.card-footer {
padding: 10px 12px;
border-top: 1px solid #e4e7ed;
@@ -627,7 +658,7 @@ export default {
display: flex;
justify-content: center;
gap: 6px;
.action-btn {
flex: 1;
font-size: 12px;
@@ -656,7 +687,7 @@ export default {
padding-bottom: 8px;
border-bottom: 1px solid #e4e7ed;
}
.params-list {
.param-item {
.param-row {
@@ -664,17 +695,17 @@ export default {
margin-bottom: 6px;
font-size: 12px;
line-height: 1.5;
&:last-child {
margin-bottom: 0;
}
.param-label {
color: #909399;
min-width: 70px;
margin-right: 8px;
}
.param-value {
color: #303133;
flex: 1;
@@ -682,7 +713,7 @@ export default {
}
}
}
.param-divider {
height: 1px;
background-color: #e4e7ed;