import { Subject } from 'rxjs';
import { DashboardViewBase } from '@/studio-core';
import EAMAssetService from '@/service/eamasset/eamasset-service';
import EAMAssetAuthService from '@/authservice/eamasset/eamasset-auth-service';
import PortalViewEngine from '@engine/view/portal-view-engine';
import EAMAssetUIService from '@/uiservice/eamasset/eamasset-ui-service';

/**
 * 资产数据看板视图视图基类
 *
 * @export
 * @class EAMAssetSummaryViewBase
 * @extends {DashboardViewBase}
 */
export class EAMAssetSummaryViewBase extends DashboardViewBase {
    /**
     * 视图对应应用实体名称
     *
     * @protected
     * @type {string}
     * @memberof EAMAssetSummaryViewBase
     */
    protected appDeName: string = 'eamasset';

    /**
     * 应用实体主键
     *
     * @protected
     * @type {string}
     * @memberof EAMAssetSummaryViewBase
     */
    protected appDeKey: string = 'assetid';

    /**
     * 应用实体主信息
     *
     * @protected
     * @type {string}
     * @memberof EAMAssetSummaryViewBase
     */
    protected appDeMajor: string = 'assetname';

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

    /**
     * 实体权限服务对象
     *
     * @type EAMAssetUIService
     * @memberof EAMAssetSummaryViewBase
     */
    public appUIService: EAMAssetUIService = new EAMAssetUIService(this.$store);


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

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

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


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


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

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

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


}