|
@@ -384,7 +384,6 @@ const solution = {
|
384
|
384
|
tree[i] = {
|
385
|
385
|
value: v.id,
|
386
|
386
|
text: v.typeName,
|
387
|
|
- children: []
|
388
|
387
|
};
|
389
|
388
|
} else {
|
390
|
389
|
tree.forEach((val, idx) => {
|
|
@@ -393,20 +392,32 @@ const solution = {
|
393
|
392
|
!v.parent.parent &&
|
394
|
393
|
val.text == v.parent.typeName
|
395
|
394
|
) {
|
396
|
|
- tree[idx].children.push({
|
397
|
|
- value: v.id,
|
398
|
|
- text: v.typeName,
|
399
|
|
- children: []
|
400
|
|
- });
|
|
395
|
+ if(tree[idx].children){
|
|
396
|
+ tree[idx].children.push({
|
|
397
|
+ value: v.id,
|
|
398
|
+ text: v.typeName,
|
|
399
|
+ });
|
|
400
|
+ }else{
|
|
401
|
+ tree[idx].children = [];
|
|
402
|
+ }
|
401
|
403
|
} else if (v.parent.parent) {
|
402
|
|
- tree[idx].children.forEach((value, index) => {
|
403
|
|
- if (value.text == v.parent.typeName) {
|
404
|
|
- tree[idx].children[index].children.push({
|
405
|
|
- value: v.id,
|
406
|
|
- text: v.typeName
|
407
|
|
- });
|
408
|
|
- }
|
409
|
|
- });
|
|
404
|
+ if(tree[idx].children){
|
|
405
|
+ tree[idx].children.forEach((value, index) => {
|
|
406
|
+ if (value.text == v.parent.typeName) {
|
|
407
|
+ if(tree[idx].children[index].children){
|
|
408
|
+ tree[idx].children[index].children.push({
|
|
409
|
+ value: v.id,
|
|
410
|
+ text: v.typeName
|
|
411
|
+ });
|
|
412
|
+ }else{
|
|
413
|
+ tree[idx].children[index].children = [];
|
|
414
|
+ }
|
|
415
|
+ }
|
|
416
|
+ });
|
|
417
|
+ }else{
|
|
418
|
+ tree[idx].children = [];
|
|
419
|
+ }
|
|
420
|
+
|
410
|
421
|
}
|
411
|
422
|
});
|
412
|
423
|
}
|
|
@@ -1492,6 +1503,26 @@ export default {
|
1492
|
1503
|
}
|
1493
|
1504
|
});
|
1494
|
1505
|
|
|
1506
|
+ if(cateGrand && cateFa && cateSelf){
|
|
1507
|
+ if(selectedVal.length < 3){
|
|
1508
|
+ selectedVal = [];
|
|
1509
|
+ selectedIndex = [];
|
|
1510
|
+ selectedTxt = [];
|
|
1511
|
+ }
|
|
1512
|
+ } else if(cateGrand && cateFa && !cateSelf){
|
|
1513
|
+ if(selectedVal.length < 2){
|
|
1514
|
+ selectedVal = [];
|
|
1515
|
+ selectedIndex = [];
|
|
1516
|
+ selectedTxt = [];
|
|
1517
|
+ }
|
|
1518
|
+ } else if(cateGrand && !cateFa && !cateSelf){
|
|
1519
|
+ if(selectedVal.length < 1){
|
|
1520
|
+ selectedVal = [];
|
|
1521
|
+ selectedIndex = [];
|
|
1522
|
+ selectedTxt = [];
|
|
1523
|
+ }
|
|
1524
|
+ }
|
|
1525
|
+
|
1495
|
1526
|
console.log(selectedVal, selectedIndex, selectedTxt);
|
1496
|
1527
|
// console.log(i1,i2,i3);
|
1497
|
1528
|
// var cateData=[i1,i2,i3]
|