//事项分配列表
async findSxfpList() {
try {
//获取事项分配列表
const res = await typeUtilAips.getSxfpList();
this.SxfpList = res.data.data;
console.log(this.SxfpList);
//遍历事项
for (const sx of this.sxList) {
//创建一个数组存数据
let sxfpArr=[];
//遍历事项分配列表
for (const sxfp of this.SxfpList) {
//判断事项分配表中事项Id是否与事项Id相同
if (sx.sxId == sxfp.sxfpSxid) {
//将数据存在数组
sxfpArr.push(sxfp)
}
}
//遍历完后新增一个数组列表并将数据存入
sx['sxfpArr'] = sxfpArr
}
console.log(this.sxList);
} catch (error) {
console.log(error);
}
},
JavaScript向对象中添加新的数组
最新推荐文章于 2024-04-25 00:00:00 发布