feat(wms): 为产需单绑定列表添加加载状态

- 在绑定产需单表格区域添加v-loading指令显示加载状态
- 新增boundReqLoading数据属性控制加载状态
- 在loadBoundRequirements方法开始时设置加载状态为true
- 在各种返回条件下正确重置加载状态为false
- 确保异步操作完成后始终关闭加载状态
This commit is contained in:
jhd
2026-07-10 09:41:34 +08:00
parent 319b8855fe
commit bf1ac5ed2e

View File

@@ -192,7 +192,7 @@
<div class="detail-card-header">
<span>已绑定的产需单{{ boundReqList.length }} </span>
</div>
<div class="detail-card-body" style="padding:0;">
<div class="detail-card-body" style="padding:0;" v-loading="boundReqLoading" element-loading-text="查询产需单中...">
<el-table v-if="boundReqList.length > 0" :data="boundReqList" border size="small" class="aps-product-table">
<el-table-column label="产需单号" prop="scheduleNo" min-width="140" />
<el-table-column label="生产日期" prop="prodDate" width="100" align="center" />
@@ -266,6 +266,7 @@ export default {
total: 0,
currentOrder: null,
boundReqList: [],
boundReqLoading: false,
productList: [],
productName: '',
totalQuantity: 0,
@@ -347,10 +348,11 @@ export default {
/** 加载已绑定的产需单 */
loadBoundRequirements(orderId) {
this.boundReqList = []
if (!orderId) return
this.boundReqLoading = true
if (!orderId) { this.boundReqLoading = false; return }
listRel({ orderId }).then(relRes => {
const rels = (relRes.rows || []).filter(r => r.scheduleId)
if (rels.length === 0) return
if (rels.length === 0) { this.boundReqLoading = false; return }
const scheduleIds = [...new Set(rels.map(r => r.scheduleId))]
Promise.all(scheduleIds.map(id => getRequirement(id).catch(() => null))).then(reqs => {
const reqMap = {}
@@ -370,9 +372,11 @@ export default {
}
return arr
}, [])
this.boundReqLoading = false
})
}).catch(() => {
this.boundReqList = []
this.boundReqLoading = false
})
},
reqStatusTag(status) {