Browse Source

loading

dev
han\hanst 1 year ago
parent
commit
eaf9fa363d
  1. 50
      src/views/modules/other-transaction/other-inbound.vue
  2. 43
      src/views/modules/other-transaction/other-outbound.vue

50
src/views/modules/other-transaction/other-inbound.vue

@ -119,10 +119,11 @@
<!-- 底部操作按钮 --> <!-- 底部操作按钮 -->
<div class="bottom-actions" v-if="scannedItems.length > 0"> <div class="bottom-actions" v-if="scannedItems.length > 0">
<button class="action-btn primary" @click="confirmInbound">
确认其它入库
<button class="action-btn primary" @click="confirmInbound" :disabled="loading">
<i v-if="loading" class="el-icon-loading"></i>
{{ loading ? '处理中...' : '确认其它入库' }}
</button> </button>
<button class="action-btn secondary" style="margin-left: 10px;" @click="cancelProcess">
<button class="action-btn secondary" style="margin-left: 10px;" @click="cancelProcess" :disabled="loading">
取消 取消
</button> </button>
</div> </div>
@ -144,7 +145,8 @@ export default {
targetLocationId: '' targetLocationId: ''
}, },
scannedItems: [], scannedItems: [],
site: localStorage.getItem('site') || 'SITE01'
site: localStorage.getItem('site'),
loading: false // 加载状态
}; };
}, },
methods: { methods: {
@ -240,7 +242,11 @@ export default {
this.$message.error('HandlingUnit站点不匹配'); this.$message.error('HandlingUnit站点不匹配');
return; return;
} }
// 校验HU是否在库
if (huInfo.inStockFlag !== 'X') {
this.$message.error(unitId+'不是未入库状态');
return;
}
// 添加到列表 // 添加到列表
this.scannedItems.push({ this.scannedItems.push({
id: Date.now(), id: Date.now(),
@ -321,6 +327,9 @@ export default {
scannedItems: this.scannedItems scannedItems: this.scannedItems
}; };
// 开始加载
this.loading = true;
// 调用后端API // 调用后端API
confirmOtherInbound(params).then(({ data }) => { confirmOtherInbound(params).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@ -330,9 +339,10 @@ export default {
duration: 3000 duration: 3000
}); });
// 跳转回其他出入库页面
// 清空当前页面内容并聚焦扫描框
setTimeout(() => { setTimeout(() => {
this.$router.push({ path: '/otherinout' });
this.clearFormData();
this.focusScanInput();
}, 1000); }, 1000);
} else { } else {
this.$message.error(data.msg || '其它入库失败'); this.$message.error(data.msg || '其它入库失败');
@ -340,6 +350,9 @@ export default {
}).catch(error => { }).catch(error => {
console.error('其它入库失败:', error); console.error('其它入库失败:', error);
this.$message.error('其它入库失败,请重试'); this.$message.error('其它入库失败,请重试');
}).finally(() => {
// 结束加载
this.loading = false;
}); });
}, },
@ -363,6 +376,29 @@ export default {
// 初始化表单数据 // 初始化表单数据
initFormData() { 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('扫描框已聚焦');
}
});
} }
}, },

43
src/views/modules/other-transaction/other-outbound.vue

@ -109,10 +109,11 @@
<!-- 底部操作按钮 --> <!-- 底部操作按钮 -->
<div class="bottom-actions" v-if="scannedItems.length > 0"> <div class="bottom-actions" v-if="scannedItems.length > 0">
<button class="action-btn primary" @click="confirmOutbound">
确认其它出库
<button class="action-btn primary" @click="confirmOutbound" :disabled="loading">
<i v-if="loading" class="el-icon-loading"></i>
{{ loading ? '处理中...' : '确认其它出库' }}
</button> </button>
<button class="action-btn secondary" style="margin-left: 10px;" @click="cancelProcess">
<button class="action-btn secondary" style="margin-left: 10px;" @click="cancelProcess" :disabled="loading">
取消 取消
</button> </button>
</div> </div>
@ -134,7 +135,8 @@ export default {
outboundReason: '' outboundReason: ''
}, },
scannedItems: [], scannedItems: [],
site: localStorage.getItem('site') || 'SITE01'
site: localStorage.getItem('site'),
loading: false // 加载状态
}; };
}, },
methods: { methods: {
@ -245,6 +247,9 @@ export default {
scannedItems: this.scannedItems scannedItems: this.scannedItems
}; };
// 开始加载
this.loading = true;
// 调用后端API // 调用后端API
confirmOtherOutbound(params).then(({ data }) => { confirmOtherOutbound(params).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@ -254,9 +259,10 @@ export default {
duration: 3000 duration: 3000
}); });
// 跳转回其他出入库页面
// 清空当前页面内容并聚焦扫描框
setTimeout(() => { setTimeout(() => {
this.$router.push({ path: '/otherinout' });
this.clearFormData();
this.focusScanInput();
}, 1000); }, 1000);
} else { } else {
this.$message.error(data.msg || '其它出库失败'); this.$message.error(data.msg || '其它出库失败');
@ -264,6 +270,9 @@ export default {
}).catch(error => { }).catch(error => {
console.error('其它出库失败:', error); console.error('其它出库失败:', error);
this.$message.error('其它出库失败,请重试'); this.$message.error('其它出库失败,请重试');
}).finally(() => {
// 结束加载
this.loading = false;
}); });
}, },
@ -287,6 +296,28 @@ export default {
// 初始化表单数据 // 初始化表单数据
initFormData() { 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() { mounted() {

Loading…
Cancel
Save