app-default-deindexview-layout.tsx 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
import { Component, Prop } from 'vue-property-decorator';
import { IPSAppDEIndexView } from '@ibiz/dynamic-model-api';
import { ModelTool } from 'ibiz-core';
import { AppDefaultViewLayout } from '../app-default-view-layout/app-default-view-layout';

/** 
 * @description 应用实体首页视图默认样式视图布局面板
 * @export
 * @class AppDefaultDeIndexViewLayout
 * @extends {AppDefaultViewLayout}
 */
@Component({})
export class AppDefaultDeIndexViewLayout extends AppDefaultViewLayout {
    /**
     * 
     *
     * @type {IPSAppDEIndexView}
     * @memberof AppDefaultDeIndexViewLayout
     */
    @Prop() public declare viewInstance: IPSAppDEIndexView;

    /**
     * 引擎初始化
     *
     * @param {*} [opts={}]
     * @memberof AppDefaultDeIndexViewLayout
     */
    public engineInit(opts: any = {}) {
        const controls: any[] = this.containerModel.getPSControls() || [];
        let engineOpts = Object.assign({
            view: this,
            p2k: '0',
            isLoadDefault: true,
            keyPSDEField: this.appDeCodeName.toLowerCase(),
            majorPSDEField: this.appDeMajorFieldName.toLowerCase()
        }, opts);
        //  表单
        const form = ModelTool.findPSControlByType('FORM', controls);
        if (form) {
            Object.assign(engineOpts, { form: (this.$refs[form.name] as any).ctrl });
        }
        //  数据关系栏
        const drbar = ModelTool.findPSControlByType('DRBAR', controls);
        if (drbar) {
            Object.assign(engineOpts, { drbar: (this.$refs[drbar.name] as any).ctrl })
        }
        this.engine.init(engineOpts);
    }
    
}