|
@@ -108,6 +108,8 @@ export default {
|
|
* @param {Array} ids
|
|
* @param {Array} ids
|
|
*/
|
|
*/
|
|
async getDateil(ids, funcType = 'getDeliverDetail') {
|
|
async getDateil(ids, funcType = 'getDeliverDetail') {
|
|
|
|
+ this.$startLoading()
|
|
|
|
+ let loadingLen
|
|
// 兼容多个打印数据
|
|
// 兼容多个打印数据
|
|
ids = ids instanceof Array ? ids : [ids]
|
|
ids = ids instanceof Array ? ids : [ids]
|
|
console.log(ids);
|
|
console.log(ids);
|
|
@@ -133,22 +135,27 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
if (funcType === 'getDtailPrintDis') {
|
|
if (funcType === 'getDtailPrintDis') {
|
|
|
|
+
|
|
const requestParams = params
|
|
const requestParams = params
|
|
try {
|
|
try {
|
|
const { data } = await getDtailPrintDis(requestParams);
|
|
const { data } = await getDtailPrintDis(requestParams);
|
|
|
|
+ loadingLen = data.length
|
|
for (let i = data.length; i > 0; i--) {
|
|
for (let i = data.length; i > 0; i--) {
|
|
setTimeout(async () => {
|
|
setTimeout(async () => {
|
|
const newData = data[i - 1];
|
|
const newData = data[i - 1];
|
|
await this.mySetData(newData)
|
|
await this.mySetData(newData)
|
|
}, 0);
|
|
}, 0);
|
|
|
|
+ loadingLen--
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
|
+ this.$endLoading()
|
|
console.error('获取打印数据失败')
|
|
console.error('获取打印数据失败')
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
// id 去重
|
|
// id 去重
|
|
formatting = [...new Set(formatting)];
|
|
formatting = [...new Set(formatting)];
|
|
|
|
+ loadingLen = formatting.length
|
|
for (let i = formatting.length; i > 0; i--) {
|
|
for (let i = formatting.length; i > 0; i--) {
|
|
// 延迟请求
|
|
// 延迟请求
|
|
setTimeout(async () => {
|
|
setTimeout(async () => {
|
|
@@ -157,12 +164,17 @@ export default {
|
|
const { data } = await getDeliverDetail(requestParams);
|
|
const { data } = await getDeliverDetail(requestParams);
|
|
this.mySetData(data)
|
|
this.mySetData(data)
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
|
+ this.$endLoading()
|
|
console.error('获取打印数据失败')
|
|
console.error('获取打印数据失败')
|
|
|
|
+
|
|
}
|
|
}
|
|
}, 0);
|
|
}, 0);
|
|
|
|
+ loadingLen--
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if (loadingLen ==0) {
|
|
|
|
+ return Promise.resolve()
|
|
|
|
+ }
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|