treeexpview-base.tsx 1.8 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
import { IPSAppDETreeExplorerView, IPSTreeExpBar } from '@ibiz/dynamic-model-api';
import { TreeExpViewEngine, ModelTool, TreeExpViewInterface } from 'ibiz-core';
import { ExpViewBase } from './expview-base';

/**
 * 树导航视图基类
 *
 * @export
 * @class TreeExpViewBase
 * @extends {ExpViewBase}
 * @implements {TreeExpViewInterface}
 */
export class TreeExpViewBase extends ExpViewBase implements TreeExpViewInterface {
    /**
     * 视图实例
     *
     * @memberof TreeExpViewBase
     */
    public declare viewInstance: IPSAppDETreeExplorerView;

    /**
     * 导航栏实例
     *
     * @memberof TreeExpViewBase
     */
    public declare expBarInstance: IPSTreeExpBar;

    /**
     * 视图引擎
     *
     * @public
     * @type {TreeExpViewEngine}
     * @memberof TreeExpViewBase
     */
    public declare engine: TreeExpViewEngine;

    /**
     * 引擎初始化
     *
     * @public
     * @memberof TreeExpViewBase
     */
    public engineInit(): void {
        if (this.Environment && this.Environment.isPreviewMode) {
            return;
        }
        this.engine.init({
          view: this,
          p2k: '0',
          treeexpbar:(this.$refs[this.expBarInstance?.name] as any).ctrl,
          keyPSDEField: this.appDeCodeName.toLowerCase(),
          majorPSDEField: this.appDeMajorFieldName.toLowerCase(),
          isLoadDefault: this.viewInstance?.loadDefault,
        });
    } 

    /**
     * 初始化列表视图实例
     *
     * @memberof TreeExpViewBase
     */
    public async viewModelInit() {
        this.viewInstance = (this.staticProps?.modeldata) as IPSAppDETreeExplorerView;
        await super.viewModelInit();
        this.expBarInstance = ModelTool.findPSControlByType('TREEEXPBAR', this.viewInstance.getPSControls() || []);
    }

}