|
|
|
|
@ -27,7 +27,7 @@ |
|
|
|
|
</template> |
|
|
|
|
<template #platingId="scope"> |
|
|
|
|
<el-select v-model="scope.row.platingId" filterable> |
|
|
|
|
<el-option v-for="item in abilityData" :key="item.id" :label="item.caName" :value="item.id"></el-option> |
|
|
|
|
<el-option v-for="item in scope.row.abilityData" :key="item.id" :label="item.caName" :value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</template> |
|
|
|
|
<template #dsPart="scope"> |
|
|
|
|
@ -248,7 +248,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getSupplierData() |
|
|
|
|
this.getAbility() |
|
|
|
|
// this.getAbility() |
|
|
|
|
// this.getPartData() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
@ -366,20 +366,77 @@ export default { |
|
|
|
|
this.partData = res.data.data |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
onLoad() { |
|
|
|
|
// onLoad() { |
|
|
|
|
// this.loading = true; |
|
|
|
|
// getList({ |
|
|
|
|
// current:this.page.currentPage, |
|
|
|
|
// size:this.page.pageSize, |
|
|
|
|
// ...this.query |
|
|
|
|
// }).then(res =>{ |
|
|
|
|
// res.data.data.records.map(item =>{ |
|
|
|
|
// item.platingId = item.platingId + '' |
|
|
|
|
// }) |
|
|
|
|
// res.data.data.records.map(item =>{ |
|
|
|
|
// getProcessAbility({ |
|
|
|
|
// supplierId:item.oemId |
|
|
|
|
// }).then(res =>{ |
|
|
|
|
// item.abilityData = res.data.data |
|
|
|
|
// }) |
|
|
|
|
// }) |
|
|
|
|
// this.data = res.data.data.records |
|
|
|
|
// this.page.total = res.data.data.total |
|
|
|
|
// this.loading = false |
|
|
|
|
// }) |
|
|
|
|
// }, |
|
|
|
|
async onLoad() { |
|
|
|
|
this.loading = true; |
|
|
|
|
getList({ |
|
|
|
|
current:this.page.currentPage, |
|
|
|
|
size:this.page.pageSize, |
|
|
|
|
...this.query |
|
|
|
|
}).then(res =>{ |
|
|
|
|
res.data.data.records.map(item =>{ |
|
|
|
|
item.platingId = item.platingId + '' |
|
|
|
|
}) |
|
|
|
|
this.data = res.data.data.records |
|
|
|
|
this.page.total = res.data.data.total |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
try { |
|
|
|
|
const res = await getList({ |
|
|
|
|
current: this.page.currentPage, |
|
|
|
|
size: this.page.pageSize, |
|
|
|
|
...this.query |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const records = res.data.data.records; |
|
|
|
|
|
|
|
|
|
// 1. 预处理 platingId 为字符串(为了匹配 select 的 value) |
|
|
|
|
records.forEach(item => { |
|
|
|
|
item.platingId = item.platingId ? String(item.platingId) : ''; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 2. 并行获取每一行的工艺能力数据 |
|
|
|
|
// 使用 Promise.all 等待所有异步请求完成 |
|
|
|
|
const abilityPromises = records.map(async (item) => { |
|
|
|
|
if (item.oemId) { |
|
|
|
|
try { |
|
|
|
|
const abilityRes = await getProcessAbility({ |
|
|
|
|
supplierId: item.oemId |
|
|
|
|
}); |
|
|
|
|
item.abilityData = abilityRes.data.data || [] |
|
|
|
|
// 确保赋值给当前 item 的引用 |
|
|
|
|
// this.$set(item, 'abilityData', abilityRes.data.data || []); |
|
|
|
|
} catch (e) { |
|
|
|
|
console.error('获取工艺能力失败', e); |
|
|
|
|
// this.$set(item, 'abilityData', []); |
|
|
|
|
item.abilityData = [] |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// this.$set(item, 'abilityData', []); |
|
|
|
|
item.abilityData = [] |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await Promise.all(abilityPromises); |
|
|
|
|
|
|
|
|
|
// 3. 所有数据准备就绪后,再赋值给 data,触发渲染 |
|
|
|
|
this.data = records; |
|
|
|
|
this.page.total = res.data.data.total; |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error(error); |
|
|
|
|
this.$message.error('加载数据失败'); |
|
|
|
|
} finally { |
|
|
|
|
this.loading = false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
|