|
|
|
@ -84,16 +84,16 @@ |
|
|
|
|
|
|
|
<!-- 第三行:扫进/扫出选择 (扫描栈板后显示) --> |
|
|
|
<div v-if="palletScanned" class="input-group"> |
|
|
|
<div style="display: flex; gap: 8px; align-items: center;"> |
|
|
|
<div style="flex: 1;"> |
|
|
|
<el-radio-group v-model="operationType"> |
|
|
|
<el-radio label="in">扫进</el-radio> |
|
|
|
<el-radio label="out">扫出</el-radio> |
|
|
|
<div style="display: flex; gap: 8px; align-items: center; flex-wrap: nowrap;"> |
|
|
|
<div style="flex: 1; min-width: 0;"> |
|
|
|
<el-radio-group v-model="operationType" style="display: flex; flex-wrap: nowrap;"> |
|
|
|
<el-radio label="in" style="margin-right: 0px; white-space: nowrap;">扫进</el-radio> |
|
|
|
<el-radio label="out" style="white-space: nowrap;">扫出</el-radio> |
|
|
|
</el-radio-group> |
|
|
|
</div> |
|
|
|
<button |
|
|
|
class="action-btn secondary" |
|
|
|
style="margin: 0; white-space: nowrap;" |
|
|
|
style="margin: 0; white-space: nowrap; flex-shrink: 0;" |
|
|
|
@click="showScanModal" |
|
|
|
> |
|
|
|
扫描二维码 |
|
|
|
@ -137,6 +137,10 @@ |
|
|
|
:visible.sync="scanModalVisible" |
|
|
|
width="90%" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:show-close="false" |
|
|
|
:modal="true" |
|
|
|
:modal-append-to-body="true" |
|
|
|
:append-to-body="true" |
|
|
|
> |
|
|
|
<div class="scan-modal-content"> |
|
|
|
<!-- 扫进时显示位置和层数选择 --> |
|
|
|
@ -189,7 +193,6 @@ |
|
|
|
</div> |
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<button class="action-btn secondary" @click="handleLabelScan">确定</button> |
|
|
|
<button class="action-btn secondary" style="margin-left: 10px;" @click="closeScanModal">取消</button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
@ -227,6 +230,7 @@ export default { |
|
|
|
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({ |
|
|
|
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栈板 - 预留接口 |
|
|
|
@ -272,21 +273,19 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
// 位置选择变化 |
|
|
|
async handlePositionChange() { |
|
|
|
handlePositionChange() { |
|
|
|
if (this.selectedPosition) { |
|
|
|
try { |
|
|
|
const { data } = await getLayersByPosition({ |
|
|
|
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({ |
|
|
|
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,6 +318,7 @@ export default { |
|
|
|
this.scanPosition = ''; |
|
|
|
this.scanLayer = ''; |
|
|
|
this.scanLayerOptions = []; |
|
|
|
this.needRefreshOnClose = false; // 重置刷新标记 |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.scanInput) { |
|
|
|
@ -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({ |
|
|
|
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({ |
|
|
|
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({ |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
/* 修复模态框层级问题 */ |
|
|
|
::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; |
|
|
|
} |
|
|
|
</style> |