
<template>
  <app-layout viewName="emitempusetabexpview" viewTitle="领料单分页导航视图" :isShowCaptionBar="false" :isShowToolbar="false" :className="{ 'view-container': true, 'default-mode-view': true, 'detabexpview': true, 'emitem-puse-tab-exp-view': true }" layoutMode="VIEW" :isShowUserInfo="isDefaultView()" :openMode="openMode" @close-view="closeView($event)">
    <template slot="headerLeft">
      <div class="view-header-left">

        <div class="view-caption" v-if="isDefaultView()">{{$t(model.srfCaption)}}</div>
        <modal-breadcrumb v-if="isModalView()"/>
      </div>
    </template>
    <template slot="content">
      <div class="view-content-wrapper">
        <view_tabexppanel 
    :viewState="viewState"  
    :viewparams="viewparams" 
    :context="context" 
    name="tabexppanel"  
    ref='tabexppanel' 
    @closeview="closeView($event)">
</view_tabexppanel>

      </div>
    </template>
  </app-layout>

</template>

<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { UIActionTool, Util } from '@/utils';
import { VueLifeCycleProcessing, TabExpViewBase } from '@/crm-core';
import EMItemPUseService from '@/service/emitem-puse/emitem-puse-service';

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


/**
 * 领料单分页导航视图基类
 *
 * @export
 * @class EMItemPUseTabExpViewBase
 * @extends {TabExpViewBase}
 */
@Component({})
@VueLifeCycleProcessing
export default class EMItemPUseTabExpViewBase extends TabExpViewBase {

    /**
     * 实体服务对象
     *
     * @type {EMItemPUseService}
     * @memberof EMItemPUseTabExpViewBase
     */
    public appEntityService: EMItemPUseService = new EMItemPUseService;


    /**
     * 计数器服务对象集合
     *
     * @type {Array<*>}
     * @memberof EMItemPUseTabExpViewBase
     */    
    public counterServiceArray:Array<any> = [];
    
    /**
     * 数据变化
     *
     * @param {*} val
     * @returns {*}
     * @memberof EMItemPUseTabExpViewBase
     */
    @Emit() 
    public viewDatasChange(val: any):any {
        return val;
    }

	/**
	 * 视图标识
	 *
	 * @type {string}
	 * @memberof EMItemPUseTabExpViewBase
	 */
	public viewtag: string = 'd967f62616c3b2b1aa01832376d2c871';

    /**
     * 父数据对象
     *
     * @protected
     * @type {*}
     * @memberof EMItemPUseTabExpViewBase
     */
    protected srfparentdata: any = {};

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

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

    /**
     * 视图模型数据
     *
     * @type {*}
     * @memberof EMItemPUseTabExpViewBase
     */
    public model: any = {
        srfCaption: 'entities.emitempuse.views.tabexpview.caption',
        srfTitle: 'entities.emitempuse.views.tabexpview.title',
        srfSubTitle: 'entities.emitempuse.views.tabexpview.subtitle',
        dataInfo: ''
    }

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

    /**
     * 视图状态订阅对象
     *
     * @public
     * @type {Subject<{action: string, data: any}>}
     * @memberof EMItemPUseTabExpViewBase
     */
    public viewState: Subject<ViewState> = new Subject();


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

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

    




    /**
     * 销毁视图回调
     *
     * @memberof EMItemPUseTabExpViewBase
     */
    public destroyed(){
        if(this.viewDefaultUsage){
            let localStoreLength = Object.keys(localStorage);
            if(localStoreLength.length > 0){
                localStoreLength.forEach((item:string) =>{
                if(item.startsWith(this.context.srfsessionid)){
                    localStorage.removeItem(item);
                }
                })
            }
        }
    }

}
</script>

<style lang='less'>
@import './emitem-puse-tab-exp-view.less';
</style>