<template>
<studio-view-style2 viewName="ibizlistinfo" viewTitle="市场营销列表" class='detabexpview ibiz-list-info'>
    <template slot='title'>
    <span class='caption-info'>{{$t(model.srfTitle)}}</span>
    </template>
    <view_tabexppanel 
        :viewState="viewState"  
        :viewparams="viewparams" 
        :context="context" 
        name="tabexppanel"  
        ref='tabexppanel' 
        @closeview="closeView($event)">
    </view_tabexppanel>
</studio-view-style2>
</template>

<script lang='tsx'>
import { Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { UIActionTool, Util } from '@/utils';
import { VueLifeCycleProcessing, TabExpViewBase } from '@/studio-core';
import IBizListService from '@/service/ibiz-list/ibiz-list-service';

import TabExpViewEngine from '@engine/view/tab-exp-view-engine';


/**
 * 市场营销列表视图基类
 *
 * @export
 * @class IBizListInfoBase
 * @extends {TabExpViewBase}
 */
@Component({})
@VueLifeCycleProcessing()
export default class IBizListInfoBase extends TabExpViewBase {

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


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

	/**
	 * 自定义视图导航上下文集合
	 *
     * @protected
	 * @type {*}
	 * @memberof IBizListInfoBase
	 */
    protected customViewNavContexts: any = {
    };

	/**
	 * 自定义视图导航参数集合
	 *
     * @protected
	 * @type {*}
	 * @memberof IBizListInfoBase
	 */
    protected customViewParams: any = {
    };

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

    /**
     * 容器模型
     *
     * @protected
     * @type {*}
     * @memberof IBizListInfoBase
     */
    protected containerModel: any = {
        view_tabexppanel: { name: 'tabexppanel', type: 'TABEXPPANEL' },
    };


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

    /**
     * 引擎初始化
     *
     * @public
     * @memberof IBizListInfoBase
     */
    public engineInit(): void {
        this.engine.init({
            view: this,
            keyPSDEField: 'ibizlist',
            majorPSDEField: 'listname',
            isLoadDefault: true,
        });
    }



    /**
     * 加载模型
     *
     * @protected
     * @memberof IBizListInfoBase
     */
    protected async loadModel(): Promise<any> {
        if(this.context.ibizlist){
            this.appEntityService.getDataInfo(JSON.parse(JSON.stringify(this.context)),{},false).then((response:any) =>{
                if (!response || response.status !== 200) {
                    return;
                }
                const { data: _data } = response;
                if (_data.listname) {
                    Object.assign(this.model, { dataInfo: _data.listname });
                    if (this.$tabPageExp) {
                        this.$tabPageExp.setCurPageCaption(this.model.srfTitle, this.model.srfTitle, this.model.dataInfo);
                    }
                    if(this.$route){
                        this.$route.meta.info = this.model.dataInfo;
                    }
                    Object.assign(this.model, { srfTitle: `${this.$t(this.model.srfTitle)} - ${this.model.dataInfo}` });
                }
            })
        }
    }


}
</script>

<style lang='less'>
@import './ibiz-list-info.less';
</style>