|
@@ -288,7 +288,52 @@ export default {
|
|
|
"sa_brandid":this.sa_brandid !== '' ? this.sa_brandid : 0
|
|
|
}
|
|
|
})
|
|
|
- this.options.itemclass = res.data[0].ttemclass
|
|
|
+ let arr = []
|
|
|
+ function converTree(node) {
|
|
|
+ var elNode = {
|
|
|
+ isdeep:node["isdeep"],
|
|
|
+ ishide:node["ishide"],
|
|
|
+ istool:node["istool"],
|
|
|
+ itemclassfullname:node["itemclassfullname"],
|
|
|
+ itemclassfullnum:node["itemclassfullnum"],
|
|
|
+ itemclassid:node["itemclassid"],
|
|
|
+ itemclassname:node["itemclassname"],
|
|
|
+ itemclassnum:node["itemclassnum"],
|
|
|
+ num:node["num"],
|
|
|
+ parentid:node["parentid"],
|
|
|
+ rowindex:node["rowindex"],
|
|
|
+ subdep:[]
|
|
|
+ }
|
|
|
+ if (node.subdep.length > 0) {
|
|
|
+ // 如果存在子节点
|
|
|
+ for (var index = 0; index < node.subdep.length; index++) {
|
|
|
+ // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
|
|
|
+ elNode.subdep.push(converTree(node.subdep[index]));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ elNode = {
|
|
|
+ isdeep:node["isdeep"],
|
|
|
+ ishide:node["ishide"],
|
|
|
+ istool:node["istool"],
|
|
|
+ itemclassfullname:node["itemclassfullname"],
|
|
|
+ itemclassfullnum:node["itemclassfullnum"],
|
|
|
+ itemclassid:node["itemclassid"],
|
|
|
+ itemclassname:node["itemclassname"],
|
|
|
+ itemclassnum:node["itemclassnum"],
|
|
|
+ num:node["num"],
|
|
|
+ parentid:node["parentid"],
|
|
|
+ rowindex:node["rowindex"],
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return elNode;
|
|
|
+ }
|
|
|
+ // this.options.itemclass = arr
|
|
|
+ res.data[0].ttemclass.forEach(e=>{
|
|
|
+ arr.push(converTree(e))
|
|
|
+ });
|
|
|
+
|
|
|
+ this.options.itemclass = arr
|
|
|
+ return arr
|
|
|
|
|
|
},
|
|
|
classChange(){
|