From bb4c2761ace4fbe93fd64549414dbe5413b4681c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Tue, 4 Nov 2025 09:42:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=92=A2=E5=8D=B7=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=9C=9F=E5=AE=9E=E5=BA=93=E5=8C=BA=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在分卷、合卷和钢卷录入页面添加真实库区选择组件 - 将nextWarehouseId字段重命名为warehouseId以统一命名 - 添加加载状态提示提升用户体验 - 优化表单布局和字段验证规则 --- klp-ui/src/views/wms/coil/merge.vue | 32 +++- klp-ui/src/views/wms/coil/split.vue | 36 +++- klp-ui/src/views/wms/coil/typing.vue | 245 +++++++++++---------------- 3 files changed, 156 insertions(+), 157 deletions(-) diff --git a/klp-ui/src/views/wms/coil/merge.vue b/klp-ui/src/views/wms/coil/merge.vue index 49233365..9e3c6703 100644 --- a/klp-ui/src/views/wms/coil/merge.vue +++ b/klp-ui/src/views/wms/coil/merge.vue @@ -176,8 +176,8 @@ - - + + + + + @@ -238,7 +247,8 @@ export default { itemId: null, grossWeight: null, netWeight: null, - nextWarehouseId: null + warehouseId: null, + actualWarehouseId: null }, loading: false, // 钢卷选择器可见性 @@ -370,7 +380,8 @@ export default { // 自动填充目标卷信息 this.targetCoil.itemType = data.itemType; this.targetCoil.itemId = data.itemId; - this.targetCoil.nextWarehouseId = data.warehouseId; + this.targetCoil.warehouseId = data.warehouseId; + this.targetCoil.actualWarehouseId = data.actualWarehouseId; // 加载对应的物品列表 if (data.itemType) { @@ -566,7 +577,8 @@ export default { if (index === 0) { this.targetCoil.itemType = coil.itemType; this.targetCoil.itemId = coil.itemId; - this.targetCoil.nextWarehouseId = coil.warehouseId; + this.targetCoil.warehouseId = coil.warehouseId; + this.targetCoil.actualWarehouseId = coil.actualWarehouseId; } this.$message.success('钢卷选择成功'); @@ -619,7 +631,8 @@ export default { itemId: this.targetCoil.itemId, grossWeight: this.targetCoil.grossWeight, netWeight: this.targetCoil.netWeight, - nextWarehouseId: this.targetCoil.nextWarehouseId, + warehouseId: this.targetCoil.warehouseId, + actualWarehouseId: this.targetCoil.actualWarehouseId, hasMergeSplit: 2, // 2表示合卷 newCoils: this.sourceCoils.map(item => ({ coilId: item.coilId, @@ -629,7 +642,11 @@ export default { }; console.log('提交的合卷数据:', mergeData); - + const loadingInstance = this.$loading({ + lock: true, + text: '正在合卷,请稍后...', + background: 'rgba(0, 0, 0, 0.7)' + }) const response = await mergeMaterialCoil(mergeData); if (response.code === 200) { this.$message.success('合卷保存成功'); @@ -649,6 +666,7 @@ export default { console.error(error); } finally { this.loading = false; + loadingInstance.close(); } }, diff --git a/klp-ui/src/views/wms/coil/split.vue b/klp-ui/src/views/wms/coil/split.vue index 0f3d10e4..599fa97f 100644 --- a/klp-ui/src/views/wms/coil/split.vue +++ b/klp-ui/src/views/wms/coil/split.vue @@ -169,8 +169,8 @@ + + + @@ -212,11 +221,13 @@ import { listWarehouse } from '@/api/wms/warehouse'; import { listRawMaterial } from '@/api/wms/rawMaterial'; import { listProduct } from '@/api/wms/product'; import CoilSelector from '@/components/CoilSelector'; +import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect"; export default { name: 'SplitCoil', components: { - CoilSelector + CoilSelector, + ActualWarehouseSelect }, data() { return { @@ -245,7 +256,8 @@ export default { itemId: null, grossWeight: null, netWeight: null, - nextWarehouseId: null + warehouseId: null, + actualWarehouseId: null } ], loading: false, @@ -441,7 +453,8 @@ export default { itemId: null, grossWeight: null, netWeight: null, - nextWarehouseId: null + warehouseId: null, + actualWarehouseId: null }); }, @@ -495,12 +508,18 @@ export default { this.$message.error(`第${i + 1}个子卷的净重不能为空`); return; } - if (!item.nextWarehouseId) { + if (!item.warehouseId) { this.$message.error(`第${i + 1}个子卷的目标库区不能为空`); return; } } + const loadingInstance = this.$loading({ + lock: true, + text: '正在分卷,请稍后...', + background: 'rgba(0, 0, 0, 0.7)' + }) + try { this.loading = true; @@ -518,7 +537,8 @@ export default { itemId: item.itemId || this.motherCoil.itemId, grossWeight: item.grossWeight, netWeight: item.netWeight, - nextWarehouseId: item.nextWarehouseId, + warehouseId: item.warehouseId, + actualWarehouseId: item.actualWarehouseId, hasMergeSplit: 1 })) }; @@ -535,11 +555,13 @@ export default { } else { this.$message.error(response.msg || '分卷保存失败'); } + } catch (error) { this.$message.error('分卷保存失败'); console.error(error); } finally { this.loading = false; + loadingInstance.close(); } }, diff --git a/klp-ui/src/views/wms/coil/typing.vue b/klp-ui/src/views/wms/coil/typing.vue index ea81f813..3104232a 100644 --- a/klp-ui/src/views/wms/coil/typing.vue +++ b/klp-ui/src/views/wms/coil/typing.vue @@ -20,7 +20,7 @@
当前信息
- +
入场钢卷号: @@ -75,20 +75,10 @@ 复制当前信息
- - + + - + @@ -96,11 +86,7 @@ - + @@ -108,88 +94,49 @@ - + - - + + - + - + - - - + + + + + + + - + @@ -205,15 +152,11 @@ 刷新
- + - +
{{ step.operation || step.action }}
@@ -231,7 +174,7 @@
- +

暂无变更历史

@@ -247,9 +190,13 @@ import { completeAction } from '@/api/wms/pendingAction'; import { listWarehouse } from '@/api/wms/warehouse'; import { listRawMaterial } from '@/api/wms/rawMaterial'; import { listProduct } from '@/api/wms/product'; +import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect"; export default { name: 'TypingCoil', + components: { + ActualWarehouseSelect + }, data() { return { loading: false, @@ -267,7 +214,7 @@ export default { grossWeight: null, netWeight: null, warehouseId: null, - nextWarehouseId: null, + warehouseId: null, nextWarehouseName: '', status: 0, remark: '' @@ -280,7 +227,8 @@ export default { itemId: null, grossWeight: null, netWeight: null, - nextWarehouseId: null, + warehouseId: null, + actualWarehouseId: null, remark: '' }, rules: { @@ -304,8 +252,11 @@ export default { { required: true, message: '请输入净重', trigger: 'blur' }, { type: 'number', message: '净重必须为数字', trigger: 'blur' } ], - nextWarehouseId: [ + warehouseId: [ { required: true, message: '请选择目标库区', trigger: 'change' } + ], + actualWarehouseId: [ + { required: true, message: '请选择真实库区', trigger: 'change' } ] }, warehouseList: [], @@ -348,20 +299,20 @@ export default { async created() { // 先加载库区列表 await this.loadWarehouses(); - + // 从路由参数获取coilId和actionId const coilId = this.$route.query.coilId; const actionId = this.$route.query.actionId; const readonly = this.$route.query.readonly; - + if (coilId) { await this.loadCoilInfo(coilId); } - + if (actionId) { this.actionId = actionId; } - + // 设置只读模式 if (readonly === 'true' || readonly === true) { this.readonly = true; @@ -375,7 +326,7 @@ export default { const response = await getMaterialCoil(coilId); if (response.code === 200 && response.data) { const data = response.data; - + // 填充当前信息(左侧) this.currentInfo = { coilId: data.coilId, @@ -389,23 +340,23 @@ export default { grossWeight: data.grossWeight, netWeight: data.netWeight, warehouseId: data.warehouseId, - nextWarehouseId: data.nextWarehouseId, - nextWarehouseName: this.getWarehouseName(data.nextWarehouseId), + actualWarehouseId: data.actualWarehouseId, + nextWarehouseName: this.getWarehouseName(data.warehouseId), remark: data.remark || '' }; - + console.log('当前信息加载完成:', this.currentInfo); - + // 重新获取库区名称(确保warehouseList已加载) - if (data.nextWarehouseId) { - this.currentInfo.nextWarehouseName = this.getWarehouseName(data.nextWarehouseId); + if (data.warehouseId) { + this.currentInfo.nextWarehouseName = this.getWarehouseName(data.warehouseId); } - + // 加载对应类型的物品列表 if (data.itemType) { await this.loadItemList(data.itemType); } - + // 加载变更历史 this.loadHistory(); } @@ -457,7 +408,7 @@ export default { // 加载物品列表(根据类型) async loadItemList(itemType) { if (!itemType) return; - + try { this.itemSearchLoading = true; if (itemType === 'raw_material') { @@ -484,23 +435,23 @@ export default { this.$message.warning('请先选择物品类型'); return; } - + try { this.itemSearchLoading = true; if (this.updateForm.itemType === 'raw_material') { - const response = await listRawMaterial({ + const response = await listRawMaterial({ rawMaterialName: query, - pageNum: 1, - pageSize: 50 + pageNum: 1, + pageSize: 50 }); if (response.code === 200) { this.rawMaterialList = response.rows || []; } } else if (this.updateForm.itemType === 'product') { - const response = await listProduct({ + const response = await listProduct({ productName: query, - pageNum: 1, - pageSize: 50 + pageNum: 1, + pageSize: 50 }); if (response.code === 200) { this.productList = response.rows || []; @@ -523,14 +474,14 @@ export default { if (!this.currentInfo.enterCoilNo) { return; } - + try { this.historyLoading = true; const response = await getMaterialCoilTrace({ enterCoilNo: this.currentInfo.enterCoilNo, currentCoilNo: this.currentInfo.currentCoilNo || undefined }); - + if (response.code === 200 && response.data) { this.historySteps = response.data.steps || []; } @@ -550,17 +501,17 @@ export default { itemId: this.currentInfo.itemId, grossWeight: parseFloat(this.currentInfo.grossWeight) || null, netWeight: parseFloat(this.currentInfo.netWeight) || null, - nextWarehouseId: this.currentInfo.nextWarehouseId, + warehouseId: this.currentInfo.warehouseId, remark: this.currentInfo.remark }; - + console.log('复制的表单数据:', this.updateForm); - + // 加载对应的物品列表 if (this.updateForm.itemType) { this.loadItemList(this.updateForm.itemType); } - + this.$message.success('已复制当前信息'); }, @@ -571,9 +522,15 @@ export default { return false; } + const loadingInstance = this.$loading({ + lock: true, + text: '正在更新钢卷信息,请稍后...', + background: 'rgba(0, 0, 0, 0.7)' + }) + try { this.loading = true; - + // 构造更新数据(使用标准update接口,会创建历史版本) const updateData = { coilId: this.currentInfo.coilId, @@ -585,23 +542,24 @@ export default { itemId: this.updateForm.itemId, grossWeight: this.updateForm.grossWeight, netWeight: this.updateForm.netWeight, - warehouseId: this.currentInfo.warehouseId, // 当前库区ID(保持不变) - nextWarehouseId: this.updateForm.nextWarehouseId, // 目标库区ID + // warehouseId: this.currentInfo.warehouseId, // 当前库区ID(保持不变) + actualWarehouseId: this.updateForm.actualWarehouseId, // 真实库区ID + warehouseId: this.updateForm.warehouseId, // 目标库区ID remark: this.updateForm.remark }; - + console.log('提交的更新数据:', updateData); - + const response = await updateMaterialCoil(updateData); - + if (response.code === 200) { this.$message.success('钢卷信息更新成功'); - + // 如果是从待操作列表进来的,标记操作为完成 if (this.actionId) { await completeAction(this.actionId); } - + // 延迟返回 setTimeout(() => { this.$router.back(); @@ -614,6 +572,7 @@ export default { console.error(error); } finally { this.loading = false; + loadingInstance.close(); } }); }, @@ -652,7 +611,7 @@ export default { display: flex; align-items: center; gap: 8px; - + i { color: #0066cc; font-size: 20px; @@ -687,7 +646,7 @@ export default { flex: 1; display: flex; flex-direction: column; - + ::v-deep .el-card__body { flex: 1; display: flex; @@ -706,7 +665,7 @@ export default { align-items: center; justify-content: space-between; font-weight: 500; - + i { color: #0066cc; margin-right: 5px; @@ -719,18 +678,18 @@ export default { display: flex; align-items: flex-start; margin-bottom: 12px; - + &:last-child { margin-bottom: 0; } - + .info-label { color: #909399; font-size: 14px; min-width: 110px; flex-shrink: 0; } - + .info-value { color: #303133; font-size: 14px; @@ -746,17 +705,17 @@ export default { ::v-deep .el-card__body { max-height: 400px; overflow-y: auto; - + &::-webkit-scrollbar { width: 6px; } - + &::-webkit-scrollbar-thumb { background: #dcdfe6; border-radius: 3px; } } - + ::v-deep .el-timeline { padding-left: 10px; } @@ -768,12 +727,12 @@ export default { color: #303133; margin-bottom: 8px; } - + .history-detail { font-size: 13px; color: #606266; margin-bottom: 4px; - + .detail-label { color: #909399; margin-right: 5px; @@ -785,13 +744,13 @@ export default { text-align: center; padding: 40px 0; color: #909399; - + i { font-size: 48px; margin-bottom: 10px; display: block; } - + p { margin: 0; } @@ -801,21 +760,21 @@ export default { .form-card { ::v-deep .el-input-number { width: 100%; - + .el-input__inner { text-align: left; } } - + ::v-deep .el-form-item { margin-bottom: 20px; } - + // 修复数字输入框的样式 ::v-deep input[type="number"] { appearance: textfield; -moz-appearance: textfield; - + &::-webkit-outer-spin-button, &::-webkit-inner-spin-button { -webkit-appearance: none; @@ -835,7 +794,7 @@ export default { ::v-deep .el-button--primary.el-button--small.is-plain, ::v-deep .el-button--text { color: #409eff; - + &:hover { color: #66b1ff; }