app-default-depanelview-layout.tsx 1.1 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
import { Prop, Component } from 'vue-property-decorator';
import { IPSAppDEPanelView } from "@ibiz/dynamic-model-api";
import { ModelTool } from "ibiz-core";
import { AppDefaultViewLayout } from "../app-default-view-layout/app-default-view-layout";

@Component({})
export class AppDefaultDePanelViewLayout extends AppDefaultViewLayout {

  /**
   * 实体面板视图模型对象
   *
   * @type {IPSAppDEPanelView}
   * @memberof AppDefaultDePanelViewLayout
   */
  @Prop() public declare viewInstance: IPSAppDEPanelView;

  /**
   * 引擎初始化
   *
   * @param {*} [opts={}]
   * @memberof AppDefaultDePanelViewLayout
   */
  public engineInit(opts: any = {}) {
    const controls: any[] = this.containerModel.getPSControls() || [];
    const panel = ModelTool.findPSControlByType('PANEL', controls);
    const engineOpts: any = {
      view: this,
      p2k: '0',
      isLoadDefault: true,
      keyPSDEField: this.appDeCodeName.toLowerCase(),
      majorPSDEField: this.appDeMajorFieldName.toLowerCase()
    }
    if (panel) {
      Object.assign(engineOpts,{
        panel: (this.$refs[panel.name] as any).ctrl
      })
    }
    this.engine.init(engineOpts);
  }

}