import { Subject } from 'rxjs';
import { EditViewBase } from '@/studio-core';
import LeadCompetitorService from '@/service/lead-competitor/lead-competitor-service';
import EditViewEngine from '@engine/view/edit-view-engine';

/**
 * 竞争对手潜在顾客信息视图基类
 *
 * @export
 * @class LeadCompetitorEdit_CompLeadViewBase
 * @extends {EditViewBase}
 */
export class LeadCompetitorEdit_CompLeadViewBase extends EditViewBase {
    /**
     * 视图对应应用实体名称
     *
     * @protected
     * @type {string}
     * @memberof LeadCompetitorEdit_CompLeadViewBase
     */
    protected appDeName: string = 'leadcompetitor';

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

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

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


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

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

    /**
     * 容器模型
     *
     * @protected
     * @type {*}
     * @memberof LeadCompetitorEdit_CompLeadViewBase
     */
    protected containerModel: any = {
        view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
        view_form: { name: 'form', type: 'FORM' },
    };

    /**
     * 工具栏模型
     *
     * @type {*}
     * @memberof LeadCompetitorEdit_CompLeadView
     */
    public toolBarModels: any = {
    };



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


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

    /**
     * 引擎初始化
     *
     * @public
     * @memberof LeadCompetitorEdit_CompLeadViewBase
     */
    public engineInit(): void {
        this.engine.init({
            view: this,
            form: this.$refs.form,
            p2k: '0',
            keyPSDEField: 'leadcompetitor',
            majorPSDEField: 'relationshipsname',
            isLoadDefault: true,
        });
    }

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

    /**
     * form 部件 remove 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof LeadCompetitorEdit_CompLeadViewBase
     */
    public form_remove($event: any, $event2?: any): void {
        this.engine.onCtrlEvent('form', 'remove', $event);
    }

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


}