From 71c566050237487484aecfccb11ba89a6dc5720d Mon Sep 17 00:00:00 2001 From: lijianxiong <1518062161@qq.com> Date: Mon, 28 Oct 2024 19:56:27 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=9B=B4=E6=96=B0=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E5=AF=BC=E8=88=AA=E8=A7=86=E5=9B=BE=E5=BC=95=E6=93=8E?= =?UTF-8?q?=E9=80=82=E9=85=8D=E8=AE=A1=E7=AE=97=E5=B7=A5=E5=85=B7=E6=A0=8F?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=9D=83=E9=99=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 + src/view-engine/mob-tab-exp-view.engine.ts | 111 ++++++++++++++++++++- 2 files changed, 114 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6b9745965..bd9d59ba56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - 修复时间范围选择无值时点击不出选择弹框及适配值分隔符与pc端保持一致 +### Added + +- 更新分页导航视图引擎适配计算工具栏按钮权限逻辑 + ## [0.0.31] - 2024-10-27 ### Added diff --git a/src/view-engine/mob-tab-exp-view.engine.ts b/src/view-engine/mob-tab-exp-view.engine.ts index 8f59467d9b..b20ec837af 100644 --- a/src/view-engine/mob-tab-exp-view.engine.ts +++ b/src/view-engine/mob-tab-exp-view.engine.ts @@ -1,3 +1,4 @@ +import { RuntimeError } from '@ibiz-template/core'; import { ViewController, ITabExpPanelController, @@ -5,6 +6,7 @@ import { ITabExpViewState, ViewEngineBase, calcDeCodeNameById, + IToolbarController, } from '@ibiz-template/runtime'; import { IAppDETabExplorerView } from '@ibiz/model-core'; @@ -40,6 +42,45 @@ export class MobTabExpViewEngine extends ViewEngineBase { return this.view.getController('tabexppanel') as ITabExpPanelController; } + /** + * 左工具栏 + * + * @author ljx + * @date 2024-10-28 15:36:45 + * @readonly + * @protected + * @type {(IToolbarController | undefined)} + */ + protected get leftToolbar(): IToolbarController | undefined { + return this.view.getController('lefttoolbar') as IToolbarController; + } + + /** + * 右工具栏 + * + * @author ljx + * @date 2024-10-28 15:36:45 + * @readonly + * @protected + * @type {(IToolbarController | undefined)} + */ + protected get rightToolbar(): IToolbarController | undefined { + return this.view.getController('righttoolbar') as IToolbarController; + } + + /** + * 页脚工具栏 + * + * @author ljx + * @date 2024-10-28 15:36:45 + * @readonly + * @protected + * @type {(IToolbarController | undefined)} + */ + protected get footerToolbar(): IToolbarController | undefined { + return this.view.getController('footertoolbar') as IToolbarController; + } + /** * 视图created生命周期执行逻辑 * @@ -69,6 +110,74 @@ export class MobTabExpViewEngine extends ViewEngineBase { if (!this.view.context[deName]) { return; } - return super.loadEntityData(); + const { appDataEntityId } = this.view.model; + const { evt, context, params } = this.view; + if (!appDataEntityId) { + throw new RuntimeError(ibiz.i18n.t('runtime.engine.loadEntityData')); + } + const app = ibiz.hub.getApp(context.srfappid); + const res = await app.deService.exec( + appDataEntityId, + 'get', + context, + params, + undefined, + { srfdataaccaction: this.enabledDataAccAction }, + ); + + const { data } = res; + if (data) { + if (this.enabledDataAccAction) { + await this.handleEntityPrivilege(data, this.view.context); + } + // 更新视图作用域数据和srfreadonly数据 + this.view.state.srfactiveviewdata = data; + if (Object.prototype.hasOwnProperty.call(data, 'srfreadonly')) { + this.view.context.srfreadonly = data.srfreadonly; + } + evt.emit('onDataChange', { actionType: 'LOAD', data: [data] }); + if (data.srfkey) { + evt.emit('onViewInfoChange', { dataInfo: data.srfmajortext || '' }); + } + const viewDeId = this.view.model.appDataEntityId; + this.updateToolbarState(data, viewDeId); + } + } + + /** + * 获取所有的工具栏控制器 + * + * @author ljx + * @date 2024-10-28 15:36:45 + * @protected + * @return {*} {IToolbarController[]} + */ + protected getAllToolbars(): IToolbarController[] { + const toolbars: IToolbarController[] = []; + if (this.leftToolbar) { + toolbars.push(this.leftToolbar); + } + if (this.rightToolbar) { + toolbars.push(this.rightToolbar); + } + if (this.footerToolbar) { + toolbars.push(this.footerToolbar); + } + return toolbars; + } + + /** + * 更新工具栏状态 + * + * @author ljx + * @date 2024-10-28 15:36:45 + * @protected + * @param {IData} data + * @param {string} appDeId + */ + protected updateToolbarState(data: IData, appDeId?: string): void { + this.getAllToolbars().forEach(toolbar => { + toolbar?.calcButtonState(data, appDeId); + }); } } -- Gitee