app-mob-menu-service.ts 2.1 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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105

import { AppMobMenuModel } from 'ibiz-vue';
import { ControlServiceBase } from 'ibiz-core';
import { IPSAppMenu } from '@ibiz/dynamic-model-api';

/**
 * 菜单部件服务对象
 * 
 * 
 */
export class AppMobMenuService extends ControlServiceBase {

    /**
    * 菜单实例对象
    *
    * @memberof AppMobMenuService
    */
    public MenuInstance !: IPSAppMenu;

    /**
     * 部件模型
     *
     * @type {(any | null)}
     * @memberof AppMobMenuService
     */
    public model: AppMobMenuModel | null = null;

    /**
     * Creates an instance of AppMobMenuService.
     * 
     * @memberof AppMobMenuService
     */
     constructor(opts: any = {}, context?: any, args?: any) {
        super(opts, context, args);
        this.MenuInstance = opts;
    }

    /**
     * 加载服务参数
     *
     * @type {boolean}
     * @memberof AppMobChartService
     */
    public async loaded(context: any, opt: any) {
        await this.initServiceParam(context, opt);
    }

    /**
     * 初始化服务参数
     *
     * @memberof AppMobMenuService
     */
    public async initServiceParam(context: any, opts: IPSAppMenu) {
        this.model = new AppMobMenuModel(context, opts);
        await this.model.loaded();
    }

    /**
     * 获取所有菜单项
     *
     * @memberof AppMobMenuService
     */
    public getAllMenuItems() {
        return this.model?.getAllMenuItems();
    }

    /**
     * 获取所有应用功能
     *
     * @memberof AppMobMenuService
     */
    public getAllFuncs() {
        return this.model?.getAllFuncs();
    }

    /**
     * 是否启用预制功能
     *
     * @readonly
     * @memberof AppMobMenuModel
     */
    get isEnablePrecutFuncs() {
        return this.model?.isEnablePrecutFuncs || false;
    }

    /**
     * 预制模型
     *
     * @memberof AppMobMenuModel
     */
    public getAllPrecutFuncs() {
        return this.model?.getAllPrecutFuncs() || [];
    }


    /**
     * 预制功能对应菜单
     *
     * @return {*} 
     * @memberof AppMobMenuModel
     */
    public getPrecutMenu() {
        return this.model?.getPrecutMenu();
    }
}