1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* AppMobPanelModel 部件模型
*
* @export
* @class AppMobPanelModel
*/
export class AppMobPanelModel {
/**
* 面板实例对象
*
* @memberof AppMobPanelModel
*/
public PanelInstance:any;
/**
* Creates an instance of AppMobPanelModel.
*
* @param {*} [opts={}]
* @memberof AppMobPanelModel
*/
constructor(opts: any) {
this.PanelInstance = opts;
}
/**
* 获取name找到对应field
*
* @returns {any[]}
* @memberof AppMobPanelModel
*/
public findField(arr:Array<any>, name:string):any {
let _result = null;
for (let i = 0; i < arr.length; i++) {
if (arr[i].name == name) return arr[i];
if (arr[i].getPSPanelItems) _result = this.findField(arr[i].getPSPanelItems, name)
if (_result != null) return _result;
}
return _result
}
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof AppMobPanelModel
*/
public getDataItems(): any[] {
let arr:any = [];
this.PanelInstance.getAllPSPanelFields.forEach((datafield:any) => {
let field:any = this.findField(this.PanelInstance.getRootPSPanelItems,datafield.id);
let obj:any = {};
obj.name = field?.name.toLowerCase();
obj.prop = field?.viewFieldName.toLowerCase();
arr.push(obj);
});
return arr
}
}