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
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 { Db_appmenu1 } from '@widget/app/wdsqmenu-portlet/wdsqmenu-portlet';
import { ComUtil } from '@global/util/ComUtil';
import { AppEnvironment } from 'src/environments/AppEnvironment';
import {QJMobMDViewPage} from '@pages/demo/qjmob-mdview/qjmob-mdview.page';
@Component({
selector: 'ctrl-dashboard-dashboard',
templateUrl: './app-dashboard-view-db-dashboard.html',
styleUrls: ['./app-dashboard-view-db-dashboard.scss']
})
export class Dashboard implements OnInit{
/**
* 名称
*
* @type {string}
* @memberof Dashboard
*/
@Input() public name: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Dashboard
*/
@Input() public viewState: Subject<ViewState>;
/**
* 是否为内嵌视图
*
* @type {boolean}
* @memberof Dashboard
*/
@Input() public isembeddedView: boolean;
/**
* 是否为模态模式
*
* @type {boolean}
* @memberof Dashboard
*/
@Input() public isModalMode: boolean;
/**
* 当前部件激活数据
*
* @public
* @type {void}
* @memberof Dashboard
*/
public $activeData: Array<any> = [];
constructor(private $http: Http, private $notification: AppNotification,private $navCtrl:NavController,private $app:App,private $modalCtrl: ModalController) {
}
/**
* 返回
*
* @memberof Dashboard
*/
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 {};
}
/**
* 子组件
*/
@ViewChild(Db_appmenu1)
private db_appmenu1: Db_appmenu1;
/**
* 组件数组
*/
private $componentsArray:Array<any> =['db_appmenu1',];
/**
* angular 生命周期
*
* @memberof Dashboard
*/
ngOnInit(): void {
if (this.viewState) {
this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
this.$componentsArray.forEach((_name: string) => {
this.viewState.next({ tag: _name, action: action, data: data });
});
});
}
}
}