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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import ViewEngine from './view-engine';
/**
* 搜索视图引擎
*
* @export
* @class SearchViewEngine
* @extends {ViewEngine}
*/
export class SearchViewEngine extends ViewEngine {
/**
* 表单部件
*
* @protected
* @type {*}
* @memberof SearchViewEngine
*/
protected searchForm: any;
/**
* 初始化
*
* @param {*} options
* @memberof SearchViewEngine
*/
public init(options: any): void {
this.searchForm = options.searchform;
super.init(options);
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof SearchViewEngine
*/
public load(opts: any = {}): void {
super.load(opts);
if (this.getSearchForm()) {
const tag = this.getSearchForm().name;
this.setViewState2({ tag: tag, action: 'loaddraft', viewdata: this.view.viewparams });
}
}
/**
* 事件处理
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof SearchViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
super.onCtrlEvent(ctrlName, eventName, args);
if (Object.is(ctrlName, 'searchform')) {
this.searchFormEvent(eventName, args);
}
}
/**
* 搜索表单事件
*
* @param {string} eventName
* @param {*} [args={}]
* @memberof SearchViewEngine
*/
public searchFormEvent(eventName: string, args: any = {}): void {
if (Object.is(eventName, 'load')) {
this.onSearchFormLoad(args);
}
}
/**
* 搜索表单加载完成
*
* @param {*} [args={}]
* @memberof SearchViewEngine
*/
public onSearchFormLoad(args: any = {}): void {
}
/**
* 数据部件加载之前
*
* @param {*} [arg={}]
* @memberof SearchViewEngine
*/
public dataCtrlBeforeLoad(arg: any = {}): void {
if (this.view.viewparams && Object.keys(this.view.viewparams).length > 0) {
Object.assign(arg, this.view.viewparams);
}
if (this.getSearchForm()) {
Object.assign(arg, this.getSearchForm().getData());
}
if (this.view && !this.view.isExpandSearchForm) {
Object.assign(arg, { query: this.view.query });
}
}
/**
* 获取搜索表单
*
* @returns {*}
* @memberof SearchViewEngine
*/
public getSearchForm(): any {
return this.searchForm;
}
}