selectedRows[{"Status":"备货撤销","ProName":"铜板标签","PlanDate":"2022-02-10","PlanId":"CGDD-220210002","keyid":1,"Quantity":25,"NotificationTime":null,"DeliveryDate":"","ProPlanId":"","TimeStamp":null,"PushStatus":null,"OrgId":"1 ","ProStyle":"","ProType":"100*140","ReceiptStatus":null,"Id":1},{"Status":"备货撤销","ProName":"铜板标签","PlanDate":"2022-02-11","PlanId":"CGDD-220211002","keyid":2,"Quantity":33,"NotificationTime":null,"DeliveryDate":"","ProPlanId":"","TimeStamp":null,"PushStatus":null,"OrgId":"1 ","ProStyle":"","ProType":"100*140","ReceiptStatus":null,"Id":1}]那这样多数组的我不明确里面到底是几个PlanId,我需要都取出来
时间: 2023-07-24 20:14:51 浏览: 69
如果你不确定 `selectedRows` 数组中有多少个元素,但想要获取所有的 `PlanId` 值,你可以使用循环来遍历 `selectedRows` 数组,并将每个元素的 `PlanId` 值存储到一个新的数组中。以下是一个示例代码:
```javascript
const selectedRows = [
{"Status":"备货撤销","ProName":"铜板标签","PlanDate":"2022-02-10","PlanId":"CGDD-220210002","keyid":1,"Quantity":25,"NotificationTime":null,"DeliveryDate":"","ProPlanId":"","TimeStamp":null,"PushStatus":null,"OrgId":"1 ","ProStyle":"","ProType":"100*140","ReceiptStatus":null,"Id":1},
{"Status":"备货撤销","ProName":"铜板标签","PlanDate":"2022-02-11","PlanId":"CGDD-220211002","keyid":2,"Quantity":33,"NotificationTime":null,"DeliveryDate":"","ProPlanId":"","TimeStamp":null,"PushStatus":null,"OrgId":"1 ","ProStyle":"","ProType":"100*140","ReceiptStatus":null,"Id":1}
];
const planIds = selectedRows.map(row => row.PlanId);
console.log(planIds); // 打印所有的 PlanId 值
```
在上述代码中,我们使用 `map` 方法遍历 `selectedRows` 数组,并提取每个元素的 `PlanId` 值,将其存储到 `planIds` 数组中。最后,我们打印出 `planIds` 数组,其中包含了所有的 `PlanId` 值。
希望这能解决你的问题!
阅读全文