index-base.vue 39.4 KB
Newer Older
1
<template>
2
    <div class="app-view-layout app-view-layout__appindexview index" v-loading="isLayoutLoadding" :style="{height: '100%', width: '100%','display': 'flex', 'flex-direction': 'column'}">
3
        <div v-show="!isLayoutLoadding" :style="{height: '100%', width: '100%'}">
4 5 6 7 8 9 10 11
    <app-scroll-container name="container_scroll1" :layoutModelDetails="layoutModelDetails">
        <template #container_scroll_main1>
    <app-scroll-container name="container_scroll_main1" :layoutModelDetails="layoutModelDetails">
        <template #container_scroll2>
    <app-scroll-container name="container_scroll2" :layoutModelDetails="layoutModelDetails">
        <template #container_scroll_main2>
    <app-scroll-container name="container_scroll_main2" :layoutModelDetails="layoutModelDetails">
        <template #nav_pos1>
12
        <app-nav-pos name="nav_pos1" :layoutModelDetails="layoutModelDetails" :navData="layoutModelDetails['nav_pos1'].navData"/>
13 14 15 16 17 18
        </template>
    </app-scroll-container>
        </template>
        <template #container_scroll_header2>
    <app-scroll-container name="container_scroll_header2" :layoutModelDetails="layoutModelDetails">
        <template #nav_tabs2>
19
        <app-index-nav-tabs name="nav_tabs2" :layoutModelDetails="layoutModelDetails" />
20 21 22 23 24 25 26 27 28 29
        </template>
    </app-scroll-container>
        </template>
    </app-scroll-container>
        </template>
    </app-scroll-container>
        </template>
        <template #container_scroll_left1>
    <app-scroll-container name="container_scroll_left1" :layoutModelDetails="layoutModelDetails">
        <template #appmenu>
30 31
        <app-ctrl-pos name="appmenu" :layoutModelDetails="layoutModelDetails">
        <view_appmenu 
32 33
    :viewState="viewState"  
    :viewparams="viewparams" 
34
    :context="context"
35
    :pViewCtx="viewCtx"
36 37 38 39 40 41 42 43 44 45 46 47 48
    :showBusyIndicator="true"  
    v-model="collapseChange"  
    :mode="mode"
    :navModel="navModel"
    viewtag="index"
    :selectTheme="selectTheme"  
    :isDefaultPage="isDefaultPage"  
    :isBlankMode="isBlankMode"
    :defPSAppView="defPSAppView" 
    name="appmenu"  
    ref='appmenu' 
    @closeview="closeView($event)">
</view_appmenu>
49
        </app-ctrl-pos>
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
        </template>
    </app-scroll-container>
        </template>
        <template #container_scroll_header1>
    <app-scroll-container name="container_scroll_header1" :layoutModelDetails="layoutModelDetails">
        <template #container_grid1>
    <app-simpleflex-container name="container_grid1" :layoutModelDetails="layoutModelDetails">
        <template #container1>
    <app-simpleflex-container name="container1" :layoutModelDetails="layoutModelDetails">
        <template #app_apptitle>
        <app-preset-title name="app_apptitle" :layoutModelDetails="layoutModelDetails"/>
        </template>
    </app-simpleflex-container>
        </template>
        <template #container2>
    <app-simpleflex-container name="container2" :layoutModelDetails="layoutModelDetails">
        <template #nav_breadcrumb1>
67
        <app-index-nav-breadcrumb name="nav_breadcrumb1" :layoutModelDetails="layoutModelDetails" indexViewTag="index" />
68 69 70 71 72 73
        </template>
    </app-simpleflex-container>
        </template>
        <template #container3>
    <app-simpleflex-container name="container3" :layoutModelDetails="layoutModelDetails">
        <template #auth_userinfo1>
74
        <app-index-user-info name="auth_userinfo1" :layoutModelDetails="layoutModelDetails" />
75 76 77 78 79 80 81 82
        </template>
    </app-simpleflex-container>
        </template>
    </app-simpleflex-container>
        </template>
    </app-scroll-container>
        </template>
    </app-scroll-container>
83
        </div>
84 85 86 87 88 89
    </div>
</template>


<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
90 91
import { UIActionTool, Util } from '@/utils';
import { AppMessageBox } from '@/utils/app-message-box/app-message-box';
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';


import { PanelContainerModel, PanelRawitemModel, PanelFieldModel, PanelControlModel, PanelButtonModel, PanelUserControlModel, PanelTabPanelModel, PanelTabPageModel, PanelCtrlPosModel} from '@/model/panel-detail';

import { appConfig } from '@/config/appConfig';


@Component({
    components: {
    },
})
export default class IndexBase extends Vue {
    
    /**
     * 数据变化
     *
     * @param {*} val
     * @returns {*}
     * @memberof IndexBase
     */
    @Emit() 
    public viewDatasChange(val: any):any {
        return val;
    }

    /**
     * 传入视图上下文
     *
     * @type {string}
     * @memberof IndexBase
     */
    @Prop() public viewdata!: string;

    /**
     * 传入视图参数
     *
     * @type {string}
     * @memberof IndexBase
     */
    @Prop() public viewparam!: string;

    /**
     * 视图默认使用
     *
     * @type {boolean}
     * @memberof IndexBase
     */
    @Prop({ default: true }) public viewDefaultUsage!: boolean;


	/**
	 * 视图标识
	 *
	 * @type {string}
	 * @memberof IndexBase
	 */
	public viewtag: string = '56f1a8b473554af1f58a4cb286fcbced';

    /**
	 * 视图类型
	 *
	 * @type {string}
	 * @memberof IndexBase
	 */
	public viewType: string = 'APPINDEXVIEW';

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

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

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

    /**
     * 视图参数变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof IndexBase
     */
    @Watch('viewparam',{immediate: true, deep: true})
    onParamData(newVal: any, oldVal: any) {
        if(newVal){
            this.viewparams = {};
            if(typeof newVal == 'string') {
                Object.assign(this.viewparams, JSON.parse(this.viewparam));
            }else{
                this.viewparams = Util.deepCopy(this.viewparam);
            }
            
        } 
    }

    /**
     * 处理应用上下文变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof IndexBase
     */
    @Watch('viewdata')
    onViewData(newVal: any, oldVal: any) {
        const _this: any = this;
        
        if (!Object.is(newVal, oldVal) && _this.engine) {
            this.$nextTick(()=>{
              _this.parseViewParam();
              _this.engine.load();
            });
        } else if(!Object.is(newVal, oldVal) && _this.refresh && _this.refresh instanceof Function) {
            _this.refresh();
        }
    }

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

242 243 244 245 246 247 248
    /**
     * 视图操作参数
     *
     * @type {*}
     * @readonly
     * @memberof IndexBase
     */
249
    public viewCtx: any = {};
250

251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
    /**
     *  计数器刷新
     *
     * @memberof IndexBase
     */
    public counterRefresh(){
        const _this:any =this;
        if(_this.counterServiceArray && _this.counterServiceArray.length >0){
            _this.counterServiceArray.forEach((item:any) =>{
                if(item.refreshData && item.refreshData instanceof Function){
                    item.refreshData();
                }
            })
        }
    }

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

    /**
     * 视图布局顶级成员名称
     *
     * @public
     * @memberof IndexBase
     */
    public rootLayoutDetailNames: string[] = [ 'container_scroll1' ];

284
    /**
285 286 287 288 289 290
     * 视图布局面板项模型对象
     *
     * @public
     * @memberof IndexBase
     */
    public layoutItems:any = {
291 292
        nav_pos1:{ name: 'nav_pos1', type: 'VIEWLAYOUT', caption: '导航区占位', isShowCaption: true, sysCss: '', itemType: 'RAWITEM', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'CENTER', layoutHeight:0, heightMode:'FULL', layoutWidth:0, widthMode:'FULL', spacingBottom:'INNERMEDIUM', spacingLeft:'INNERMEDIUM', spacingRight:'INNERMEDIUM', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll_main2', panel: this , viewType: 'APPINDEXVIEW', predefinedType: 'NAV_POS', contentType: '', contentStyle: '', rawContent: '', htmlContent: '', },
        container_scroll_main2:{ name: 'container_scroll_main2', type: 'VIEWLAYOUT', caption: '面板容器', titleBarCloseMode: 0, isShowCaption: true, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'BORDER', layoutPos:'CENTER', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll2', panel: this , details:['nav_pos1'] , dataRegionType: 'INHERIT' },
293
        nav_tabs2:{ name: 'nav_tabs2', type: 'VIEWLAYOUT', caption: '标签页导航栏', isShowCaption: true, sysCss: '', itemType: 'RAWITEM', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'CENTER', layoutHeight:0, heightMode:'FULL', layoutWidth:0, widthMode:'', spacingBottom:'INNERSMALL', spacingLeft:'INNERMEDIUM', spacingRight:'', spacingTop:'INNERSMALL', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll_header2', panel: this , viewType: 'APPINDEXVIEW', predefinedType: 'NAV_TABS', contentType: '', contentStyle: '', rawContent: '', htmlContent: '', },
294
        container_scroll_header2:{ name: 'container_scroll_header2', type: 'VIEWLAYOUT', caption: '面板容器', titleBarCloseMode: 0, isShowCaption: true, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'BORDER', layoutPos:'NORTH', layoutHeight:56, heightMode:'PX', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'LEFT', vAlignSelf:'MIDDLE', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll2', panel: this , details:['nav_tabs2'] , dataRegionType: 'INHERIT' },
295
        container_scroll2:{ name: 'container_scroll2', type: 'VIEWLAYOUT', caption: '滚动条容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'BORDER', layoutPos:'CENTER', layoutHeight:100, heightMode:'FULL', layoutWidth:0, widthMode:'FULL', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll_main1', panel: this , details:['container_scroll_main2','container_scroll_header2'] , dataRegionType: 'INHERIT' },
296
        container_scroll_main1:{ name: 'container_scroll_main1', type: 'VIEWLAYOUT', caption: '面板容器', titleBarCloseMode: 0, isShowCaption: true, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'BORDER', layoutPos:'CENTER', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll1', panel: this , details:['container_scroll2'] , dataRegionType: 'INHERIT' },
297
        appmenu:{ name: 'appmenu', type: 'VIEWLAYOUT', caption: '首页菜单', isShowCaption: true, sysCss: '', itemType: 'CTRLPOS', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'CENTER', layoutHeight:100, heightMode:'FULL', layoutWidth:0, widthMode:'FULL', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll_left1', panel: this },
298
        container_scroll_left1:{ name: 'container_scroll_left1', type: 'VIEWLAYOUT', caption: '面板容器', titleBarCloseMode: 0, isShowCaption: true, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'BORDER', layoutPos:'WEST', layoutHeight:0, heightMode:'', layoutWidth:15, widthMode:'PERCENTAGE', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll1', panel: this , details:['appmenu'] , dataRegionType: 'INHERIT' },
299
        app_apptitle:{ name: 'app_apptitle', type: 'VIEWLAYOUT', caption: '应用标题', isShowCaption: false, sysCss: '', itemType: 'FIELD', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'CENTER', vAlignSelf:'MIDDLE', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container1', panel: this , required: false, fieldState: '0', predefinedType: 'APP_APPTITLE', renderMode: 'HEADING1', dataItemName:'', wrapMode:'', vAlign:'', hAlign:'', },
300
        container1:{ name: 'container1', type: 'VIEWLAYOUT', caption: '面板容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'SIMPLEFLEX', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_grid1', panel: this , details:['app_apptitle'] , dataRegionType: 'INHERIT' },
301
        nav_breadcrumb1:{ name: 'nav_breadcrumb1', type: 'VIEWLAYOUT', caption: '面包屑导航', isShowCaption: true, sysCss: '', itemType: 'RAWITEM', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'LEFT', vAlignSelf:'MIDDLE', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container2', panel: this , viewType: 'APPINDEXVIEW', predefinedType: 'NAV_BREADCRUMB', contentType: '', contentStyle: '', rawContent: '', htmlContent: '', },
302
        container2:{ name: 'container2', type: 'VIEWLAYOUT', caption: '面板容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'SIMPLEFLEX', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:7, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_grid1', panel: this , details:['nav_breadcrumb1'] , dataRegionType: 'INHERIT' },
303
        auth_userinfo1:{ name: 'auth_userinfo1', type: 'VIEWLAYOUT', caption: '用户信息', isShowCaption: true, sysCss: '', itemType: 'RAWITEM', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'RIGHT', vAlignSelf:'MIDDLE', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container3', panel: this , viewType: 'APPINDEXVIEW', predefinedType: 'AUTH_USERINFO', contentType: '', contentStyle: '', rawContent: '', htmlContent: '', },
304
        container3:{ name: 'container3', type: 'VIEWLAYOUT', caption: '面板容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'SIMPLEFLEX', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:4, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_grid1', panel: this , details:['auth_userinfo1'] , dataRegionType: 'INHERIT' },
305
        container_grid1:{ name: 'container_grid1', type: 'VIEWLAYOUT', caption: '栅格容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'SIMPLEFLEX', layoutPos:'CENTER', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll_header1', panel: this , details:['container1','container2','container3'] , dataRegionType: 'INHERIT' },
306
        container_scroll_header1:{ name: 'container_scroll_header1', type: 'VIEWLAYOUT', caption: '面板容器', titleBarCloseMode: 0, isShowCaption: true, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'BORDER', layoutPos:'NORTH', layoutHeight:65, heightMode:'PX', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container_scroll1', panel: this , details:['container_grid1'] , dataRegionType: 'INHERIT' },
307
        container_scroll1:{ name: 'container_scroll1', type: 'VIEWLAYOUT', caption: '滚动条容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'BORDER', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, panel: this , details:['container_scroll_main1','container_scroll_left1','container_scroll_header1'] , dataRegionType: 'INHERIT' }
308 309
    }

310
    /**
311
     * 布局面板是否加载
312 313 314 315
     *
     * @public
     * @memberof IndexBase
     */
316
    public isLayoutLoadding: boolean = true;
317 318

    /**
319
     * 布局面板数据
320 321 322 323 324 325
     *
     * @public
     * @memberof IndexBase
     */
    public layoutData:any = {};

326
    /**
327
     * 布局面板模型对象
328 329 330 331
     *
     * @public
     * @memberof IndexBase
     */
332
    public layoutModelDetails:any = {};
333 334 335 336 337 338 339 340 341

    /**
     *  初始化布局
     *
     *  @public
     *  @memberof IndexBase
     */
    public async initLayout() {
        if (this.rootLayoutDetailNames.length > 0) {
342 343 344 345
            for (let i = 0; i < this.rootLayoutDetailNames.length; i++) {
                const name = this.rootLayoutDetailNames[i];
                const rootItem = this.layoutItems[name];
                if (!rootItem) {
346 347
                    return;
                }
348 349
                await this.initLayoutItem(rootItem);
            }
350
        }
351
        return true;
352 353 354 355 356 357 358 359
    }

    /**
     *  初始化布局项
     *
     *  @public
     *  @memberof IndexBase
     */
360
    public async initLayoutItem(layoutModelItem: any, index?: number) {
361 362
        const { name } = layoutModelItem;
        const layoutModelDetail = Util.getLayoutItemInstance(layoutModelItem);
363
        if (!(index || index === 0)) {
364 365
            await layoutModelDetail.load(this.context, this.viewparams);
            this.$set(this.layoutModelDetails, name, layoutModelDetail);
366
            this.$set(this.layoutData, name, layoutModelDetail.getData());
367
        } else {
368 369 370 371
            layoutModelDetail.setIndex(index);
            await layoutModelDetail.load(this.context, this.viewparams);
            this.$set(this.layoutModelDetails, `${name}_${index}`, layoutModelDetail);
            this.$set(this.layoutData, `${name}_${index}`, layoutModelDetail.getData());
372 373 374 375 376
        }
        if (layoutModelDetail && layoutModelDetail.details) {
            if (layoutModelDetail.dataRegionType === 'MULTIDATA') {
                const multiData = layoutModelDetail.getData();
                if (multiData && multiData.length > 0) {
377 378 379 380 381
                    for (let i = 0; i < multiData.length; i++) {
                        for (let j = 0; j < layoutModelDetail.details.length; j++) {
                            const key = layoutModelDetail.details[j];
                            if (this.layoutItems[key]) {
                                await this.initLayoutItem(this.layoutItems[key], i);
382 383
                            }
                        }
384
                    }
385 386
                }
            } else {
387 388 389
                for (let i = 0; i < layoutModelDetail.details.length; i++) {
                    const key = layoutModelDetail.details[i];
                    if (this.layoutItems[key]) {
390
                        await this.initLayoutItem(this.layoutItems[key], index);
391 392 393 394 395 396
                    }
                }
            }
        }
    }

397 398 399 400 401 402 403 404 405 406 407 408 409 410
    /**
     * 计算面板按钮权限状态
     *
     * @public
     * @memberof IndexBase
     */
    public computeButtonAuthState() {
        Object.values(this.layoutModelDetails).forEach((layoutModel: any) => {
            if (layoutModel.itemType == 'BUTTON') {
                layoutModel.computeActionAuthState();
            }
        })
    }

411 412 413 414
    /**
     * 处理值改变
     *
     * @public
415 416
     * @params args 改变数据
     * @params index 多数据容器下标
417 418
     * @memberof IndexBase
     */
419
    public handleValueChange(args: { name: string, value: any }, index?: number) {
420 421 422
        const { name, value } = args;
        let fullName = (index || index === 0) ? `${name}_${index}` : name;
        if (!fullName || !this.layoutData.hasOwnProperty(fullName)) {
423 424
            return;
        }
425 426
        this.layoutData[fullName] = value;
        this.layoutModelDetails[fullName].setData(value);
427
        this.panelLogic(name, index);
428
        this.computeButtonAuthState();
429 430
    }

431

432
    /**
433
     * 面板逻辑
434 435
     *
     * @public
436 437
     * @params name 改变项名称
     * @params index 多数据容器下标
438 439
     * @memberof IndexBase
     */
440
    public panelLogic(name: string, index?: number): void {
441 442
    }

443 444 445 446 447 448
    /**
     * 处理按钮点击
     *
     * @public
     * @memberof IndexBase
     */
449
    public handleButtonClick(name: string, $event?: any) {
450 451 452 453 454 455 456 457 458 459
        let datas: any[] = [];
        const data: any = this.layoutModelDetails[name].getData();
        if (data) {
            if (data instanceof Array) {
                datas = [...data];
            } else {
                datas = [data];
            }
        }
        const xData: any = this.layoutModelDetails[name].getDataArea();
460 461
        const paramJO: any = {};
        const contextJO: any = {};
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
        const _this: any = this;
    }





    /**
     * 引擎初始化
     *
     * @public
     * @memberof IndexBase
     */
    public engineInit(): void {
    }

    /**
     * 应用导航服务
     *
     * @type {*}
     * @memberof IndexBase
     */
    public  navDataService = NavDataService.getInstance();

    /**
    * 导航服务事件
    *
    * @public
    * @type {(Subscription | undefined)}
    * @memberof IndexBase
    */
    public serviceStateEvent: Subscription | undefined;

    /**
     * 门户部件状态对象
     *
     * @type {*}
     * @memberof IndexBase
     */
    @Prop() public portletState?: any;

   /**
   * 门户部件状态事件
   *
   * @public
   * @type {(Subscription | undefined)}
   * @memberof IndexBase
   */
    public portletStateEvent: Subscription | undefined;

    /**
    * 门户部件状态事件
    *
    * @public
    * @type {(Subscription | undefined)}
    * @memberof IndexBase
    */
    public formDruipartEvent: Subscription | undefined;

    /**
     * 应用上下文
     *
     * @type {*}
     * @memberof IndexBase
     */
    public context:any = {};

    /**
     * 视图参数
     *
     * @type {*}
     * @memberof IndexBase
     */
    public viewparams:any = {};

    /**
     * 视图缓存数据
     *
     * @type {*}
     * @memberof IndexBase
     */
    public viewCacheData:any;


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

    /**
     * 解析视图参数
     *
     * @public
     * @memberof IndexBase
     */
    public parseViewParam(inputvalue:any = null): void {
        for(let key in this.context){
            delete this.context[key];
        }
        if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
            Object.assign(this.context,this.$store.getters.getAppData().context);
        }
        if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
            if(typeof this.viewdata == 'string') {
                Object.assign(this.context, JSON.parse(this.viewdata));
            }
            if(this.context && this.context.srfparentdename){
                Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
            }
            if(this.context && this.context.srfparentkey){
                Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
            }
            this.handleCustomViewData();
            return;
        }
        const path = (this.$route.matched[this.$route.matched.length - 1]).path;
        const keys: Array<any> = [];
        const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
        const matchArray = curReg.exec(this.$route.path);
        let tempValue: Object = {};
        keys.forEach((item: any, index: number) => {
            if(matchArray[index + 1]){
                Object.defineProperty(tempValue, item.name, {
                    enumerable: true,
                    value: decodeURIComponent(matchArray[index + 1])
                });
            }
        });
        this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
        this.handleCustomViewData();
        //初始化导航数据
        this.initNavDataWithRoute();
    }

    /**
     * 处理自定义视图数据
     *
     * @memberof IndexBase
     */
	public handleCustomViewData(){
		if(Object.keys(this.customViewNavContexts).length > 0){
			Object.keys(this.customViewNavContexts).forEach((item:any) =>{
				let tempContext:any = {};
				let curNavContext:any = this.customViewNavContexts[item];
				this.handleCustomDataLogic(curNavContext,tempContext,item);
				Object.assign(this.context,tempContext);
			})
		}
		if(Object.keys(this.customViewParams).length > 0){
			Object.keys(this.customViewParams).forEach((item:any) =>{
				let tempParam:any = {};
				let curNavParam:any = this.customViewParams[item];
				this.handleCustomDataLogic(curNavParam,tempParam,item);
				Object.assign(this.viewparams,tempParam);
			})
		}
	}

    /**
     * 处理自定义视图数据逻辑
     *
     * @memberof IndexBase
     */
	public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
		// 直接值直接赋值
		if(curNavData.isRawValue){
			if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
                Object.defineProperty(tempData, item.toLowerCase(), {
                    value: null,
                    writable : true,
                    enumerable : true,
                    configurable : true
                });
            }else{
                Object.defineProperty(tempData, item.toLowerCase(), {
                    value: curNavData.value,
                    writable : true,
                    enumerable : true,
                    configurable : true
                });
            }
		}else{
			// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
			if(this.context[(curNavData.value).toLowerCase()] != null){
				Object.defineProperty(tempData, item.toLowerCase(), {
					value: this.context[(curNavData.value).toLowerCase()],
					writable : true,
					enumerable : true,
					configurable : true
				});
			}else{
				if(this.viewparams[(curNavData.value).toLowerCase()] != null){
					Object.defineProperty(tempData, item.toLowerCase(), {
						value: this.viewparams[(curNavData.value).toLowerCase()],
						writable : true,
						enumerable : true,
						configurable : true
					});
				}else{
					Object.defineProperty(tempData, item.toLowerCase(), {
						value: null,
						writable : true,
						enumerable : true,
						configurable : true
					});
				}
			}
		}
	}

    /**
     * 初始化导航数据(路由模式)
     *
     * @memberof IndexBase
     */
    public initNavDataWithRoute(data:any = null, isNew:boolean = false,  isAlways:boolean = false){
        if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
            this.navDataService.addNavData({id:'index',tag:this.viewtag,srfkey:isNew ? null : null,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
        }
    }

    /**
     * 初始化导航数据(分页模式)
     *
     * @memberof IndexBase
     */
    public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
        if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
            this.navDataService.addNavDataByOnly({id:'index',tag:this.viewtag,srfkey:null,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
        }
    }
	

    /**
     * Vue声明周期
     *
     * @memberof IndexBase
     */
    public created() {
        this.afterCreated();
    }

    /**
     * 执行created后的逻辑
     *
     * @memberof IndexBase
     */    
    public afterCreated(){
        let _this:any = this;
        const secondtag = _this.$util.createUUID();
        _this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
        _this.viewtag = secondtag;
        _this.parseViewParam();
        _this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
            if(!Object.is(name,'index')){
                return;
            }
            if (Object.is(action, 'viewrefresh')) {
                _this.$nextTick(()=>{
                    _this.parseViewParam(data);
                    if(_this.engine){
                        _this.engine.load();
                    }
                }); 
            }
        });
        if(_this.portletState){
            _this.portletStateEvent = _this.portletState.subscribe((res:any) =>{
                if(!Object.is(res.name,'index')){
                    return;
                }
                if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
                    _this.refresh();
                }
            })
        }
741 742 743 744 745 746 747 748 749 750
        _this.initViewCtx();
    }

    /**
     * 初始化视图操作参数
     *
     * @memberof IndexBase
     */  
    initViewCtx() {
        Object.assign(this.viewCtx, {
751
            app: this.$root,
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775
            view: this,
            viewGlobal: {},
            viewNavData: {},
            viewNavContext: this.context,
            viewNavParam: this.viewparams,
            messagebox: AppMessageBox.getInstance(),
        });
        Object.assign(this.viewCtx, { appGlobal: this.$store.getters.getAppGlobal() });
        if (this.$store.getters.getRouteViewGlobal(this.context.srfsessionid)) {
            Object.assign(this.viewCtx, { routeViewGlobal: this.$store.getters.getRouteViewGlobal(this.context.srfsessionid) });
        } else {
            this.$store.commit('addRouteViewGlobal', { tag: this.context.srfsessionid, param: {} });
            Object.assign(this.viewCtx, { routeViewGlobal: this.$store.getters.getRouteViewGlobal(this.context.srfsessionid) });
        }
        if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
            //  嵌入视图
            Object.assign(this.viewCtx, {
                topview: this.$store.getters.getView(this.context.srfsessionid)
            });
        } else {
            //  顶层视图
            this.$store.commit('addView', { tag: this.context.srfsessionid, param: this });
            Object.assign(this.viewCtx, { topview: this });
        }
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813
    }

    /**
     * 销毁之前
     *
     * @memberof IndexBase
     */
    public beforeDestroy() {
        this.$store.commit('viewaction/removeView', this.viewtag);

        let _this: any = this
        if (_this.serviceStateEvent) {
            _this.serviceStateEvent.unsubscribe();
        }
        if (_this.portletStateEvent) {
            _this.portletStateEvent.unsubscribe();
        }
        if (_this.engine) {
            _this.engine.destroy();
        }
    }

    /**
     * Vue声明周期(组件初始化完毕)
     *
     * @memberof IndexBase
     */
    public mounted() {
        this.afterMounted();
    }

    /**
     * 执行mounted后的逻辑
     * 
     * @memberof IndexBase
     */
    public afterMounted(){
        const _this: any = this;
814
        _this.initLayout().then((result: any) => {
815
            _this.isLayoutLoadding = false;
816 817 818 819 820 821 822 823
            _this.engineInit();
            if (_this.loadModel && _this.loadModel instanceof Function) {
                _this.loadModel();
            }
                    this.viewState.next({ tag: 'appmenu', action: 'load', data: {} });
            this.$viewTool.setIndexParameters([{ pathName: 'index', parameterName: 'index' }]);
            this.$viewTool.setIndexViewParam(this.context);
            this.mouse_move();
824
        })
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
    }




    /**
     * 关闭视图
     *
     * @param {any[]} args
     * @memberof IndexBase
     */
    public closeView(args: any[]): void {
        let _view: any = this;
        if (_view.viewdata) {
            _view.$emit('viewdataschange', Array.isArray(args)?args:[args]);
            _view.$emit('close', Array.isArray(args)?args:[args]);
        } else if (_view.$tabPageExp) {
            _view.$tabPageExp.onClose(_view.$route.fullPath);
        }
    }

    /**
     * 菜单位置
     *
     * @public
     * @type {string}
     * @memberof IndexBase
     */
    public mode: string ='vertical';

    /**
     * 导航模式(route:面包屑模式、tab:分页导航模式)
     *
     * @type {string}
     * @memberof IndexBase
     */
    @Provide()
    public navModel:string = "tab";

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

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

    /**
     * 初始化之前
     *
     * @memberof IndexBase
     */
    public beforeCreate(){
        let navDataService = NavDataService.getInstance();
        navDataService.removeAllNavData();
    }

    /**
     * 当前主题
     *
     * @readonly
     * @memberof IndexBase
     */
    get selectTheme() {
        if (this.$router.app.$store.state.selectTheme) {
            return this.$router.app.$store.state.selectTheme;
        } else if (localStorage.getItem('theme-class')) {
            return localStorage.getItem('theme-class');
        } else {
            return appConfig.defaultTheme;
        }
    }

    /**
     * 当前字体
     *
     * @readonly
     * @memberof IndexBase
     */
    get selectFont() {
        if (this.$router.app.$store.state.selectFont) {
            return this.$router.app.$store.state.selectFont;
        } else if (localStorage.getItem('font-family')) {
            return localStorage.getItem('font-family');
        } else {
            return appConfig.defaultFont;
        }
    }

    /**
     * 菜单收缩变化
     *
     * @type {boolean}
     * @memberof IndexBase
     */
    public collapseChange: boolean = false;

    /**
     * 菜单收缩点击
     *
     * @memberof IndexBase
     */
    public handleClick(): void {
        this.collapseChange = !this.collapseChange;
    }

    /**
     * 默认打开的视图
     *
     * @type {*}
     * @memberof IndexBase
     */
    public defPSAppView: any = {
        codename: 'appportalview',
        viewtitle: '工作台',
        openmode: '',
        width: 0,
        height: 0,
        deResParameters: [],
        routepath: '/index/:index?/appportalview/:appportalview?',
        parameters: [
            { pathName: 'appportalview', parameterName: 'appportalview' },
        ],
    };

    /**
     * 应用起始页面
     *
     * @type {boolean}
     * @memberof IndexBase
     */
    public isDefaultPage: boolean = true;

    /**
     * 空白视图模式
     *
     * @type {boolean}
     * @memberof IndexBase
     */
    public isBlankMode:boolean = false;

    /**
     * 获取样式
     *
     * @readonly
     * @type {string[]}
     * @memberof IndexBase
     */
    get themeClasses(): string {
        return this.selectTheme;
    }

    /**
     * 主题字体
     *
     * @readonly
     * @type {*}
     * @memberof IndexBase
     */
    get themeStyle(): any {
        return {
            'height': '100vh',
            'font-family': this.selectFont,
        }
    }

    /**
     * 获取路由列表
     *
     * @readonly
     * @type {any[]}
     * @memberof IndexBase
     */
    get getRouterList(): any[] {
        return this.$store.state.historyPathList;
    }

    /**
     * 获取路由键值
     *
     * @readonly
     * @type {string}
     * @memberof IndexBase
     */
    get getRouterViewKey(): string {
        return this.$route.fullPath;
    }

    /**
     * 鼠标拖动事件
     *
     * @param {*} val
     * @returns {*}
     * @memberof IndexBase
     */
    public mouse_move(){
        let move_axis:any = document.getElementById("move_axis");
        let left_move :any= document.getElementById("left_move");
        let right_move :any= document.getElementById("right_move");
        let movebox :any= document.getElementById("movebox");
        if(left_move && right_move && move_axis && movebox){
            let leftWidth :number = parseInt(left_move.style.width);
            move_axis.onmousedown = (e:any) =>{
                let startX = e.clientX;
                move_axis.left = move_axis.offsetLeft;
                document.onmousemove =  (e:any) =>{
                    let endX = e.clientX; 
                    let moveLen = move_axis.left + (endX - startX);
                    let maxT = movebox.clientWidth - move_axis.offsetWidth;
                    if (moveLen < 150) moveLen = 150;
                    if (moveLen > maxT - 150) moveLen = maxT - 150; 
                    move_axis.style.left = moveLen;
                    left_move.style.width = moveLen + "px";
                    right_move.style.width = (movebox.clientWidth - moveLen - 5) + "px";
                    if (moveLen>500) {
                        left_move.style.width = 500 + 'px';
                    }

                    let left_width : number = parseInt(left_move.style.width);
                    move_axis.style.left = left_width - 5 + 'px';
                    if (left_width < leftWidth){
                        move_axis.style.left = leftWidth - 5 + 'px';
                    }
                }
                document.onmouseup = (evt) =>{
                    document.onmousemove = null;
                    document.onmouseup = null;
                    move_axis.releaseCapture && move_axis.releaseCapture();
                }
                move_axis.setCapture && move_axis.setCapture();
                return false;
            }
        }
    }

}
</script>

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