import { Subject } from 'rxjs';
import { PickupGridViewBase } from '@/studio-core';
import EAMAssetStateService from '@/service/eamasset-state/eamasset-state-service';
import EAMAssetStateAuthService from '@/authservice/eamasset-state/eamasset-state-auth-service';
import PickupGridViewEngine from '@engine/view/pickup-grid-view-engine';
import EAMAssetStateUIService from '@/uiservice/eamasset-state/eamasset-state-ui-service';

/**
 * 资产状态选择表格视图视图基类
 *
 * @export
 * @class EAMAssetStatePickupGridViewBase
 * @extends {PickupGridViewBase}
 */
export class EAMAssetStatePickupGridViewBase extends PickupGridViewBase {
    /**
     * 视图对应应用实体名称
     *
     * @protected
     * @type {string}
     * @memberof EAMAssetStatePickupGridViewBase
     */
    protected appDeName: string = 'eamassetstate';

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

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

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

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


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

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

    /**
     * 容器模型
     *
     * @protected
     * @type {*}
     * @memberof EAMAssetStatePickupGridViewBase
     */
    protected containerModel: any = {
        view_grid: { name: 'grid', type: 'GRID' },
        view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
    };


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


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

    /**
     * 引擎初始化
     *
     * @public
     * @memberof EAMAssetStatePickupGridViewBase
     */
    public engineInit(): void {
        this.engine.init({
            view: this,
            grid: this.$refs.grid,
            searchform: this.$refs.searchform,
            keyPSDEField: 'eamassetstate',
            majorPSDEField: 'eamassetstatename',
            isLoadDefault: true,
        });
    }

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

    /**
     * grid 部件 beforeload 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof EAMAssetStatePickupGridViewBase
     */
    public grid_beforeload($event: any, $event2?: any): void {
        this.engine.onCtrlEvent('grid', 'beforeload', $event);
    }

    /**
     * grid 部件 rowdblclick 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof EAMAssetStatePickupGridViewBase
     */
    public grid_rowdblclick($event: any, $event2?: any): void {
        this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
    }

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

    /**
     * searchform 部件 save 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof EAMAssetStatePickupGridViewBase
     */
    public searchform_save($event: any, $event2?: any): void {
        this.engine.onCtrlEvent('searchform', 'save', $event);
    }

    /**
     * searchform 部件 search 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof EAMAssetStatePickupGridViewBase
     */
    public searchform_search($event: any, $event2?: any): void {
        this.engine.onCtrlEvent('searchform', 'search', $event);
    }

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



    /**
     * 是否展开搜索表单
     *
     * @protected
     * @type {boolean}
     * @memberof EAMAssetStatePickupGridViewBase
     */
    protected isExpandSearchForm: boolean = true;


}