提交 5d89de7e 编写于 作者: WodahsOrez's avatar WodahsOrez

update: 门户

上级 3cb85367
...@@ -9,6 +9,7 @@ import net.ibizsys.model.app.view.IPSAppViewRef; ...@@ -9,6 +9,7 @@ import net.ibizsys.model.app.view.IPSAppViewRef;
import net.ibizsys.model.control.IPSControl; import net.ibizsys.model.control.IPSControl;
import net.ibizsys.model.control.IPSControlContainer; import net.ibizsys.model.control.IPSControlContainer;
import net.ibizsys.model.control.dashboard.IPSDBContainerPortletPart; import net.ibizsys.model.control.dashboard.IPSDBContainerPortletPart;
import net.ibizsys.model.control.dashboard.IPSDBPortletPart;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -46,10 +47,15 @@ public class CtrlModel extends BaseModel{ ...@@ -46,10 +47,15 @@ public class CtrlModel extends BaseModel{
} }
} }
handleChildControls(); handleChildControls();
if("DASHBOARD".equals( getControl().getControlType())){
handleAllPortlets((IPSControlContainer)getControl());
}
} }
public Map<String,CtrlModel> ctrlsMap = new LinkedHashMap(); public Map<String,CtrlModel> ctrlsMap = new LinkedHashMap();
public Map<String,IPSControl> portletsMap = new LinkedHashMap();
private AppModel app; private AppModel app;
private AppEntityModel appEntity; private AppEntityModel appEntity;
...@@ -70,6 +76,11 @@ public class CtrlModel extends BaseModel{ ...@@ -70,6 +76,11 @@ public class CtrlModel extends BaseModel{
return ctrlsMap.values(); return ctrlsMap.values();
} }
public Collection<IPSControl> getAllPortlets()
{
return portletsMap.values();
}
public IPSControl getControl() public IPSControl getControl()
{ {
return (IPSControl)opt; return (IPSControl)opt;
...@@ -110,6 +121,21 @@ public class CtrlModel extends BaseModel{ ...@@ -110,6 +121,21 @@ public class CtrlModel extends BaseModel{
} }
} }
public void handleAllPortlets(IPSControlContainer control) {
List<IPSControl> controls = control.getPSControls();
if (controls != null && controls.size() > 0) {
for (IPSControl _control : controls) {
if("CONTAINER".equals( ((IPSDBPortletPart)_control).getPortletType() )){
this.handleAllPortlets((IPSControlContainer)_control);
}else{
if(!this.portletsMap.containsKey(_control.getCodeName())) {
this.portletsMap.put(_control.getCodeName(),_control);
}
}
}
}
}
// 忽略发布 // 忽略发布
public Boolean ignore() { public Boolean ignore() {
IPSControl control = getControl(); IPSControl control = getControl();
......
<AppPortletCard
name={{portlet.name}}
:isContainer="true"
{{#if portlet.caption}}
title="{{portlet.caption}}"
{{/if}}
:showCaption="{{portlet.isShowTitleBar}}"
{{#if portlet.psSysImage}}
{{#if portlet.psSysImage.imagePath}}imgPath="{{portlet.psSysImage.imagePath}}"{{else if portlet.psSysImage.cssClass}}iconClass="{{portlet.psSysImage.cssClass}}"{{/if}}
{{/if}}
:layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=portlet.psLayout layoutPos=portlet.psLayoutPos}}"
class="app-portletContainer {{portlet.psSysCss.cssName}}"
{{#if (or portlet.width portlet.height)}}
style="{{#if portlet.width}}width: {{portlet.width}}px;{{/if}}{{#if portlet.height}}height: {{portlet.height}}px;{{/if}}"
{{/if}}
>
{{#each portlet.psControls as | subPortlet | }}
{{#eq subPortlet.portletType 'CONTAINER'}}
{{>(lookup 'PORTLET_CONTAINER') portlet=subPortlet}}
{{else}}
{{>(lookup 'PORTLET') portlet=subPortlet}}
{{/eq}}
{{/each}}
</AppPortletCard>
{{#*inline "DASHBOARD"}}{{>@macro/front-end/widgets/dashboard-detail/dashboard.hbs}}{{/inline}} {{#*inline "PORTLET_CONTAINER"}}{{>@macro/front-end/widgets/dashboard-detail/container.hbs}}{{/inline}}
{{#*inline "CONTAINER"}}{{>@macro/front-end/widgets/dashboard-detail/portlet-container.hbs}}{{/inline}} {{#*inline "PORTLET"}}{{>@macro/front-end/widgets/dashboard-detail/portlet.hbs}}{{/inline}}
\ No newline at end of file \ No newline at end of file
<{{codeName}}Portlet
ref="portlet"
name="{{portlet.name}}"
{{#if portlet.caption}}
title="{{portlet.caption}}"
{{/if}}
:showCaption="{{portlet.isShowTitleBar}}"
:layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=portlet.psLayout layoutPos=portlet.psLayoutPos}}"
{{#if portlet.psSysImage}}
{{#if portlet.psSysImage.imagePath}}imgPath="{{portlet.psSysImage.imagePath}}"{{else if portlet.psSysImage.cssClass}}iconClass="{{portlet.psSysImage.cssClass}}"{{/if}}
{{/if}}
{{#if portlet.psSysCss}}
class="{{portlet.psSysCss.cssName}}"
{{/if}}
{{#if (or portlet.width portlet.height)}}
style="{{#if portlet.width}}width: {{portlet.width}}px;{{/if}}{{#if portlet.height}}height: {{portlet.height}}px;{{/if}}"
{{/if}}
:context="state.context"
:viewParams="state.viewParams"
:viewSubject="state.viewSubject"
@ctrlEvent="onCtrlEvent"
/>
<AppFormTabpanel <AppFormTabpanel
name="{{item.codeName}}"
:visible="state.detailsModel.{{item.codeName}}.visible" :visible="state.detailsModel.{{item.codeName}}.visible"
:layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}" :layoutOpts="{{> @macro/front-end/common/layoutPos.hbs layout=formDetail.psLayout layoutPos=formDetail.psLayoutPos}}"
name={{item.name}}> name={{item.name}}>
......
...@@ -20,51 +20,52 @@ if (props.layoutOpts) { ...@@ -20,51 +20,52 @@ if (props.layoutOpts) {
} }
// 插槽类名和插槽样式,只有不绘制根元素的时候需要传递给插槽 // 插槽类名和插槽样式,只有不绘制根元素的时候需要传递给插槽
const attrs = useAttrs()
// 在template里写会丢失响应性,故封一个计算属性。 // 在template里写会丢失响应性,故封一个计算属性。
const attrs = useAttrs()
let slotStyle = computed(() => { let slotStyle = computed(() => {
// 有根元素无需传样式给插槽
if(!props.noRoot){
return ''
}
let result = ''; let result = '';
result += isObject(attrs.style ) ? styleObj2Str(attrs.style) : attrs.style; result += isObject(attrs.style) ? styleObj2Str(attrs.style) : attrs.style;
console.log(attrs.style) console.log(attrs.style)
console.log(result) console.log(result)
if(layout?.value?.colStyle){ if (layout?.value?.colStyle) {
result += layout.value.colStyle; result += layout.value.colStyle;
} }
result += props.visible == true ? "" : "display: none;"; result += props.visible == true ? "" : "display: none;";
return result; return result;
}); });
// 插槽类名
let slotClass = computed(()=>{ let slotClass = computed(() => {
let result = ''; // 有根元素无需传类名给插槽
if(!props.noRoot){
return ''
}
let result = 'app-col ';
result += attrs.class; result += attrs.class;
if(props.layoutOpts?.parentLayout == 'FLEX' && props.noRoot){ if (props.layoutOpts?.parentLayout == 'FLEX') {
result += " app-col app-col--flex"; result += " app-col--flex";
} }
return result; return result;
}) })
// 计算是否需要绘制根元素(layoutOpts不存在或者flex模式下noRoot为true时不绘制根元素)
let hasRoot = computed(()=>{
return props.layoutOpts !== undefined &&
( props.layoutOpts.parentLayout !== 'FLEX' || !props.noRoot );
})
</script> </script>
<template> <template>
<template v-if="!hasRoot"> <template v-if="layoutOpts">
<!-- 没有根元素的直接输出插槽 --> <!-- 有布局模式配置的 -->
<template v-if="layoutOpts.parentLayout == 'FLEX'">
<template v-if="noRoot">
<!-- Flex布局,没根元素时,需要把相关样式和类型传给插槽 -->
<slot :slotStyle="slotStyle" :slotClass="slotClass"></slot> <slot :slotStyle="slotStyle" :slotClass="slotClass"></slot>
</template> </template>
<div <div v-else v-show="visible" :style="layout.colStyle" class="app-col app-col--flex">
v-else-if="layoutOpts?.parentLayout == 'FLEX'" <slot :slotStyle="slotStyle" :slotClass="slotClass"></slot>
v-show="visible"
:style="layout.colStyle"
class="app-col app-col--flex"
>
<slot slotStyle="" slotClass="" ></slot>
</div> </div>
</template>
<a-col <a-col
v-else v-else
v-show="visible" v-show="visible"
...@@ -74,8 +75,18 @@ let hasRoot = computed(()=>{ ...@@ -74,8 +75,18 @@ let hasRoot = computed(()=>{
:sm="layout.colGridOpts.sm" :sm="layout.colGridOpts.sm"
class="app-col app-col--grid" class="app-col app-col--grid"
> >
<slot slotStyle="" slotClass=""></slot> <slot :slotStyle="slotStyle" :slotClass="slotClass"></slot>
</a-col> </a-col>
</template>
<template v-else>
<!-- 无布局模式配置,根据noRoot输出根元素 -->
<template v-if="noRoot">
<slot :slotStyle="slotStyle" :slotClass="slotClass"></slot>
</template>
<div v-else class="app-col">
<slot :slotStyle="slotStyle" :slotClass="slotClass"></slot>
</div>
</template>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -19,7 +19,7 @@ const props = withDefaults(defineProps<FormButtonProps>(), { ...@@ -19,7 +19,7 @@ const props = withDefaults(defineProps<FormButtonProps>(), {
</script> </script>
<template> <template>
<app-col :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formButton"> <AppCol :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formButton">
<template #default="{slotStyle, slotClass}"> <template #default="{slotStyle, slotClass}">
<a-button <a-button
:class="slotClass" :class="slotClass"
...@@ -28,7 +28,7 @@ const props = withDefaults(defineProps<FormButtonProps>(), { ...@@ -28,7 +28,7 @@ const props = withDefaults(defineProps<FormButtonProps>(), {
<AppIconText :class="labelCssName" :iconClass="iconClass" :imgPath="imagePath" :text="showCaption ? caption : '' "/> <AppIconText :class="labelCssName" :iconClass="iconClass" :imgPath="imagePath" :text="showCaption ? caption : '' "/>
</a-button> </a-button>
</template> </template>
</app-col> </AppCol>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -121,7 +121,7 @@ const viewEvent = (action:any) => { ...@@ -121,7 +121,7 @@ const viewEvent = (action:any) => {
</script> </script>
<template> <template>
<app-col noRoot :visible="visible" :layoutOpts="layoutOpts" :class="['app-form-druipart', `app-form-druipart-${name}`]"> <AppCol noRoot :visible="visible" :layoutOpts="layoutOpts" :class="['app-form-druipart', `app-form-druipart-${name}`]">
<template #default="{slotStyle, slotClass}"> <template #default="{slotStyle, slotClass}">
<a-card :class="slotClass" :style="slotStyle" :bordered="false"> <a-card :class="slotClass" :style="slotStyle" :bordered="false">
<template #title> <template #title>
...@@ -132,7 +132,7 @@ const viewEvent = (action:any) => { ...@@ -132,7 +132,7 @@ const viewEvent = (action:any) => {
<slot :context="druipartContext" :viewParams="druipartViewParams" :viewEvent="viewEvent" ></slot> <slot :context="druipartContext" :viewParams="druipartViewParams" :viewEvent="viewEvent" ></slot>
</a-card> </a-card>
</template> </template>
</app-col> </AppCol>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -37,7 +37,7 @@ const handleMenuGroupAction = ($event: IParam) => { ...@@ -37,7 +37,7 @@ const handleMenuGroupAction = ($event: IParam) => {
</script> </script>
<template> <template>
<app-col <AppCol
noRoot noRoot
:visible="visible" :visible="visible"
:layoutOpts="layoutOpts" :layoutOpts="layoutOpts"
...@@ -93,12 +93,12 @@ const handleMenuGroupAction = ($event: IParam) => { ...@@ -93,12 +93,12 @@ const handleMenuGroupAction = ($event: IParam) => {
</template> </template>
</template> </template>
</template> </template>
<app-row :layoutOpts="layoutOpts"> <AppRow :layoutOpts="layoutOpts">
<slot></slot> <slot></slot>
</app-row> </AppRow>
</a-card> </a-card>
</template> </template>
</app-col> </AppCol>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -14,9 +14,9 @@ const props = withDefaults(defineProps<FormIframeProps>(), { ...@@ -14,9 +14,9 @@ const props = withDefaults(defineProps<FormIframeProps>(), {
</script> </script>
<template> <template>
<app-col class="app-formDruipart" :visible="visible" :layoutOpts="layoutOpts" v-show="visible"> <AppCol class="app-formDruipart" :visible="visible" :layoutOpts="layoutOpts" v-show="visible">
<iframe class="app-formDruipart__iframe" :src="iFrameUrl" style="height: 100%;width: 100%;border: 0"></iframe> <iframe class="app-formDruipart__iframe" :src="iFrameUrl" style="height: 100%;width: 100%;border: 0"></iframe>
</app-col> </AppCol>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -42,7 +42,7 @@ const initRules = () => { ...@@ -42,7 +42,7 @@ const initRules = () => {
</script> </script>
<template> <template>
<app-col :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-form-item"> <AppCol :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-form-item">
<template v-slot:default="{slotStyle, slotClass}"> <template v-slot:default="{slotStyle, slotClass}">
<a-form-item <a-form-item
:class="slotClass" :class="slotClass"
...@@ -62,7 +62,7 @@ const initRules = () => { ...@@ -62,7 +62,7 @@ const initRules = () => {
<slot></slot> <slot></slot>
</a-form-item> </a-form-item>
</template> </template>
</app-col> </AppCol>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -13,9 +13,9 @@ const props = withDefaults(defineProps<FormPageProps>(), { ...@@ -13,9 +13,9 @@ const props = withDefaults(defineProps<FormPageProps>(), {
<template> <template>
<a-tab-pane class="app-formPage" :key="$attrs.key" :tab="tab"> <a-tab-pane class="app-formPage" :key="$attrs.key" :tab="tab">
<app-row :layoutOpts="layoutOpts"> <AppRow :layoutOpts="layoutOpts">
<slot></slot> <slot></slot>
</app-row> </AppRow>
</a-tab-pane> </a-tab-pane>
</template> </template>
......
...@@ -17,7 +17,7 @@ const props = withDefaults(defineProps<FormRawProps>(), { ...@@ -17,7 +17,7 @@ const props = withDefaults(defineProps<FormRawProps>(), {
</script> </script>
<template> <template>
<app-col :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formRaw"> <AppCol :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formRaw">
<template #default="{slotStyle, slotClass}"> <template #default="{slotStyle, slotClass}">
<AppRaw <AppRaw
:class="slotClass" :class="slotClass"
...@@ -27,7 +27,7 @@ const props = withDefaults(defineProps<FormRawProps>(), { ...@@ -27,7 +27,7 @@ const props = withDefaults(defineProps<FormRawProps>(), {
:contentType="contentType"> :contentType="contentType">
</AppRaw> </AppRaw>
</template> </template>
</app-col> </AppCol>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -16,9 +16,9 @@ const props = withDefaults(defineProps<FormTabPageProps>(), { ...@@ -16,9 +16,9 @@ const props = withDefaults(defineProps<FormTabPageProps>(), {
<template> <template>
<a-tab-pane class="app-formTabPage" v-show="visible" :tab="caption"> <a-tab-pane class="app-formTabPage" v-show="visible" :tab="caption">
<app-row :layoutOpts="layoutOpts"> <AppRow :layoutOpts="layoutOpts">
<slot></slot> <slot></slot>
</app-row> </AppRow>
</a-tab-pane> </a-tab-pane>
</template> </template>
......
...@@ -14,13 +14,13 @@ const props = withDefaults(defineProps<FormTabPanelProps>(), { ...@@ -14,13 +14,13 @@ const props = withDefaults(defineProps<FormTabPanelProps>(), {
</script> </script>
<template> <template>
<app-col :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formTabPanel"> <AppCol :visible="visible" noRoot :layoutOpts="layoutOpts" class="app-formTabPanel">
<template v-slot:default="{ slotStyle, slotClass }"> <template v-slot:default="{ slotStyle, slotClass }">
<a-tabs :class="slotClass" :style="slotStyle"> <a-tabs :class="slotClass" :style="slotStyle">
<slot></slot> <slot></slot>
</a-tabs> </a-tabs>
</template> </template>
</app-col> </AppCol>
</template> </template>
<style lang="scss"> <style lang="scss">
......
<script setup lang="ts">
import { ILayoutOpts } from "@core";
import { LayoutTool } from "@core/modules/common/layout-tool";
interface AppPortletCardProps {
layoutOpts: ILayoutOpts;
// 是否是容器,是容器的话需要在默认插槽外层适配布局
isContainer?: boolean;
showCaption?: boolean;
title?: string;
imgPath?: string;
iconClass?: string;
}
const props = withDefaults(defineProps<AppPortletCardProps>(), {
isContainer: false,
});
// 使用布局逻辑获得响应式的layout对象
const layout = LayoutTool.useLayout(toRef(props, "layoutOpts"));
</script>
<template>
<AppCol class="app-portletCard" :layoutOpts="layoutOpts">
<div class="app-portletCard__head">
<div class="app-portletCard__headLeft">
<slot name="header-left">
<AppIconText v-if="showCaption" :text="title" :imgPath="imgPath" :iconClass="iconClass"/>
</slot>
</div>
<div class="app-portletCard__headerRight">
<slot name="header-right"></slot>
</div>
</div>
<div class="app-portletCard__body">
<AppRow v-if="isContainer" :layoutOpts="layoutOpts">
<slot></slot>
</AppRow>
<template v-else >
<slot></slot>
</template>
</div>
</AppCol>
</template>
<style lang="scss">
</style>
\ No newline at end of file
...@@ -39,8 +39,6 @@ const { state, dashboard, onCtrlEvent } = new PortalView(viewState, props, emit) ...@@ -39,8 +39,6 @@ const { state, dashboard, onCtrlEvent } = new PortalView(viewState, props, emit)
<AppIconText <AppIconText
class="app-view__caption" class="app-view__caption"
size="large" size="large"
:subCaption="state.subCaption"
:showCaptionBar="state.showCaptionBar"
:text="state.viewCaption" :text="state.viewCaption"
/> />
</template> </template>
......
...@@ -4,23 +4,12 @@ import { Subject } from 'rxjs'; ...@@ -4,23 +4,12 @@ import { Subject } from 'rxjs';
import { ctrlState } from './{{spinalCase ctrl.codeName}}-dashboard-state'; import { ctrlState } from './{{spinalCase ctrl.codeName}}-dashboard-state';
import { DashboardControl, IActionParam, IParam, IContext } from '@core'; import { DashboardControl, IActionParam, IParam, IContext } from '@core';
{{#each ctrl.psControls as | control |}} {{#each ctrl.allPortlets as | control |}}
{{#eq control.portletType "CONTAINER"}} {{#if control.psAppDataEntity}}
{{#each control.psControls as | control2 |}} import { {{codeName}}Portlet } from '@widgets/{{spinalCase control.psAppDataEntity.codeName}}/{{spinalCase codeName}}-portlet';
{{#if control2.psAppDataEntity}}
import { {{codeName}}Portlet } from '@widgets/{{spinalCase control2.psAppDataEntity.codeName}}/{{spinalCase codeName}}-portlet';
{{else}} {{else}}
import { {{codeName}}Portlet } from '@widgets/app/{{spinalCase codeName}}-portlet'; import { {{codeName}}Portlet } from '@widgets/app/{{spinalCase codeName}}-portlet';
{{/if}} {{/if}}
{{/each}}
{{/eq}}
{{#neq control.portletType "CONTAINER"}}
{{#if control.psAppDataEntity}}
import { {{codeName}}Portlet } from '@widgets/{{spinalCase control.psAppDataEntity.codeName}}/{{spinalCase codeName}}-portlet';
{{else}}
import { {{codeName}}Portlet } from '@widgets/app/{{spinalCase codeName}}-portlet';
{{/if}}
{{/neq}}
{{/each}} {{/each}}
interface Props { interface Props {
...@@ -50,7 +39,13 @@ defineExpose({ name, state }); ...@@ -50,7 +39,13 @@ defineExpose({ name, state });
<template> <template>
<div class="app-dashboard{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}"> <div class="app-dashboard{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}">
<template v-if="!state.isEnableCustomized"> <template v-if="!state.isEnableCustomized">
{{>(lookup 'DASHBOARD') ctrl=ctrl}} {{#each ctrl.psControls as |portlet|}}
{{#eq portlet.portletType 'CONTAINER'}}
{{>(lookup 'PORTLET_CONTAINER') portlet=portlet}}
{{else}}
{{>(lookup 'PORTLET') portlet=portlet}}
{{/eq}}
{{/each}}
</template> </template>
</div> </div>
</template> </template>
......
...@@ -2,16 +2,7 @@ ...@@ -2,16 +2,7 @@
export const ctrlState = { export const ctrlState = {
controlCodeName: '{{ctrl.codeName}}', controlCodeName: '{{ctrl.codeName}}',
controlName: '{{ctrl.name}}', controlName: '{{ctrl.name}}',
showTitleBar: {{#if ctrl.showTitleBar}}true{{else}}false{{/if}},
title: '{{ctrl.title}}',
portletType: '{{ctrl.portletType}}', portletType: '{{ctrl.portletType}}',
{{#if ctrl.psSysImage}}
{{#if ctrl.psSysImage.cssClass}}
iconcls: '{{ctrl.psSysImage.cssClass}}',
{{else if (ctrl.psSysImage.imagePath)}}
imgPath: '{{ctrl.psSysImage.imagePath}}',
{{/if}}
{{/if}}
{{#if ctrl.psLayoutPos.height}} {{#if ctrl.psLayoutPos.height}}
// 部件高度 // 部件高度
height: {{ctrl.psLayoutPos.height}}, height: {{ctrl.psLayoutPos.height}},
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { ctrlState } from './{{spinalCase ctrl.codeName}}-portlet-state'; import { ctrlState } from './{{spinalCase ctrl.codeName}}-portlet-state';
import { PortletControl, IActionParam, IParam, IContext } from '@core'; import { PortletControl, IActionParam, IParam, IContext } from '@core';
// 引入视图start {{!-- 引入视图start --}}
{{#if (eq ctrl.portletType "VIEW")}} {{#if (eq ctrl.portletType "VIEW")}}
{{#if ctrl.portletPSAppView}} {{#if ctrl.portletPSAppView}}
import {{ctrl.portletPSAppView.codeName}} from '@views/{{spinalCase ctrl.portletPSAppView.psAppModule.codeName}}/{{spinalCase ctrl.portletPSAppView.codeName}}'; import {{ctrl.portletPSAppView.codeName}} from '@views/{{spinalCase ctrl.portletPSAppView.psAppModule.codeName}}/{{spinalCase ctrl.portletPSAppView.codeName}}';
{{/if}} {{/if}}
{{/if}} {{/if}}
// 引入视图end {{!-- 引入视图end --}}
// 引入菜单start {{!-- 引入菜单start --}}
{{#if (eq ctrl.portletType "APPMENU")}} {{#if (eq ctrl.portletType "APPMENU")}}
{{#each ctrl.psControls as | control |}} {{#each ctrl.psControls as | control |}}
{{#eq control.controlType "APPMENU"}} {{#eq control.controlType "APPMENU"}}
...@@ -17,7 +17,7 @@ import { {{control.codeName}}Menu } from '@widgets/app/{{spinalCase control.code ...@@ -17,7 +17,7 @@ import { {{control.codeName}}Menu } from '@widgets/app/{{spinalCase control.code
{{/eq}} {{/eq}}
{{/each}} {{/each}}
{{/if}} {{/if}}
// 引入菜单end {{!-- 引入菜单end --}}
interface Props { interface Props {
...@@ -25,10 +25,27 @@ interface Props { ...@@ -25,10 +25,27 @@ interface Props {
context: IContext; context: IContext;
viewParams?: IParam; viewParams?: IParam;
viewSubject: Subject<IActionParam>; viewSubject: Subject<IActionParam>;
showCaption?: boolean;
title?: string;
imgPath?: string;
iconClass?: string;
} }
const props = withDefaults(defineProps < Props > (), { const props = withDefaults(defineProps < Props > (), {
viewSubject: () => new Subject < IActionParam > (), viewSubject: () => new Subject < IActionParam > (),
{{#if ctrl.title}}
title: '{{ctrl.title}}',
{{/if}}
{{#if ctrl.showTitleBar}}
showCaption: '{{ctrl.showTitleBar}}',
{{/if}}
{{#if ctrl.psSysImage}}
{{#if ctrl.psSysImage.cssClass}}
iconcls: '{{ctrl.psSysImage.cssClass}}',
{{else if (ctrl.psSysImage.imagePath)}}
imgPath: '{{ctrl.psSysImage.imagePath}}',
{{/if}}
{{/if}}
}) })
// emit声明 // emit声明
...@@ -45,14 +62,17 @@ const { name, state, onViewEvent, onCtrlEvent, handleItemClick, handleActionClic ...@@ -45,14 +62,17 @@ const { name, state, onViewEvent, onCtrlEvent, handleItemClick, handleActionClic
defineExpose({ name, state }); defineExpose({ name, state });
</script> </script>
<template> <template>
<div class="app-portlet{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}" > <AppPortletCard
<template v-if="state.showTitleBar && state.title"> class="app-portlet{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}"
<div class='portlet-title'> :title="title"
<span> :iconClass="iconClass"
<i v-if="state.iconcls" :class="state.iconcls" /> :imgPath="imgPath"
<img v-if="state.imagePath" :src="state.imagePath" /> :showCaption="showCaption"
\{{state.title}} {{#if (or ctrl.width ctrl.height)}}
</span> style="{{#if ctrl.width}}width: {{ctrl.width}}px;{{/if}}{{#if ctrl.height}}height: {{ctrl.height}}px;{{/if}}"
{{/if}}
>
<template #header-right>
<span class="portlet-action" v-if="state.actionBarModelData && state.portletType !== 'ACTIONBAR'"> <span class="portlet-action" v-if="state.actionBarModelData && state.portletType !== 'ACTIONBAR'">
<template v-for="(item,index) in Object.values(state.actionBarModelData)" :key="index"> <template v-for="(item,index) in Object.values(state.actionBarModelData)" :key="index">
<a-tooltip> <a-tooltip>
...@@ -67,9 +87,7 @@ defineExpose({ name, state }); ...@@ -67,9 +87,7 @@ defineExpose({ name, state });
</a-tooltip> </a-tooltip>
</template> </template>
</span> </span>
</div>
</template> </template>
<div :class="{'portlet-with-title': state.showTitleBar, 'portlet-without-title': !state.showTitleBar}">
{{#if (eq ctrl.portletType 'VIEW') }} {{#if (eq ctrl.portletType 'VIEW') }}
<{{ctrl.portletPSAppView.codeName}} <{{ctrl.portletPSAppView.codeName}}
:context="state.context" :context="state.context"
...@@ -102,7 +120,7 @@ defineExpose({ name, state }); ...@@ -102,7 +120,7 @@ defineExpose({ name, state });
{{else if (eq ctrl.portletType 'TOOLBAR')}} {{else if (eq ctrl.portletType 'TOOLBAR')}}
<div>暂未支持工具栏绘制</div> <div>暂未支持工具栏绘制</div>
{{else if (eq ctrl.portletType 'HTML')}} {{else if (eq ctrl.portletType 'HTML')}}
<iframe :src="state.pageUrl" :style="{height: state.height && state.height > 0 ? state.height + 'px' : '400px', width: '100%', borderWidth: '0px'}"></iframe> <iframe :src="state.pageUrl" :style="{height: state.height && state.height > 0 ? '100%' : '400px', width: '100%', borderWidth: '0px'}"></iframe>
{{else if (eq ctrl.portletType 'RAWITEM')}} {{else if (eq ctrl.portletType 'RAWITEM')}}
<app-raw <app-raw
:name="state.controlName" :name="state.controlName"
...@@ -111,11 +129,10 @@ defineExpose({ name, state }); ...@@ -111,11 +129,10 @@ defineExpose({ name, state });
:imgPath="state.imagePath" :imgPath="state.imagePath"
style="{{#if ctrl.rawItemHeight}}height: {{ctrl.rawItemHeight}}px;{{/if}}{{#if ctrl.rawItemWidth}}width: {{ctrl.rawItemWidth}}px{{/if}}" style="{{#if ctrl.rawItemHeight}}height: {{ctrl.rawItemHeight}}px;{{/if}}{{#if ctrl.rawItemWidth}}width: {{ctrl.rawItemWidth}}px{{/if}}"
{{#if (eq ctrl.contentType 'RAW')}}value="{{ctrl.rawContent}}"{{else if (eq ctrl.contentType 'HTML')}}:value="`{{ctrl.htmlContent}}`"{{/if}} {{#if (eq ctrl.contentType 'RAW')}}value="{{ctrl.rawContent}}"{{else if (eq ctrl.contentType 'HTML')}}:value="`{{ctrl.htmlContent}}`"{{/if}}
></app-raw>> ></app-raw>
{{else}} {{else}}
{{/if}} {{/if}}
</div> </AppPortletCard>
</div>
</template> </template>
<style lang="scss"> <style lang="scss">
</style> </style>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册