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">
<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 class="action-btn secondary" style="margin-left: 10px;" @click="cancelProcess">
<button class="action-btn secondary" style="margin-left: 10px;" @click="cancelProcess" :disabled="loading">
取消
</button>
</div>
@ -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('扫描框已聚焦');
}
});
}
},

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

@ -109,10 +109,11 @@
<!-- 底部操作按钮 -->
<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 class="action-btn secondary" style="margin-left: 10px;" @click="cancelProcess">
<button class="action-btn secondary" style="margin-left: 10px;" @click="cancelProcess" :disabled="loading">
取消
</button>
</div>
@ -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() {

Loading…
Cancel
Save