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
import { ViewBase } from './ViewBase';
import { Emit } from 'vue-property-decorator';
/**
* 首页视图基类
*
* @export
* @class IndexViewBase
* @extends {ViewBase}
*/
export class IndexViewBase extends ViewBase {
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof ${srfclassname('${view.name}')}Base
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 父数据对象
*
* @protected
* @type {*}
* @memberof IndexViewBase
*/
protected srfparentdata: any = {};
/**
* 顶部菜单项
*
* @protected
* @type {any[]}
* @memberof IndexViewBase
*/
protected topMenus: any[] = [];
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IndexViewBase
*/
public mounted() {
super.mounted();
this.viewState.next({ tag: "appmenu", action: "load", data: {} });
this.$viewTool.setIndexParameters([
{ pathName: "index", parameterName: "index" }
]);
}
/**
* 应用菜单项变更
*
* @protected
* @param {any[]} menus
* @memberof IndexViewBase
*/
protected appMenusChange(menus: any[]): void {
if (menus) {
const item: any = menus.find((item: any) => Object.is(item.name, 'HomeTopMenus'));
if (item && item.items) {
this.topMenus = item.items;
this.topMenus.forEach((item: any) => {
item.caption = item.text;
item.disabled = false;
item.visabled = true;
});
}
}
}
/**
* 顶部菜单项点击
*
* @protected
* @param {*} menu
* @memberof IndexViewBase
*/
protected topMenuClick(menu: any): void {
if (menu && this.$refs.appmenu) {
(this.$refs.appmenu as any).click(menu);
}
}
}