From 0938dedb7497b70e975d3431fe3a2e467387042b Mon Sep 17 00:00:00 2001 From: "jlj05024111@163.com" Date: Sat, 11 Oct 2025 16:08:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF=E9=83=A8=E4=BB=B6=E5=A4=B4=E9=83=A8=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E7=BB=98=E5=88=B6=E5=99=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../portlet-layout/portlet-layout.scss | 20 +++ .../portlet/portlet-layout/portlet-layout.tsx | 146 ++++++++++++++---- 3 files changed, 141 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2138ac42..f9cce410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Added +- 支持看板部件头部区域绘制器逻辑 - 新增地图选择编辑器 ### Change diff --git a/src/control/dashboard/portlet/portlet-layout/portlet-layout.scss b/src/control/dashboard/portlet/portlet-layout/portlet-layout.scss index 9e39a047..e8d7a69d 100644 --- a/src/control/dashboard/portlet/portlet-layout/portlet-layout.scss +++ b/src/control/dashboard/portlet/portlet-layout/portlet-layout.scss @@ -52,6 +52,26 @@ $portlet-layout: ( @include b(portlet-layout-header) { @include flex(row, space-between); + @include when(custom) { + position: relative; + + @include e(left){ + z-index: 1; + } + + @include e(right){ + z-index: 1; + } + + @include e(bg) { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } + } + height: getCssVar(portlet-layout, header-height); padding: getCssVar(portlet-layout, header-padding); margin: getCssVar(portlet-layout, header-margin); diff --git a/src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx b/src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx index ab6452d1..2f41ffce 100644 --- a/src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx +++ b/src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx @@ -1,8 +1,8 @@ import { useNamespace } from '@ibiz-template/vue3-util'; import { computed, defineComponent } from 'vue'; -import { IUIActionGroupDetail } from '@ibiz/model-core'; +import { IControlRender, IUIActionGroupDetail } from '@ibiz/model-core'; import './portlet-layout.scss'; -import { PortletPartController } from '@ibiz-template/runtime'; +import { PortletPartController, ScriptFactory } from '@ibiz-template/runtime'; /** * 门户控件布局 @@ -34,39 +34,133 @@ export const PortletLayout = defineComponent({ await props.controller.onActionClick(detail, event); }; - return { ns, isShowHeader, onActionClick }; + // 部件绘制器 + const controlRenders = c.dashboard.model.controlRenders; + + console.log('controlRenders', c, controlRenders); + + // 头部绘制器 + const header = controlRenders?.find( + item => `dashboard_${item.id}` === `${c.model.name}_mob_header`, + ); + + // 头部标题绘制器 + const headerCaption = controlRenders?.find( + item => `dashboard_${item.id}` === `${c.model.name}_mob_header_caption`, + ); + + // 头部背景绘制器 + const headerBg = controlRenders?.find( + item => `dashboard_${item.id}` === `${c.model.name}_mob_header_bg`, + ); + + // 头部行为组绘制器 + const headerAction = controlRenders?.find( + item => `dashboard_${item.id}` === `${c.model.name}_mob_header_action`, + ); + + // 渲染绘制器内容 + const renderContent = (model: IControlRender) => { + if (model.renderType === 'LAYOUTPANEL_MODEL' && model.layoutPanelModel) { + const htmlCode = ScriptFactory.execScriptFn( + { + params: c.params, + context: c.context, + }, + model.layoutPanelModel, + { isAsync: false }, + ) as string; + return
; + } + if (model.renderType === 'LAYOUTPANEL' && model.layoutPanel) { + return ( + + ); + } + }; + + return { + ns, + isShowHeader, + header, + headerCaption, + headerBg, + headerAction, + renderContent, + onActionClick, + }; }, render() { const { model, state } = this.$props.controller; - return ( -
- {this.isShowHeader && ( -
+ const isCustom = !!( + this.header || + this.headerCaption || + this.headerBg || + this.headerAction + ); + let headerRender = null; + if (this.isShowHeader) { + if (this.header) { + headerRender = ( +
+ {this.renderContent(this.header)} +
+ ); + } else { + headerRender = ( +
+ {this.headerBg && ( +
+ {this.renderContent(this.headerBg)} +
+ )}
- {model.showTitleBar && ( -
- -
- {model.title} + {model.showTitleBar && + (this.headerCaption ? ( + this.renderContent(this.headerCaption) + ) : ( +
+ +
+ {model.title} +
-
- )} + ))}
- {model.uiactionGroup && ( - - )} + {model.uiactionGroup && + (this.headerAction ? ( + this.renderContent(this.headerAction) + ) : ( + + ))}
- )} + ); + } + } + return ( +
+ {headerRender}
{this.$slots.default?.()}
-- Gitee From 427f1acbf91dfb1921b691386e76e4d238d01041 Mon Sep 17 00:00:00 2001 From: "jlj05024111@163.com" Date: Sat, 11 Oct 2025 16:21:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx b/src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx index 2f41ffce..1ad2b7c9 100644 --- a/src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx +++ b/src/control/dashboard/portlet/portlet-layout/portlet-layout.tsx @@ -37,8 +37,6 @@ export const PortletLayout = defineComponent({ // 部件绘制器 const controlRenders = c.dashboard.model.controlRenders; - console.log('controlRenders', c, controlRenders); - // 头部绘制器 const header = controlRenders?.find( item => `dashboard_${item.id}` === `${c.model.name}_mob_header`, -- Gitee