feat(wms): 为产需单绑定列表添加加载状态
- 在绑定产需单表格区域添加v-loading指令显示加载状态 - 新增boundReqLoading数据属性控制加载状态 - 在loadBoundRequirements方法开始时设置加载状态为true - 在各种返回条件下正确重置加载状态为false - 确保异步操作完成后始终关闭加载状态
This commit is contained in:
@@ -192,7 +192,7 @@
|
|||||||
<div class="detail-card-header">
|
<div class="detail-card-header">
|
||||||
<span>已绑定的产需单({{ boundReqList.length }} 条)</span>
|
<span>已绑定的产需单({{ boundReqList.length }} 条)</span>
|
||||||
</div>
|
</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 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="scheduleNo" min-width="140" />
|
||||||
<el-table-column label="生产日期" prop="prodDate" width="100" align="center" />
|
<el-table-column label="生产日期" prop="prodDate" width="100" align="center" />
|
||||||
@@ -266,6 +266,7 @@ export default {
|
|||||||
total: 0,
|
total: 0,
|
||||||
currentOrder: null,
|
currentOrder: null,
|
||||||
boundReqList: [],
|
boundReqList: [],
|
||||||
|
boundReqLoading: false,
|
||||||
productList: [],
|
productList: [],
|
||||||
productName: '',
|
productName: '',
|
||||||
totalQuantity: 0,
|
totalQuantity: 0,
|
||||||
@@ -347,10 +348,11 @@ export default {
|
|||||||
/** 加载已绑定的产需单 */
|
/** 加载已绑定的产需单 */
|
||||||
loadBoundRequirements(orderId) {
|
loadBoundRequirements(orderId) {
|
||||||
this.boundReqList = []
|
this.boundReqList = []
|
||||||
if (!orderId) return
|
this.boundReqLoading = true
|
||||||
|
if (!orderId) { this.boundReqLoading = false; return }
|
||||||
listRel({ orderId }).then(relRes => {
|
listRel({ orderId }).then(relRes => {
|
||||||
const rels = (relRes.rows || []).filter(r => r.scheduleId)
|
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))]
|
const scheduleIds = [...new Set(rels.map(r => r.scheduleId))]
|
||||||
Promise.all(scheduleIds.map(id => getRequirement(id).catch(() => null))).then(reqs => {
|
Promise.all(scheduleIds.map(id => getRequirement(id).catch(() => null))).then(reqs => {
|
||||||
const reqMap = {}
|
const reqMap = {}
|
||||||
@@ -370,9 +372,11 @@ export default {
|
|||||||
}
|
}
|
||||||
return arr
|
return arr
|
||||||
}, [])
|
}, [])
|
||||||
|
this.boundReqLoading = false
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.boundReqList = []
|
this.boundReqList = []
|
||||||
|
this.boundReqLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
reqStatusTag(status) {
|
reqStatusTag(status) {
|
||||||
|
|||||||
Reference in New Issue
Block a user