app-meditviewpanel-model.ts 2.5 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 69 70
import { IPSAppDataEntity, IPSAppDERS, IPSDEMultiEditViewPanel } from '@ibiz/dynamic-model-api';

/**
 * AppKanbanModel 部件模型
 *
 * @export
 * @class AppKanbanModel
 */
export class AppMEditviewPanelModel {
    /**
     * 多编辑视图实例对象
     *
     * @memberof AppMEditviewPanelModel
     */
    public meditViewPanelInstance!: IPSDEMultiEditViewPanel;

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

    /**
     * 获取数据项集合
     *
     * @returns {any[]}
     * @memberof AppMEditviewPanelModel
     */
    public getDataItems(): any[] {
        let modelArray: any[] = [];
        if (this.meditViewPanelInstance.getPSAppDataEntity()) {
            const appDataEntity = this.meditViewPanelInstance.getPSAppDataEntity();
            if (appDataEntity?.getAllPSAppDEFields()) {
                appDataEntity.getAllPSAppDEFields()?.forEach((defield: any) => {
                    let obj: any = {};
                    if (defield.keyField) {
                        obj.name = appDataEntity.codeName.toLowerCase();
                        obj.prop = defield.codeName.toLowerCase();
                    } else {
                        obj.name = defield.codeName.toLowerCase();
                    }
                    modelArray.push(obj);
                });
            }
        }

        // todo 关联主实体的主键
        // if (this.meditViewPanelInstance.getPSAppDataEntity()) {
        //     const appDataEntity = this.meditViewPanelInstance.getPSAppDataEntity() as IPSAppDataEntity ;
        //     if (appDataEntity.major == false && appDataEntity.getMinorPSAppDERSs()) {
        //         appDataEntity.getMinorPSAppDERSs()?.forEach((minorAppDERSs: IPSAppDERS) => {
        //             let obj: any = {};
        //             if (minorAppDERSs.getMajorPSAppDataEntity()) {
        //                 const majorAppDataEntity = minorAppDERSs.getMajorPSAppDataEntity() as IPSAppDataEntity ;
        //                 obj.name = majorAppDataEntity.codeName.toLowerCase();
        //                 if (majorAppDataEntity.getPSDER1N) {
        //                     obj.prop = majorAppDataEntity.getPSDER1N()?.getPSPickupDEField().codeName.toLowerCase();
        //                 }
        //             }
        //             modelArray.push(obj);
        //         });
        //     }
        // }
        return modelArray;
    }
}