mob-tab-exp-view-engine.ts 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 69
import { ViewEngine } from './view-engine';

/**
 * 实体移动端分页导航视图界面引擎
 *
 * @export
 * @class MobTabExpViewEngine
 * @extends {ViewEngine}
 */
export class MobTabExpViewEngine extends ViewEngine {

    /**
     * Creates an instance of MobTabExpViewEngine.
     * 
     * 
     * @memberof MobTabExpViewEngine
     */
    constructor() {
        super();
    }

    /**
     * 初始化引擎
     *
     * @param {*} options
     * @memberof MobTabExpViewEngine
     */
    public init(options: any): void {
        super.init(options);
    }

    /**
     * 引擎加载
     *
     * @memberof MobTabExpViewEngine
     */
    public load(): void {
        super.load();
        this.loadModel();
    }

    /**
     * 加载模型
     * 
     * @memberof MobTabExpViewBase
     */
    public loadModel() {
        const _this = this.view;
        if (_this.context[_this.appDeCodeName?.toLowerCase() as string]) {
            _this.appEntityService.getDataInfo(JSON.parse(JSON.stringify(_this.context)), {}, false).then((response: any) => {
                if (!response || response.status !== 200) {
                    return;
                }
                const { data: _data } = response;
                if (_data.srfopprivs) {
                    _this.$store.commit('authresource/setSrfappdeData', { key: `${_this.deName}-${_data[_this.appDeKeyFieldName.toLowerCase()]}`, value: _data.srfopprivs });
                }
                if (_data[_this.appDeMajorFieldName.toLowerCase()]) {
                    _this.model.dataInfo = _data[_this.appDeMajorFieldName.toLowerCase()];
                    if (_this.$route) {
                        _this.$route.meta.info = _this.model.dataInfo;
                    }
                }
                _this.initNavCaption();
            })
        }
    }

}