diff --git a/src/views/modules/other-transaction/other-inbound.vue b/src/views/modules/other-transaction/other-inbound.vue
index 54c0299..15ce353 100644
--- a/src/views/modules/other-transaction/other-inbound.vue
+++ b/src/views/modules/other-transaction/other-inbound.vue
@@ -119,10 +119,11 @@
-
@@ -144,7 +145,8 @@ export default {
targetLocationId: ''
},
scannedItems: [],
- site: localStorage.getItem('site') || 'SITE01'
+ site: localStorage.getItem('site'),
+ loading: false // 加载状态
};
},
methods: {
@@ -240,7 +242,11 @@ export default {
this.$message.error('HandlingUnit站点不匹配');
return;
}
-
+ // 校验HU是否在库
+ if (huInfo.inStockFlag !== 'X') {
+ this.$message.error(unitId+'不是未入库状态');
+ return;
+ }
// 添加到列表
this.scannedItems.push({
id: Date.now(),
@@ -321,6 +327,9 @@ export default {
scannedItems: this.scannedItems
};
+ // 开始加载
+ this.loading = true;
+
// 调用后端API
confirmOtherInbound(params).then(({ data }) => {
if (data && data.code === 0) {
@@ -330,9 +339,10 @@ export default {
duration: 3000
});
- // 跳转回其他出入库页面
+ // 清空当前页面内容并聚焦扫描框
setTimeout(() => {
- this.$router.push({ path: '/otherinout' });
+ this.clearFormData();
+ this.focusScanInput();
}, 1000);
} else {
this.$message.error(data.msg || '其它入库失败');
@@ -340,6 +350,9 @@ export default {
}).catch(error => {
console.error('其它入库失败:', error);
this.$message.error('其它入库失败,请重试');
+ }).finally(() => {
+ // 结束加载
+ this.loading = false;
});
},
@@ -363,6 +376,29 @@ export default {
// 初始化表单数据
initFormData() {
// 可以在这里设置其他默认值
+ },
+
+ // 清空表单数据
+ clearFormData() {
+ this.scanCode = '';
+ this.isRemoveMode = false;
+ this.inboundForm = {
+ inboundReason: '',
+ targetLocationId: ''
+ };
+ this.scannedItems = [];
+ this.loading = false; // 重置加载状态
+ console.log('表单数据已清空');
+ },
+
+ // 聚焦扫描框
+ focusScanInput() {
+ this.$nextTick(() => {
+ if (this.$refs.scanInput) {
+ this.$refs.scanInput.focus();
+ console.log('扫描框已聚焦');
+ }
+ });
}
},
diff --git a/src/views/modules/other-transaction/other-outbound.vue b/src/views/modules/other-transaction/other-outbound.vue
index d96ce0b..c73cde8 100644
--- a/src/views/modules/other-transaction/other-outbound.vue
+++ b/src/views/modules/other-transaction/other-outbound.vue
@@ -109,10 +109,11 @@
-
- 确认其它出库
+
+
+ {{ loading ? '处理中...' : '确认其它出库' }}
-
+
取消
@@ -134,7 +135,8 @@ export default {
outboundReason: ''
},
scannedItems: [],
- site: localStorage.getItem('site') || 'SITE01'
+ site: localStorage.getItem('site'),
+ loading: false // 加载状态
};
},
methods: {
@@ -245,6 +247,9 @@ export default {
scannedItems: this.scannedItems
};
+ // 开始加载
+ this.loading = true;
+
// 调用后端API
confirmOtherOutbound(params).then(({ data }) => {
if (data && data.code === 0) {
@@ -254,9 +259,10 @@ export default {
duration: 3000
});
- // 跳转回其他出入库页面
+ // 清空当前页面内容并聚焦扫描框
setTimeout(() => {
- this.$router.push({ path: '/otherinout' });
+ this.clearFormData();
+ this.focusScanInput();
}, 1000);
} else {
this.$message.error(data.msg || '其它出库失败');
@@ -264,6 +270,9 @@ export default {
}).catch(error => {
console.error('其它出库失败:', error);
this.$message.error('其它出库失败,请重试');
+ }).finally(() => {
+ // 结束加载
+ this.loading = false;
});
},
@@ -287,6 +296,28 @@ export default {
// 初始化表单数据
initFormData() {
// 可以在这里设置其他默认值
+ },
+
+ // 清空表单数据
+ clearFormData() {
+ this.scanCode = '';
+ this.isRemoveMode = false;
+ this.outboundForm = {
+ outboundReason: ''
+ };
+ this.scannedItems = [];
+ this.loading = false; // 重置加载状态
+ console.log('表单数据已清空');
+ },
+
+ // 聚焦扫描框
+ focusScanInput() {
+ this.$nextTick(() => {
+ if (this.$refs.scanInput) {
+ this.$refs.scanInput.focus();
+ console.log('扫描框已聚焦');
+ }
+ });
}
},
mounted() {