ui-logic-entity-param.ts 1.3 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
import { IParams } from "ibiz-core";
import { UILogicParamType } from "../const/ui-logic-param-type";
import { AppDeUILogicParamBase } from "./ui-logic-param-base";

/**
 * 逻辑数据对象参数
 *
 * @export
 * @class AppDeUILogicEntityParam
 */
export class AppDeUILogicEntityParam extends AppDeUILogicParamBase {

    /**
     * Creates an instance of AppDeUILogicEntityParam.
     * @param {*} opts
     * @memberof AppDeUILogicEntityParam
     */
    public constructor(opts: any) {
        super(opts);
    }

    /**
     * 初始化
     *
     * @protected
     * @memberof AppDeUILogicEntityParam
     */
    protected init(params: IParams) {
        super.init(params);
        this.logicParamType = UILogicParamType.entityParam;
    }

    /**
     * 绑定指定参数对象
     *
     * @param {*} opts
     * @memberof AppDeUILogicEntityParam
     */
    public bind(opts: any) {
        let srcObj: any;
        if (opts) {
            if (Object.prototype.toString.call(opts) === '[object Object]') {
                srcObj = opts;
            }else if (Object.prototype.toString.call(opts) === '[object Array]') {
                srcObj = opts[0];
            }else{
                srcObj = opts;
            }
            this.setReal(srcObj);
        }
    }
}