@@ -5,34 +5,39 @@ export function traverseClassification2Arr(data: any[]) {
5
5
let classifications = [ ] as IClassification [ ] ;
6
6
7
7
data . forEach ( ( e : any ) => {
8
+ let attribute = e . attribute || e ;
8
9
let classificationId = e . id + '' ;
10
+
9
11
let classification : IClassification = {
10
12
id : classificationId ,
11
13
name : e . name ,
12
14
label : e . name ,
13
15
attrs : [ ] ,
14
16
} ;
15
- let options = e . options || [ ] ;
17
+ let options = attribute . options || [ ] ;
18
+ if ( e . inputType ) {
19
+ attribute . type = e . inputType ;
20
+ }
16
21
let classificationAttr : IClassificationAttr = {
17
- id : e . id ,
18
- key : e . name ,
22
+ id : attribute . id ,
23
+ key : attribute . name ,
19
24
classificationId,
20
25
parent : '' ,
21
26
parentValue : '' ,
22
27
parentAttr : e . name ,
23
- type : e . inputType ,
24
- name : e . name ,
25
- label : e . name ,
26
- value : e . inputType === AttrType . MULTI_SELECTION ? [ ] : '' ,
27
- required : e . isRequired ,
28
+ type : attribute . type ,
29
+ name : attribute . name ,
30
+ label : attribute . name ,
31
+ value : attribute . type === AttrType . MULTI_SELECTION ? [ ] : '' ,
32
+ required : attribute . required ,
28
33
options : options . map ( ( e : any ) => {
29
34
return { value : e . name , label : e . name } ;
30
35
} ) ,
31
36
} ;
32
37
33
38
classification . attrs . push ( classificationAttr ) ;
34
39
options . forEach ( ( option : any ) => {
35
- traverseOption ( classification , option , classificationAttr . id , e . name ) ;
40
+ traverseOption ( classification , option , classificationAttr . id , attribute . name ) ;
36
41
} ) ;
37
42
classifications . push ( classification ) ;
38
43
} ) ;
@@ -50,7 +55,7 @@ export function traverseClassification2Arr(data: any[]) {
50
55
option . attributes . forEach ( ( attr : any ) => {
51
56
let name = attr . name ;
52
57
let classificationAttr : IClassificationAttr = {
53
- id : attr . id || attr . uuid ,
58
+ id : attr . id ,
54
59
key : `${ parent } [${ option . name } ]-${ name } ` ,
55
60
classificationId : classification . id ,
56
61
parent,
@@ -72,6 +77,7 @@ export function traverseClassification2Arr(data: any[]) {
72
77
} ) ;
73
78
}
74
79
}
80
+
75
81
export function traverseClass2Arr ( data : any ) {
76
82
let classTypes = [ ] as IClassType [ ] ;
77
83
data . forEach ( ( config : any ) => {
0 commit comments