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

/**
 * 目标数据看板视图视图基类
 *
 * @export
 * @class GoalSummaryViewBase
 * @extends {DashboardViewBase}
 */
export class GoalSummaryViewBase extends DashboardViewBase {

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


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

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

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


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


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

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

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


}