app-wizardpanel-model.ts 1.2 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
import { IPSAppDataEntity, IPSAppDEField, IPSDEWizardPanel } from '@ibiz/dynamic-model-api';

export class AppWizardPanelModel {

    /**
     * 向导面板模型实例
     * 
     * @memberof AppWizardPanelModel
     */
    public controlInstance!: IPSDEWizardPanel;

    /**
     * Creates an instance of AppWizardPanelModel.
     * 
     * @param {*} [opts={}]
     * @memberof AppWizardPanelModel
     */
    constructor(opts: any) {
        this.controlInstance = opts;
    }

    /**
    * 获取数据项集合
    *
    * @returns {any[]}
    * @memberof AppWizardPanelModel
    */
    public getDataItems(): any[] {
        let modelArray: Array<any> = [];
        let appDEFileds: Array<IPSAppDEField> = (this.controlInstance.getPSAppDataEntity() as IPSAppDataEntity)?.getAllPSAppDEFields() || [];

        if (appDEFileds?.length > 0) {
            appDEFileds.forEach((field: any) => {
                modelArray.push({
                    name: field.keyField ? ((this.controlInstance.getPSAppDataEntity() as IPSAppDataEntity))?.codeName?.toLowerCase() : field.codeName.toLowerCase(),
                    prop: field.codeName.toLowerCase()
                })
            })
        }
        return modelArray;
    }
}