| 87 | isTree: true, |
| 88 | } |
| 89 | function recursion(_arr: any[]) { |
| 90 | let arr: any[] = []; |
| 91 | for (let i in _arr) { |
| 92 | let item = _arr[i]; |
| 93 | let obj: any = { |
| 94 | id: item[props.id], |
| 95 | label: item[props.label], |
| 96 | value: item[props.value], |
| 97 | children: [], |
| 98 | meta: item |
| 99 | } |
| 100 | if (item[props.children] && props.isTree) { |
| 101 | obj[props.children] = recursion(item[props.children]); |
| 102 | } |
| 103 | arr.push(obj) |
| 104 | } |
| 105 | return arr; |
| 106 | } |
| 107 | const options = params.recursion ? params.recursion(res.data) : recursion(res.data) |
| 108 | find.options = options |
| 109 | // eslint-disable-line |