<script lang='tsx'>
import { Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { IndexViewBase } from '@/crm-core';

/**
 * EHR—假勤管理基类
 *
 * @export
 * @class IndexBase
 * @extends {IndexViewBase}
 */
export default class IndexBase extends IndexViewBase {

	/**
	 * 视图标识
	 *
	 * @type {string}
     * @protected
	 * @memberof IndexBase
	 */
	protected viewtag: string = '7e2f1c1534fff59929aa73068bea0fbc';

    /**
     * 视图模型数据
     *
     * @type {*}
     * @memberof IndexBase
     */
    public model: any = {
        srfTitle: 'EHR—假勤管理',
        srfCaption: 'app.views.index.caption',
        srfSubCaption: '',
        dataInfo: ''
    }

    /**
     * 抽屉状态
     *
     * @type {boolean}
     * @memberof IndexBase
     */
    public contextMenuDragVisiable: boolean = false;

    /**
     * 是否支持应用切换
     *
     * @type {boolean}
     * @memberof IndexBase
     */
    public isEnableAppSwitch: boolean = false;

    /**
     * 容器模型
     *
     * @type {*}
     * @memberof IndexBase
     */
    public containerModel: any = {
        view_appmenu: { name: 'appmenu', type: 'APPMENU' },
    };


    public render(): any {
        return (<div class="app-container">
            <app-layout viewName="index" viewTitle="EHR—假勤管理" className={{ index_view: true }}>
        <template slot="headerLeft">
          <div class="app-header-left">
            {this.isEnableAppSwitch?<span class="ibiz-menu-icon" onClick={()=>{this.contextMenuDragVisiable=!this.contextMenuDragVisiable}}><i class="ivu-icon ivu-icon-md-menu"></i></span>:<span></span>} 
            <img class="logo" src="./assets/img/logo.png" />
            <div class="app-name">{this.$t(this.model.srfCaption)}</div>
          </div>
        </template>
        <template slot="headerRight">
          <div class="app-header-right">
            <app-top-menus />
          </div>
        </template>
        <template slot="content">
          <div class="crm-app-content">
            <div class="inedx-app-menus">
          <view_appmenu
            viewState={this.viewState}
            viewparams={this.viewparams}
            context={this.context}
            showBusyIndicator={true}
            on-menus-change={(menus: any[]) => this.appMenusChange(menus)}
            name="appmenu"
            ref="appmenu"
          />

              {this.isEnableAppSwitch?<context-menu-drag contextMenuDragVisiable={this.contextMenuDragVisiable}></context-menu-drag>:<div></div>}
            </div>
            <div class="content" style="width: calc(100% - 240px)"  on-click={() =>{this.contextMenuDragVisiable=false}}>
              <router-view></router-view>
            </div>
          </div>
        </template>
      </app-layout>

        </div>);
    }
}
</script>

<style lang='less'>
@import './index.less';
</style>