import { Subject } from 'rxjs';
import { TreeExpViewBase } from '@/studio-core';
import EAMAssetService from '@/service/eamasset/eamasset-service';
import EAMAssetAuthService from '@/authservice/eamasset/eamasset-auth-service';
import TreeExpViewEngine from '@engine/view/tree-exp-view-engine';
import EAMAssetUIService from '@/uiservice/eamasset/eamasset-ui-service';

/**
 * 资产信息视图基类
 *
 * @export
 * @class EAMAssetTreeExpViewBase
 * @extends {TreeExpViewBase}
 */
export class EAMAssetTreeExpViewBase extends TreeExpViewBase {
    /**
     * 视图对应应用实体名称
     *
     * @protected
     * @type {string}
     * @memberof EAMAssetTreeExpViewBase
     */
    protected appDeName: string = 'eamasset';

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

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

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

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


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

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

    /**
     * 容器模型
     *
     * @protected
     * @type {*}
     * @memberof EAMAssetTreeExpViewBase
     */
    protected containerModel: any = {
        view_treeexpbar: { name: 'treeexpbar', type: 'TREEEXPBAR' },
    };


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


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

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

    /**
     * treeexpbar 部件 selectionchange 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof EAMAssetTreeExpViewBase
     */
    public treeexpbar_selectionchange($event: any, $event2?: any): void {
        this.engine.onCtrlEvent('treeexpbar', 'selectionchange', $event);
    }

    /**
     * treeexpbar 部件 activated 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof EAMAssetTreeExpViewBase
     */
    public treeexpbar_activated($event: any, $event2?: any): void {
        this.engine.onCtrlEvent('treeexpbar', 'activated', $event);
    }

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

    /**
     * 打开新建数据视图
     *
     * @param {any[]} args
     * @param {*} [params]
     * @param {*} [fullargs]
     * @param {*} [$event]
     * @param {*} [xData]
     * @memberof EAMAssetTreeExpView
     */
    public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
        let localContext:any = null;
        let localViewParam:any =null;
    this.$Notice.warning({ title: '错误', desc: '未指定关系视图' });
    }


    /**
     * 打开编辑数据视图
     *
     * @param {any[]} args
     * @param {*} [params]
     * @param {*} [fullargs]
     * @param {*} [$event]
     * @param {*} [xData]
     * @memberof EAMAssetTreeExpView
     */
    public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
    this.$Notice.warning({ title: '错误', desc: '未指定关系视图' });
    }



    /**
     * 视图唯一标识
     *
     * @type {string}
     * @memberof EAMAssetTreeExpView
     */
    public viewUID: string = 'asset-eamasset-tree-exp-view';


}