ui-logic-view-session-param.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 43 44 45 46 47
import { IParams } from "ibiz-core";
import { UILogicParamType } from "../const/ui-logic-param-type";
import { AppDeUILogicParamBase } from "./ui-logic-param-base";

/**
 * 当前视图会话共享参数绑定参数
 *
 * @export
 * @class UILogicViewSessionParam
 */
export class UILogicViewSessionParam extends AppDeUILogicParamBase {

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

    /**
     * 初始化
     *
     * @protected
     * @memberof UILogicViewSessionParam
     */
    protected init(params: IParams) {
        this.logicParamType = UILogicParamType.viewSessionParam;
        this.realValue = this.getViewSessionParam(params);
    }

    /**
     * 获取当前视图会话共享参数绑定参数
     *
     * @private
     * @param {IParams} params
     * @memberof UILogicViewSessionParam
     */
    private getViewSessionParam(params: IParams) {
        const { actioncontext } = params;
        const { viewCtx } = actioncontext;
        if (viewCtx && viewCtx['viewGlobal']) {
            return viewCtx['viewGlobal'];
        }
    }
}