import { Subject } from 'rxjs';
import { PickupGridViewBase } from '@/studio-core';
import EAMApplyTypeService from '@/service/eamapply-type/eamapply-type-service';
import EAMApplyTypeAuthService from '@/authservice/eamapply-type/eamapply-type-auth-service';
import PickupGridViewEngine from '@engine/view/pickup-grid-view-engine';
import EAMApplyTypeUIService from '@/uiservice/eamapply-type/eamapply-type-ui-service';

/**
 * 维护申请类型选择表格视图视图基类
 *
 * @export
 * @class EAMApplyTypePickupGridViewBase
 * @extends {PickupGridViewBase}
 */
export class EAMApplyTypePickupGridViewBase extends PickupGridViewBase {
    /**
     * 视图对应应用实体名称
     *
     * @protected
     * @type {string}
     * @memberof EAMApplyTypePickupGridViewBase
     */
    protected appDeName: string = 'eamapplytype';

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

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

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

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


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

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

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


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


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

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

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

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

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

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

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

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

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



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


}