From b7d1385dee44a83dd0f5c29fff68f364c289cecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Sun, 21 Sep 2025 21:27:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=A0=88=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../automatedWarehouse/palletPacking.vue | 248 ++++++++++-------- 1 file changed, 134 insertions(+), 114 deletions(-) diff --git a/src/views/modules/automatedWarehouse/palletPacking.vue b/src/views/modules/automatedWarehouse/palletPacking.vue index 80b22bf..3078856 100644 --- a/src/views/modules/automatedWarehouse/palletPacking.vue +++ b/src/views/modules/automatedWarehouse/palletPacking.vue @@ -26,8 +26,8 @@ @keyup.enter.native="handlePalletScan" ref="palletInput" /> - @@ -214,20 +217,21 @@ export default { palletCode: '', palletScanned: false, operationType: 'in', // 'in' 或 'out' - + // 筛选条件 selectedPosition: '', selectedLayer: '', positionOptions: [], layerOptions: [], - + // 扫码模态框 scanModalVisible: false, scanCode: '', scanPosition: '', scanLayer: '', scanLayerOptions: [], - + needRefreshOnClose: false, // 标记是否需要在关闭模态框时刷新 + // 栈板明细 detailList: [], }; @@ -238,19 +242,16 @@ export default { }, // 扫描栈板 - async handlePalletScan() { + handlePalletScan() { if (!this.palletCode.trim()) { this.$message.error('请输入栈板编码'); return; } - try { - // 检查栈板是否存在并获取位置信息 - const { data } = await checkPalletExists({ - site: this.site, - palletId: this.palletCode - }); - + checkPalletExists({ + site: this.site, + palletId: this.palletCode + }).then(({ data }) => { if (data.code === 0) { this.palletScanned = true; this.positionOptions = data.positions || []; @@ -259,10 +260,10 @@ export default { } else { this.$message.error(data.msg || '栈板不存在'); } - } catch (error) { + }).catch(error => { console.error('验证栈板失败:', error); this.$message.error('验证栈板失败'); - } + }); }, // Call栈板 - 预留接口 @@ -271,22 +272,20 @@ export default { this.$message.info('Call栈板功能待实现'); }, - // 位置选择变化 - async handlePositionChange() { + // 位置选择变化 + handlePositionChange() { if (this.selectedPosition) { - try { - const { data } = await getLayersByPosition({ - site: this.site, - palletId: this.palletCode, - position: this.selectedPosition - }); - + getLayersByPosition({ + site: this.site, + palletId: this.palletCode, + position: this.selectedPosition + }).then(({ data }) => { if (data.code === 0) { this.layerOptions = data.layers || []; } - } catch (error) { + }).catch(error => { console.error('获取层数失败:', error); - } + }); } else { this.layerOptions = []; } @@ -294,24 +293,22 @@ export default { }, // 刷新表格 - async refreshTable() { - try { - const { data } = await getPalletDetails({ - site: this.site, - palletId: this.palletCode, - position: this.selectedPosition, - layer: this.selectedLayer - }); - + refreshTable() { + getPalletDetails({ + site: this.site, + palletId: this.palletCode, + position: this.selectedPosition, + layer: this.selectedLayer + }).then(({ data }) => { if (data.code === 0) { this.detailList = data.details || []; } else { this.detailList = []; } - } catch (error) { + }).catch(error => { console.error('获取栈板明细失败:', error); this.detailList = []; - } + }); }, // 显示扫码模态框 @@ -321,7 +318,8 @@ export default { this.scanPosition = ''; this.scanLayer = ''; this.scanLayerOptions = []; - + this.needRefreshOnClose = false; // 重置刷新标记 + this.$nextTick(() => { if (this.$refs.scanInput) { this.$refs.scanInput.focus(); @@ -332,26 +330,32 @@ export default { // 关闭扫码模态框 closeScanModal() { this.scanModalVisible = false; + // 如果有操作成功,则在关闭时刷新外面的列表 + if (this.needRefreshOnClose) { + this.refreshTable(); + this.needRefreshOnClose = false; + } }, - // 扫码模态框中位置变化 - async handleScanPositionChange() { + // 扫码模态框中位置变化 + handleScanPositionChange() { if (this.scanPosition) { - try { - const { data } = await getLayersByPosition({ - site: this.site, - palletId: this.palletCode, - position: this.scanPosition - }); - + getLayersByPosition({ + site: this.site, + palletId: this.palletCode, + position: this.scanPosition + }).then(({ data }) => { if (data.code === 0) { - const maxLayer = Math.max(...(data.layers || [0])); - this.scanLayerOptions = Array.from({length: maxLayer + 1}, (_, i) => i + 1); + const maxLayer = data.layers && data.layers.length > 0 + ? Math.max(...data.layers) + : 0; + + this.scanLayerOptions = Array.from({ length: maxLayer+1 }, (_, i) => i + 1) } - } catch (error) { + }).catch(error => { console.error('获取层数失败:', error); this.scanLayerOptions = [1]; - } + }); } else { this.scanLayerOptions = []; } @@ -359,7 +363,7 @@ export default { }, // 处理标签扫描 - async handleLabelScan() { + handleLabelScan() { if (!this.scanCode.trim()) { this.$message.error('请输入标签编码'); return; @@ -376,46 +380,44 @@ export default { return; } - try { - const { data } = await savePalletDetail({ - site: this.site, - palletId: this.palletCode, - position: this.scanPosition, - layer: this.scanLayer, - serialNo: this.scanCode - }); - + savePalletDetail({ + site: this.site, + palletId: this.palletCode, + position: this.scanPosition, + layer: this.scanLayer, + serialNo: this.scanCode + }).then(({ data }) => { if (data.code === 0) { this.$message.success('扫进成功'); - this.closeScanModal(); - this.refreshTable(); + this.needRefreshOnClose = true; // 标记需要在关闭时刷新 + this.scanCode = ''; // 清空扫描码,准备下次扫描 + this.$refs.scanInput.focus(); } else { this.$message.error(data.msg || '扫进失败'); } - } catch (error) { + }).catch(error => { console.error('扫进失败:', error); this.$message.error('扫进失败'); - } + }); } else { // 扫出操作 - try { - const { data } = await deletePalletDetail({ - site: this.site, - palletId: this.palletCode, - serialNo: this.scanCode - }); - + deletePalletDetail({ + site: this.site, + palletId: this.palletCode, + serialNo: this.scanCode + }).then(({ data }) => { if (data.code === 0) { this.$message.success('扫出成功'); - this.closeScanModal(); - this.refreshTable(); + this.needRefreshOnClose = true; // 标记需要在关闭时刷新 + this.scanCode = ''; // 清空扫描码,准备下次扫描 + this.$refs.scanInput.focus(); } else { this.$message.error(data.msg || '扫出失败'); } - } catch (error) { + }).catch(error => { console.error('扫出失败:', error); this.$message.error('扫出失败'); - } + }); } }, }, @@ -502,4 +504,22 @@ export default { .dialog-footer { text-align: center; } - \ No newline at end of file + +/* 修复模态框层级问题 */ +::v-deep .el-dialog__wrapper { + z-index: 2000 !important; +} + +::v-deep .el-overlay { + z-index: 2000 !important; +} + +/* 修复单选框样式 */ +::v-deep .el-radio { + margin-right: 8px !important; +} + +::v-deep .el-radio__label { + font-size: 14px; +} +