import { Subject } from 'rxjs';
import { DashboardViewBase } from '@/studio-core';
import IncidentService from '@/service/incident/incident-service';
import PortalViewEngine from '@engine/view/portal-view-engine';

/**
 * 案例数据看板视图视图基类
 *
 * @export
 * @class IncidentSummaryViewBase
 * @extends {DashboardViewBase}
 */
export class IncidentSummaryViewBase extends DashboardViewBase {

    /**
     * 实体服务对象
     *
     * @type {IncidentService}
     * @memberof IncidentSummaryViewBase
     */
    protected appEntityService: IncidentService = new IncidentService;


    /**
     * 计数器服务对象集合
     *
     * @protected
     * @type {Array<*>}
     * @memberof IncidentSummaryViewBase
     */    
    protected counterServiceArray: Array<any> = [];

    /**
     * 视图模型数据
     *
     * @protected
     * @type {*}
     * @memberof IncidentSummaryViewBase
     */
    protected model: any = {
        srfCaption: 'entities.incident.views.summaryview.caption',
        srfTitle: 'entities.incident.views.summaryview.title',
        srfSubTitle: 'entities.incident.views.summaryview.subtitle',
        dataInfo: ''
    }

    /**
     * 容器模型
     *
     * @protected
     * @type {*}
     * @memberof IncidentSummaryViewBase
     */
    protected containerModel: any = {
        view_dashboard: { name: 'dashboard', type: 'DASHBOARD' },
    };


	/**
     * 视图唯一标识
     *
     * @protected
     * @type {string}
     * @memberof ViewBase
     */
	protected viewtag: string = 'f6298e67a8fe2302b75813ca7f3ba94c';


    /**
     * 视图引擎
     *
     * @public
     * @type {Engine}
     * @memberof IncidentSummaryViewBase
     */
    public engine: PortalViewEngine = new PortalViewEngine();

    /**
     * 引擎初始化
     *
     * @public
     * @memberof IncidentSummaryViewBase
     */
    public engineInit(): void {
        this.engine.init({
            view: this,
            dashboard: this.$refs.dashboard,
            keyPSDEField: 'incident',
            majorPSDEField: 'title',
            isLoadDefault: true,
        });
    }

    /**
     * dashboard 部件 load 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof IncidentSummaryViewBase
     */
    public dashboard_load($event: any, $event2?: any): void {
        this.engine.onCtrlEvent('dashboard', 'load', $event);
    }


}