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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import { Component, OnInit, Input,Output,EventEmitter,ViewContainerRef, ViewChild } from '@angular/core';
import { Subject } from 'rxjs';
import { Http } from '@global/service/Http';
import { AppNotification } from '@global/service/Notification';
import { NavController, ModalController } from '@ionic/angular';
import { App } from '@global/service/App';
import { ComUtil } from '@global/util/ComUtil';
import { AppEnvironment } from 'src/environments/AppEnvironment';
@Component({
selector: 'ctrl-app-index-view-appmenu',
templateUrl: './app-index-view-appmenu.html',
styleUrls: ['./app-index-view-appmenu.scss'],
})
export class AppMenu implements OnInit {
/**
* 名称
*
* @type {string}
* @memberof AppMenu
*/
@Input() public name: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof AppMenu
*/
@Input() public viewState: Subject<ViewState>;
/**
* 是否为内嵌视图
*
* @type {boolean}
* @memberof AppMenu
*/
@Input() public isembeddedView: boolean;
/**
* 是否为模态模式
*
* @type {boolean}
* @memberof AppMenu
*/
@Input() public isModalMode: boolean;
/**
* 当前部件激活数据
*
* @public
* @type {void}
* @memberof AppMenu
*/
public $activeData: Array<any> = [];
constructor(private $http: Http, private $notification: AppNotification,private $navCtrl:NavController,private $app:App,private $modalCtrl: ModalController) {
}
/**
* 返回
*
* @memberof AppMenu
*/
public backView() {
if (this.isModalMode) {
let res: any;
if (this.$activeData && this.$activeData.length > 0) {
res = { ret: 'OK', result: this.$activeData };
} else {
res = { ret: 'NO', result: [] };
}
this.$modalCtrl.dismiss(res, 'close');
} else {
this.$navCtrl.back();
}
}
public getDatas(): any[] {
return [];
}
public getData(): any {
return null;
}
/**
* api地址
*
* @private
* @type {string}
* @memberof AppMenu
*/
private url: string = 'mob/ctrl/appindexviewappmenu';
/**
* 菜单数据
*
* @private
* @type {string}
* @memberof AppMenu
*/
private $items:Array<any>;
ngOnInit() {
if (this.viewState) {
this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
this.load(data);
});
}
}
/**
* 加载菜单
*
* @param {*} data
* @memberof AppMenu
*/
public load(data:any) {
this.$http.get(this.url + '/get').then((response: any) => {
if (response) {
this.$items = response.data.items;
}
}).catch((error: any) => {
this.$notification.error(error.error.message);
});
}
/**
* 菜单点击事件
*
* @param {*} data
* @memberof AppMenu
*/
public menuClick($event){
}
/**
* 打开功能页
*
* @param {*} data
* @memberof AppMenu
*/
public openAppFuncPickupView($event){
}
}