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 }); }); }); } } }