the first two arrays are like this. The b array adds a field to the an array
a = [{
label: "",
organizeId: "1001"
}, {
label: "",
organizeId: "1002"
}, {
label: "",
organizeId: "1003"
}, {
label: "",
organizeId: "1004"
}, {
label: "",
organizeId: "1005"
}]
b = [{
children: [{
label: "",
organizeId: "1001",
subValue: "100"
}, {
label: "",
organizeId: "1002",
subValue: "200"
}, {
label: "",
organizeId: "1003",
subValue: "1000"
}, {
label: "",
organizeId: "1004",
subValue: "800"
}, {
label: "",
organizeId: "1005",
subValue: "600"
}]
}, {
children: [{
label: "",
organizeId: "1001",
subValue: "100"
}, {
label: "",
organizeId: "1002",
subValue: "200"
}, {
label: "",
organizeId: "1003",
subValue: "1000"
}, {
label: "",
organizeId: "1004",
subValue: "800"
}, {
label: "",
organizeId: "1005",
subValue: "600"
}]
}]
when the data of a changes
a = [{
label: "",
organizeId: "1001"
}, {
label: "",
organizeId: "1002"
}, {
label: "",
organizeId: "1006"
}]
I want to get such an array. Some of the previous data remain the same, for example, on Saturday, we add and set the subValue value to 0, and remove it. For example, on Wednesday, Thursday and Friday, the children in the new array is also removed
. b = [{
children: [{
label: "",
organizeId: "1001",
subValue: "100"
}, {
label: "",
organizeId: "1002",
subValue: "200"
}, {
label: "",
organizeId: "1006",
subValue: "0"
}]
}, {
children: [{
label: "",
organizeId: "1001",
subValue: "100"
}, {
label: "",
organizeId: "1002",
subValue: "200"
}, {
label: "",
organizeId: "1006",
subValue: "0"
}]
}]