problem description
1. Several departmental UID strings have been obtained from the backend, separated by "," commas
2. At the same time, the tree data is obtained from the backend (see code for details)
requirements: store departmental UID matching UID and its label, in tree data as an array of objects for use in the select drop-down box
the environmental background of the problems and what methods you have tried
there is an error in the traversal method, and the data read is incomplete
related codes
/ / Please paste the code text below (do not replace the code with pictures)
1 department UID string
str: "ADMIN,27cfb184cba7497f8bc34af8d228b988,712803a9c33e4110961ed40a113db874,0747714bf99b4cf2919ee73eb4ac7662"
2 Tree data (id and text > in read data are matched and stored as label:value), as follows:
-Tree data begin
[
{
"id": "ADMIN",
"checked": false,
"text": "",
"leaf": true,
"priority": -1,
"children": []},{"id": "27cfb184cba7497f8bc34af8d228b988",
"checked": false,
"text": "",
"leaf": false,
"priority": 123,
"children": [
{
"id": "898f63e4fc144dc19abd973a403645e6",
"checked": false,
"text": "",
"leaf": true,
"priority": 123,
"children": []
},
{
"id": "aa5f74be66f04e62bbcea34717133624",
"checked": false,
"text": "",
"leaf": true,
"priority": 123,
"children": []
},
{
"id": "bada5b2760ab4e879f9d7200536917b6",
"checked": false,
"text": "",
"leaf": true,
"priority": 123,
"children": []
},
{
"id": "cb781db8f4e84ad7b0570eca9960a954",
"checked": false,
"text": "",
"leaf": true,
"priority": 1,
"children": []}]},{"id": "f3cdf3e6949b49c19b624eee6a08f0e8",
"checked": false,
"text": "",
"leaf": false,
"priority": 123,
"children": [
{
"id": "0747714bf99b4cf2919ee73eb4ac7662",
"checked": false,
"text": "",
"leaf": true,
"priority": 123,
"children": []
},
{
"id": "712803a9c33e4110961ed40a113db874",
"checked": false,
"text": "",
"leaf": true,
"priority": 123,
"children": []
}
]}]
-Tree data end
what result do you expect? What is the error message actually seen?
I want to get this data format:
BGuidArr: [
{
label: "",
value: "ADMIN"
},
{
lable: "",
value: "27cfb184cba7497f8bc34af8d228b988"
},
{
lable: "",
value: "712803a9c33e4110961ed40a113db874"
},
{
lable: "",
value: "0747714bf99b4cf2919ee73eb4ac7662"
}
],