提交 42e76af7 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新

上级 8e0f8f66
<#ibizinclude>
../../@VIEW/@MACRO/VIEW_LAYOUTPANEL/VIEW_LAYOUTPANEL_RENDER.ftl
</#ibizinclude>
<template>
<#if ctrl.render??>
${ctrl.render.code}
<#else>
<#if ctrl.getLayoutMode()?? && ctrl.getLayoutMode() == "FLEX">
<div class="app-layoutpanel ${ctrl.getCodeName()}<#if ctrl.getPSSysCss?? && ctrl.getPSSysCss()??> ${ctrl.getPSSysCss().getCssName()}</#if>" v-loading="isLayoutLoadding" :style="{width: <#if ctrl.getWidth()?? && ctrl.getWidth() gt 0>'${ctrl.getWidth()?c}px'<#else>'100%'</#if>, height: <#if ctrl.getHeight() gt 0>'${ctrl.getHeight()?c}px'<#else>'100%'</#if>, 'display': 'flex', 'flex-direction': 'column'}">
<#else>
<div class="app-layoutpanel ${ctrl.getCodeName()}<#if ctrl.getPSSysCss?? && ctrl.getPSSysCss()??> ${ctrl.getPSSysCss().getCssName()}</#if>" v-loading="isLayoutLoadding" :style="{width: <#if ctrl.getWidth()?? && ctrl.getWidth() gt 0>'${ctrl.getWidth()?c}px'<#else>'100%'</#if>, height: <#if ctrl.getHeight() gt 0>'${ctrl.getHeight()?c}px'<#else>'100%'</#if>, overflow: 'auto'}">
</#if>
<#if ctrl.getRootPSPanelItems()??>
<template v-show="!isLayoutLoadding">
<#list ctrl.getRootPSPanelItems() as panelDetail>
<@renderByDetailType panelDetail ctrl false/>
</#list>
</template>
</#if>
</div>
<#if ctrl.getLayoutMode()=='FLEX'>
<row class="app-layoutpanel <#if ctrl.getPSSysCss?? && ctrl.getPSSysCss()??><#assign singleCss = ctrl.getPSSysCss()> ${singleCss.getCssName()}</#if>" style="width:<#if ctrl.getWidth()?? && ctrl.getWidth() gt 0>${ctrl.getWidth()?c}px<#else>100%</#if>;height:<#if ctrl.getHeight() gt 0>${ctrl.getHeight()?c}px;<#else>100%;</#if>display: flex;">
<@ibizindent blank=8>
<#if ctrl.getRootPSPanelItems()??>
<#list ctrl.getRootPSPanelItems() as item>
${P.getPartCode(item).code}
</#list>
</#if>
</template>
\ No newline at end of file
</@ibizindent>
</row>
<#else>
<row class="app-layoutpanel <#if ctrl.getPSSysCss?? && ctrl.getPSSysCss()??><#assign singleCss = ctrl.getPSSysCss()> ${singleCss.getCssName()}</#if>" style="width:<#if ctrl.getWidth()?? && ctrl.getWidth() gt 0>${ctrl.getWidth()?c}px<#else>100%</#if>;height:<#if ctrl.getHeight() gt 0>${ctrl.getHeight()?c}px<#else>100%</#if>;">
<@ibizindent blank=8>
<#if ctrl.getRootPSPanelItems()??>
<#list ctrl.getRootPSPanelItems() as item>
${P.getPartCode(item).code}
</#list>
</#if>
</@ibizindent>
</row>
</#if>
</#if>
\ No newline at end of file
${P.getPartCode(item,'PANEL').code}
<template>
${P.getPartCode(item,'PANEL').code}
</template>
<#assign import_block>
import { PanelDetailModel,PanelRawitemModel,PanelTabPanelModel,PanelTabPageModel,PanelFieldModel,PanelContainerModel,PanelControlModel,PanelUserControlModel,PanelButtonModel } from '@/model/panel-detail';
import ${srfclassname('${ctrl.codeName}')}Model from './${srffilepath2(ctrl.codeName)}-${ctrl.getControlType()?lower_case}-model';
......@@ -7,9 +9,6 @@ import UIService from '@/uiservice/ui-service';
</#assign>
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl
</#ibizinclude>
<#ibizinclude>
../../@MACRO/PANEL.ftl
</#ibizinclude>
/**
......@@ -19,10 +18,10 @@ import UIService from '@/uiservice/ui-service';
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
getDatas(): any[] {
if (!this.layoutData) {
if (!this.panelData) {
return [];
}
return [this.layoutData];
return [this.panelData];
}
/**
......@@ -32,7 +31,7 @@ import UIService from '@/uiservice/ui-service';
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
getData() {
return this.layoutData;
return this.panelData;
}
/**
......@@ -67,6 +66,22 @@ import UIService from '@/uiservice/ui-service';
*/
public data:any = {};
/**
* 面板数据对象
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public panelData:any = null;
/**
* 视图布局数据
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public layoutData:any = {};
/**
* 数据模型对象
*
......@@ -102,29 +117,15 @@ import UIService from '@/uiservice/ui-service';
</#if>
/**
* 布局面板顶级成员名称
* 详情模型集合
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public rootLayoutDetailNames: string[] = <@compress single_line=true>[
<#if ctrlgetRootPSPanelItems?? && ctrl.getRootPSPanelItems()??>
<#list ctrl.getRootPSPanelItems() as panelItem>
'${panelItem.name}'<#if panelItem_has_next>,</#if>
public detailsModel: any = {
<#list ctrl.getAllPSPanelItems() as panelItem>
${panelItem.name}: ${P.getPartCode(panelItem, 'ITEM_MODEL').code},
</#list>
</#if>
];</@compress>
/**
* 布局面板项模型对象
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public layoutItems:any = {
<#list ctrl.getAllPSPanelItems() as panelItem>
<#-- <@getPanelItemModel panelItem 'ITEMLAYOUT'/> -->
</#list>
};
/**
......@@ -155,7 +156,7 @@ import UIService from '@/uiservice/ui-service';
public onInputDataChange(newVal: any, oldVal: any){
if(newVal){
this.computedUIData(newVal);
this.layoutData = Util.deepCopy(newVal);
this.panelData = Util.deepCopy(newVal);
this.computeButtonState(newVal);
this.panelLogic({ name: '', newVal: null, oldVal: null });
this.$forceUpdate();
......@@ -186,21 +187,21 @@ import UIService from '@/uiservice/ui-service';
// 若为项布局面板,存在parentRef
if(this.parentRef){
let targetData:any = this.parentRef.transformData(data);
if(this.layoutModelDetails && Object.keys(this.layoutModelDetails).length >0){
Object.keys(this.layoutModelDetails).forEach((name:any) =>{
if(this.layoutModelDetails[name] && this.layoutModelDetails[name].uiAction && this.layoutModelDetails[name].uiAction.dataAccaction && Object.is(this.layoutModelDetails[name].itemType,"BUTTON")){
let tempUIAction:any = JSON.parse(JSON.stringify(this.layoutModelDetails[name].uiAction));
let result: any[] = ViewTool.calcActionItemAuthState(targetData, [tempUIAction], this.appUIService ? this.appUIService : null);
this.layoutModelDetails[name].visible = tempUIAction.visabled;
this.layoutModelDetails[name].disabled = tempUIAction.disabled;
if(this.detailsModel && Object.keys(this.detailsModel).length >0){
Object.keys(this.detailsModel).forEach((name:any) =>{
if(this.detailsModel[name] && this.detailsModel[name].uiaction && this.detailsModel[name].uiaction.dataaccaction && Object.is(this.detailsModel[name].itemType,"BUTTON")){
this.detailsModel[name].isPower = true;
let tempUIAction:any = JSON.parse(JSON.stringify(this.detailsModel[name].uiaction));
let result: any[] = ViewTool.calcActionItemAuthState(targetData,[tempUIAction],this.appUIService?this.appUIService:null);
this.detailsModel[name].visible = tempUIAction.visabled;
this.detailsModel[name].disabled = tempUIAction.disabled;
this.detailsModel[name].isPower = result[0] === 1 ? true : false;
}
})
}
}
}
<@panelBase ctrl>
/**
* 界面行为
*
......@@ -272,21 +273,22 @@ import UIService from '@/uiservice/ui-service';
}
/**
* 处理值改变
*
* @public
* @memberof ${srfclassname('${view.name}')}Base
* 设置变更面板编辑项的值
*
* @param data 面板数据
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public handleValueChange(args: { name: string, value: any }): void {
if (!args || !args.name || Object.is(args.name, '') || !this.layoutData.hasOwnProperty(args.name)) {
public onPanelItemValueChange(data: any,$event: { name: string, value: any }): void {
if (!$event) {
return;
}
const { name, value } = args;
this.data[name] = value;
this.layoutData[name] = value;
this.layoutModelDetails[name].setData(value);
this.panelLogic(name);
this.panelEditItemChange(this.data, name, value);
if (!$event.name || Object.is($event.name, '') || !data.hasOwnProperty($event.name)) {
return;
}
data[$event.name] = $event.value;
this.panelEditItemChange(data, $event.name, $event.value);
}
/**
......@@ -312,17 +314,26 @@ import UIService from '@/uiservice/ui-service';
}
/**
* 分页切换事件
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public handleTabPanelClick(name:string,$event:any){
this.detailsModel[name].clickPage($event.name);
}
/**
* 面板逻辑
*
* @public
* @param name
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public panelLogic(name: string): void {
<#list ctrl.getAllPSPanelItems() as panelItem>
<#-- <@panelItemLogic panelItem> -->
</#list>
public panelLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
<#if P.getPartCode(item,'PANEL_LOGIC').code?length gt 0>
${P.getPartCode(item,'PANEL_LOGIC').code}
</#if>
}
<#ibizinclude>
......
<#macro getPanelItemModel panelItem type>
<#assign detail>
name: '${panelItem.getName()}',
type: '${type}',
caption: '${panelItem.getCaption()}',
<#if panelItem.getTitleBarCloseMode?? && panelItem.getTitleBarCloseMode()??>titleBarCloseMode: ${panelItem.getTitleBarCloseMode()},</#if>
isShowCaption: <#if panelItem.isShowCaption?? && panelItem.isShowCaption()??>${panelItem.isShowCaption()?c}</#if>,
sysCss: '<#if panelItem.getPSSysCss?? && panelItem.getPSSysCss()??>${panelItem.getPSSysCss().getCssName()}</#if>',
itemType: '${panelItem.getItemType()}',
itemStyle: '${panelItem.getItemStyle()}',
<#if panelItem.getPSSysImage?? && panelItem.getPSSysImage()??>sysImage:{
iconcls: '<#if panelItem.getPSSysImage().getCssClass?? && panelItem.getPSSysImage().getCssClass()??>${panelItem.getPSSysImage().getCssClass()}</#if>',
imagePath:'<#if panelItem.getPSSysImage().getImagePath?? && panelItem.getPSSysImage().getImagePath()??>${panelItem.getPSSysImage().getImagePath()}</#if>',
rawContent: '<#if panelItem.getPSSysImage().getRawContent?? && panelItem.getPSSysImage().getRawContent()??>${panelItem.getPSSysImage().getRawContent()}</#if>'
},</#if>
visible: <#if panelItem.getPSPanelItemGroupLogic('PANELVISIBLE')??>false<#else>true</#if>,
disabled: false,
layout:'<#if panelItem.getPSLayout?? && panelItem.getPSLayout()?? && panelItem.getPSLayout().getLayout?? && panelItem.getPSLayout().getLayout()??>${panelItem.getPSLayout().getLayout()}</#if>',
layoutPos:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getLayoutPos?? && panelItem.getPSLayoutPos().getLayoutPos()??>${panelItem.getPSLayoutPos().getLayoutPos()}</#if>',
layoutHeight:<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getHeight?? && panelItem.getPSLayoutPos().getHeight()??>${panelItem.getPSLayoutPos().getHeight()}<#else>0</#if>,
heightMode:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getHeightMode?? && panelItem.getPSLayoutPos().getHeightMode()??>${panelItem.getPSLayoutPos().getHeightMode()}</#if>',
layoutWidth:<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getWidth?? && panelItem.getPSLayoutPos().getWidth()??>${panelItem.getPSLayoutPos().getWidth()}<#else>0</#if>,
widthMode:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getWidthMode?? && panelItem.getPSLayoutPos().getWidthMode()??>${panelItem.getPSLayoutPos().getWidthMode()}</#if>',
spacingBottom:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getSpacingBottom?? && panelItem.getPSLayoutPos().getSpacingBottom()??>${panelItem.getPSLayoutPos().getSpacingBottom()}</#if>',
spacingLeft:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getSpacingLeft?? && panelItem.getPSLayoutPos().getSpacingLeft()??>${panelItem.getPSLayoutPos().getSpacingLeft()}</#if>',
spacingRight:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getSpacingRight?? && panelItem.getPSLayoutPos().getSpacingRight()??>${panelItem.getPSLayoutPos().getSpacingRight()}</#if>',
spacingTop:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getSpacingTop?? && panelItem.getPSLayoutPos().getSpacingTop()??>${panelItem.getPSLayoutPos().getSpacingTop()}</#if>',
hAlignSelf:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getHAlignSelf?? && panelItem.getPSLayoutPos().getHAlignSelf()??>${panelItem.getPSLayoutPos().getHAlignSelf()}</#if>',
vAlignSelf:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getVAlignSelf?? && panelItem.getPSLayoutPos().getVAlignSelf()??>${panelItem.getPSLayoutPos().getVAlignSelf()}</#if>',
flexGrow:<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getGrow?? && panelItem.getPSLayoutPos().getGrow()??>${panelItem.getPSLayoutPos().getGrow()}<#else>0</#if>,
flexParams:{align:'<#if panelItem.getFlexAlign?? && panelItem.getFlexAlign()??>${panelItem.getFlexAlign()}</#if>',dir:'<#if panelItem.getFlexDir?? && panelItem.getFlexDir()??>${panelItem.getFlexDir()}</#if>',vAlign:'<#if panelItem.getFlexVAlign?? && panelItem.getFlexVAlign()??>${panelItem.getFlexVAlign()}</#if>'},
<#if panelItem.getParentPSPanelItem?? && panelItem.getParentPSPanelItem()??>
parentName: '${panelItem.getParentPSPanelItem().getName()}',
</#if>
panel: this
</#assign>
<#if panelItem.getItemType() == 'CONTAINER'>
<@compress single_line=true>${panelItem.name}:{ ${detail}
<#if panelItem.getPSPanelItems()??>,
details:[<#list panelItem.getPSPanelItems() as childPanelItem>'${childPanelItem.getName()}'<#if childPanelItem_has_next>,</#if></#list>]
</#if>
<#if panelItem.getDataRegionType()??>,
dataRegionType: '${panelItem.getDataRegionType()}'
</#if>
<#if panelItem.getDataSourceType()??>,
dataSourceType: '${panelItem.getDataSourceType()}'
</#if>
<#if panelItem.getPSAppDataEntity?? && panelItem.getPSAppDataEntity()??>,
appDataEntityCodeName: '${panelItem.getPSAppDataEntity().getCodeName()?lower_case}'
</#if>
<#if panelItem.getPSAppDEMethod?? && panelItem.getPSAppDEMethod()??>,
appDEMethodCodeName: '${panelItem.getPSAppDEMethod().getCodeName()}'
</#if>
}<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'RAWITEM'>
<#assign rawItem>
viewType: '${view.getViewType()}',
predefinedType: '${panelItem.getPSRawItem().getPredefinedType()}',
contentType: '${panelItem.getPSRawItem().getContentType()}',
contentStyle: '${panelItem.getPSRawItem().getCssStyle()}',
rawContent: '<#if panelItem.getRawContent?? && panelItem.getRawContent()??>${panelItem.getRawContent()}</#if>',
htmlContent: '<#if panelItem.getHtmlContent?? && panelItem.getHtmlContent()??>${panelItem.getHtmlContent()}</#if>',
<#if panelItem.getPSRawItem().getRenderMode?? && panelItem.getPSRawItem().getRenderMode()??>
renderMode: '${panelItem.getPSRawItem().getRenderMode()}',
</#if>
</#assign>
<@compress single_line=true>${panelItem.name}:{ ${detail}, ${rawItem} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'FIELD'>
<#assign field>
<#if panelItem.getFieldStates?? && panelItem.getFieldStates()??>
fieldState: '${panelItem.getFieldStates()}',
</#if>
<#if panelItem.getPSEditor?? && panelItem.getPSEditor()??>
<#if panelItem.getPSEditor().getPredefinedType?? && panelItem.getPSEditor().getPredefinedType()??>
predefinedType: '${panelItem.getPSEditor().getPredefinedType()}',
</#if>
<#if panelItem.getPSEditor().getRenderMode?? && panelItem.getPSEditor().getRenderMode()??>
renderMode: '${panelItem.getPSEditor().getRenderMode()}',
</#if>
</#if>
<#if panelItem.getViewFieldName?? && panelItem.getViewFieldName()??>
dataItemName:'${panelItem.getViewFieldName()}',
</#if>
</#assign>
<@compress single_line=true>${panelItem.name}:{ ${detail}, ${field} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'CONTROL'>
<@compress single_line=true>${panelItem.name}:{ ${detail} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'BUTTON'>
<#assign button>
<#if panelItem.getButtonStyle?? && panelItem.getButtonStyle()??>
buttonStyle: '${panelItem.getButtonStyle()}',
</#if>
iconAlign: '${panelItem.getIconAlign()}',
<#if panelItem.getPSUIAction?? && panelItem.getPSUIAction()??>
<#if panelItem.getPSUIAction().getPredefinedType?? && panelItem.getPSUIAction().getPredefinedType()??>
predefinedType: '${panelItem.getPSUIAction().getPredefinedType()}',
</#if>
</#if>
<#if panelItem.getRenderMode?? && panelItem.getRenderMode()??>
renderMode: '${panelItem.getRenderMode()}',
</#if>
</#assign>
<@compress single_line=true>${panelItem.name}:{ ${detail}, ${button} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'USERCONTROL'>
<@compress single_line=true>${panelItem.name}:{ ${detail} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'TABPANEL'>
<@compress single_line=true>${panelItem.name}:{ ${detail}<#if panelItem.getPSPanelTabPages()??>,
details:[<#list panelItem.getPSPanelTabPages() as tabpage>'${tabpage.getName()}'<#if tabpage_has_next>,</#if></#list>]</#if> }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'CTRLPOS'>
<@compress single_line=true>${panelItem.name}:{ ${detail} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'TABPAGE'>
<@compress single_line=true>${panelItem.name}:{ ${detail}<#if panelItem.getPSPanelItems()??>,
details:[<#list panelItem.getPSPanelItems() as childPanelItem>'${childPanelItem.getName()}'<#if childPanelItem_has_next>,</#if></#list>]</#if>}<#if panelItem_has_next>,</#if></@compress>
</#if>
</#macro>
<#macro panelBase item>
/**
* 布局面板是否加载
*
* @public
* @memberof ${srfclassname('${item.name}')}Base
*/
public isLayoutLoadding: boolean = true;
/**
* 布局面板数据
*
* @public
* @memberof ${srfclassname('${item.name}')}Base
*/
public layoutData:any = {};
/**
* 布局面板模型对象
*
* @public
* @memberof ${srfclassname('${item.name}')}Base
*/
public layoutModelDetails:any = {};
/**
* 初始化布局
*
* @public
* @memberof ${srfclassname('${item.name}')}Base
*/
public async initLayout() {
if (this.rootLayoutDetailNames.length > 0) {
for (let i = 0; i < this.rootLayoutDetailNames.length; i++) {
const name = this.rootLayoutDetailNames[i];
const rootItem = this.layoutItems[name];
if (!rootItem) {
return;
}
await this.initLayoutItem(rootItem);
}
}
return true;
}
/**
* 初始化布局项
*
* @public
* @memberof ${srfclassname('${item.name}')}Base
*/
public async initLayoutItem(layoutModelItem: any, index: number = 0) {
const { name } = layoutModelItem;
const layoutModelDetail = Util.getLayoutItemInstance(layoutModelItem);
if (!index) {
await layoutModelDetail.load(this.context, this.viewparams);
this.$set(this.layoutModelDetails, name, layoutModelDetail);
this.$set(this.layoutData, name, layoutModelDetail.getData());
} else {
layoutModelDetail.setIndex(index);
await layoutModelDetail.load(this.context, this.viewparams);
<#noparse>this.$set(this.layoutModelDetails, `${name}_${index}`, layoutModelDetail);</#noparse>
<#noparse>this.$set(this.layoutData, `${name}_${index}`, layoutModelDetail.getData());</#noparse>
}
if (layoutModelDetail && layoutModelDetail.details) {
if (layoutModelDetail.dataRegionType === 'MULTIDATA') {
const multiData = layoutModelDetail.getData();
if (multiData && multiData.length > 0) {
for (let i = 0; i < multiData.length; i++) {
for (let j = 0; j < layoutModelDetail.details.length; j++) {
const key = layoutModelDetail.details[j];
if (this.layoutItems[key]) {
await this.initLayoutItem(this.layoutItems[key], i);
}
}
}
}
} else {
for (let i = 0; i < layoutModelDetail.details.length; i++) {
const key = layoutModelDetail.details[i];
if (this.layoutItems[key]) {
await this.initLayoutItem(this.layoutItems[key],index);
}
}
}
}
}
</#macro>
<#macro panelLogic item>
<@compress single_line=true>
<#if item.getLogicType() == 'GROUP'>
<#if item.isNotMode()>
!(
</#if>
<#if item.getPSPanelItemLogics()??>
<#list item.getPSPanelItemLogics() as subLogic>
<#if subLogic_index gt 0>
<#if item.getGroupOP() == 'AND'>
&&
</#if>
<#if item.getGroupOP() == 'OR'>
||
</#if>
</#if>
<@panelLogic subLogic/>
</#list>
</#if>
<#if item.isNotMode()>
)
</#if>
<#elseif item.getLogicType() == 'SINGLE'>
this.$verify.testCond(_${item.getDstModelField()?lower_case}, "${item.getCondOp()}", "${item.getValue()}")
</#if>
</@compress>
</#macro>
<#macro panelItemLogic panelItem>
<#if panelItem.getPSPanelItemGroupLogic('ITEMBLANK')??>
<#assign ITEMBLANK = panelItem.getPSPanelItemGroupLogic('ITEMBLANK')/>
if (Object.is(name, '')<#if ITEMBLANK.getRelatedItemNames()??><#list ITEMBLANK.getRelatedItemNames() as detailName> || Object.is(name, '${detailName}')</#list></#if>) {
let ret = true;
<#if ITEMBLANK.getRelatedItemNames()??>
<#list ITEMBLANK.getRelatedItemNames() as detailName>
const _${detailName} = this.layoutData['${detailName}'];
</#list>
</#if>
if (<@panelLogic ITEMBLANK/>) {
ret = false;
}
this.layoutModelDetails['${panelItem.name}'].required = ret;
}
</#if>
<#if panelItem.getPSPanelItemGroupLogic('ITEMENABLE')??>
<#assign ITEMENABLE = panelItem.getPSPanelItemGroupLogic('ITEMENABLE')/>
if (Object.is(name, '')<#if ITEMENABLE.getRelatedItemNames()??><#list ITEMENABLE.getRelatedItemNames() as detailName> || Object.is(name, '${detailName}')</#list></#if>) {
let ret = false;
<#if ITEMENABLE.getRelatedItemNames()??>
<#list ITEMENABLE.getRelatedItemNames() as detailName>
const _${detailName} = this.layoutData['${detailName}'];
</#list>
</#if>
if (<@panelLogic ITEMENABLE/>) {
ret = true;
}
this.layoutModelDetails['${panelItem.name}'].disabled = !ret;
}
</#if>
<#if panelItem.getPSPanelItemGroupLogic('PANELVISIBLE')??>
<#assign PANELVISIBLE = panelItem.getPSPanelItemGroupLogic('PANELVISIBLE')/>
if (Object.is(name, '')<#if PANELVISIBLE.getRelatedItemNames()??><#list PANELVISIBLE.getRelatedItemNames() as detailName> || Object.is(name, '${detailName}')</#list></#if>) {
let ret = false;
<#if PANELVISIBLE.getRelatedItemNames()??>
<#list PANELVISIBLE.getRelatedItemNames() as detailName>
const _${detailName} = this.layoutData['${detailName}'];
</#list>
</#if>
if (<@panelLogic PANELVISIBLE/>) {
ret = true;
}
this.layoutModelDetails['${panelItem.name}'].visible = ret;
}
</#if>
</#macro>
\ No newline at end of file
......@@ -2,7 +2,7 @@
./VIEW_LAYOUTPANEL/VIEW_LAYOUTPANEL_UIACTION/VIEW_LAYOUTPANEL_UIACTION.ftl
</#ibizinclude>
<#ibizinclude>
../../@MACRO/PANEL.ftl
./VIEW_LAYOUTPANEL/VIEW_LAYOUTPANEL_LOGIC.ftl
</#ibizinclude>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
......@@ -340,11 +340,234 @@ ${P.getCtrlCode('toolbar', 'CONTROL.vue').code}
*/
public layoutItems:any = {
<#list view.getPSViewLayoutPanel().getAllPSPanelItems() as panelItem>
<#-- <@getPanelItemModel panelItem 'VIEWLAYOUT'/> -->
<#assign detail>
name: '${panelItem.getName()}',
type: 'VIEWLAYOUT',
caption: '${panelItem.getCaption()}',
<#if panelItem.getTitleBarCloseMode?? && panelItem.getTitleBarCloseMode()??>titleBarCloseMode: ${panelItem.getTitleBarCloseMode()},</#if>
isShowCaption: <#if panelItem.isShowCaption?? && panelItem.isShowCaption()??>${panelItem.isShowCaption()?c}</#if>,
sysCss: '<#if panelItem.getPSSysCss?? && panelItem.getPSSysCss()??>${panelItem.getPSSysCss().getCssName()}</#if>',
itemType: '${panelItem.getItemType()}',
itemStyle: '${panelItem.getItemStyle()}',
<#if panelItem.getPSSysImage?? && panelItem.getPSSysImage()??>sysImage:{
iconcls: '<#if panelItem.getPSSysImage().getCssClass?? && panelItem.getPSSysImage().getCssClass()??>${panelItem.getPSSysImage().getCssClass()}</#if>',
imagePath:'<#if panelItem.getPSSysImage().getImagePath?? && panelItem.getPSSysImage().getImagePath()??>${panelItem.getPSSysImage().getImagePath()}</#if>',
rawContent: '<#if panelItem.getPSSysImage().getRawContent?? && panelItem.getPSSysImage().getRawContent()??>${panelItem.getPSSysImage().getRawContent()}</#if>'
},</#if>
visible: <#if panelItem.getPSPanelItemGroupLogic('PANELVISIBLE')??>false<#else>true</#if>,
disabled: false,
layout:'<#if panelItem.getPSLayout?? && panelItem.getPSLayout()?? && panelItem.getPSLayout().getLayout?? && panelItem.getPSLayout().getLayout()??>${panelItem.getPSLayout().getLayout()}</#if>',
layoutPos:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getLayoutPos?? && panelItem.getPSLayoutPos().getLayoutPos()??>${panelItem.getPSLayoutPos().getLayoutPos()}</#if>',
layoutHeight:<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getHeight?? && panelItem.getPSLayoutPos().getHeight()??>${panelItem.getPSLayoutPos().getHeight()}<#else>0</#if>,
heightMode:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getHeightMode?? && panelItem.getPSLayoutPos().getHeightMode()??>${panelItem.getPSLayoutPos().getHeightMode()}</#if>',
layoutWidth:<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getWidth?? && panelItem.getPSLayoutPos().getWidth()??>${panelItem.getPSLayoutPos().getWidth()}<#else>0</#if>,
widthMode:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getWidthMode?? && panelItem.getPSLayoutPos().getWidthMode()??>${panelItem.getPSLayoutPos().getWidthMode()}</#if>',
spacingBottom:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getSpacingBottom?? && panelItem.getPSLayoutPos().getSpacingBottom()??>${panelItem.getPSLayoutPos().getSpacingBottom()}</#if>',
spacingLeft:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getSpacingLeft?? && panelItem.getPSLayoutPos().getSpacingLeft()??>${panelItem.getPSLayoutPos().getSpacingLeft()}</#if>',
spacingRight:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getSpacingRight?? && panelItem.getPSLayoutPos().getSpacingRight()??>${panelItem.getPSLayoutPos().getSpacingRight()}</#if>',
spacingTop:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getSpacingTop?? && panelItem.getPSLayoutPos().getSpacingTop()??>${panelItem.getPSLayoutPos().getSpacingTop()}</#if>',
hAlignSelf:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getHAlignSelf?? && panelItem.getPSLayoutPos().getHAlignSelf()??>${panelItem.getPSLayoutPos().getHAlignSelf()}</#if>',
vAlignSelf:'<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getVAlignSelf?? && panelItem.getPSLayoutPos().getVAlignSelf()??>${panelItem.getPSLayoutPos().getVAlignSelf()}</#if>',
flexGrow:<#if panelItem.getPSLayoutPos?? && panelItem.getPSLayoutPos()?? && panelItem.getPSLayoutPos().getGrow?? && panelItem.getPSLayoutPos().getGrow()??>${panelItem.getPSLayoutPos().getGrow()}<#else>0</#if>,
flexParams:{align:'<#if panelItem.getFlexAlign?? && panelItem.getFlexAlign()??>${panelItem.getFlexAlign()}</#if>',dir:'<#if panelItem.getFlexDir?? && panelItem.getFlexDir()??>${panelItem.getFlexDir()}</#if>',vAlign:'<#if panelItem.getFlexVAlign?? && panelItem.getFlexVAlign()??>${panelItem.getFlexVAlign()}</#if>'},
<#if panelItem.getParentPSPanelItem?? && panelItem.getParentPSPanelItem()??>
parentName: '${panelItem.getParentPSPanelItem().getName()}',
</#if>
panel: this
</#assign>
<#if panelItem.getItemType() == 'CONTAINER'>
<@compress single_line=true>${panelItem.name}:{ ${detail}
<#if panelItem.getPSPanelItems()??>,
details:[<#list panelItem.getPSPanelItems() as childPanelItem>'${childPanelItem.getName()}'<#if childPanelItem_has_next>,</#if></#list>]
</#if>
<#if panelItem.getDataRegionType()??>,
dataRegionType: '${panelItem.getDataRegionType()}'
</#if>
<#if panelItem.getDataSourceType()??>,
dataSourceType: '${panelItem.getDataSourceType()}'
</#if>
<#if panelItem.getPSAppDataEntity?? && panelItem.getPSAppDataEntity()??>,
appDataEntityCodeName: '${panelItem.getPSAppDataEntity().getCodeName()?lower_case}'
</#if>
<#if panelItem.getPSAppDEMethod?? && panelItem.getPSAppDEMethod()??>,
appDEMethodCodeName: '${panelItem.getPSAppDEMethod().getCodeName()}'
</#if>
}<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'RAWITEM'>
<#assign rawItem>
viewType: '${view.getViewType()}',
predefinedType: '${panelItem.getPSRawItem().getPredefinedType()}',
contentType: '${panelItem.getPSRawItem().getContentType()}',
contentStyle: '${panelItem.getPSRawItem().getCssStyle()}',
rawContent: '<#if panelItem.getRawContent?? && panelItem.getRawContent()??>${panelItem.getRawContent()}</#if>',
htmlContent: '<#if panelItem.getHtmlContent?? && panelItem.getHtmlContent()??>${panelItem.getHtmlContent()}</#if>',
<#if panelItem.getPSRawItem().getRenderMode?? && panelItem.getPSRawItem().getRenderMode()??>
renderMode: '${panelItem.getPSRawItem().getRenderMode()}',
</#if>
<#if panelItem.getPSRawItem()?? && panelItem.getPSRawItem().getWrapMode?? && panelItem.getPSRawItem().getWrapMode()??>
wrapMode:'${panelItem.getPSRawItem().getWrapMode()}',
</#if>
<#if panelItem.getPSRawItem()?? && panelItem.getPSRawItem().getVAlign?? && panelItem.getPSRawItem().getVAlign()??>
vAlign:'${panelItem.getPSRawItem().getVAlign()}',
</#if>
<#if panelItem.getPSRawItem()?? && panelItem.getPSRawItem().getHAlign?? && panelItem.getPSRawItem().getHAlign()??>
hAlign:'${panelItem.getPSRawItem().getHAlign()}',
</#if>
</#assign>
<@compress single_line=true>${panelItem.name}:{ ${detail}, ${rawItem} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'FIELD'>
<#assign field>
<#if panelItem.getFieldStates?? && panelItem.getFieldStates()??>
fieldState: '${panelItem.getFieldStates()}',
</#if>
<#if panelItem.getPSEditor?? && panelItem.getPSEditor()??>
<#if panelItem.getPSEditor().getPredefinedType?? && panelItem.getPSEditor().getPredefinedType()??>
predefinedType: '${panelItem.getPSEditor().getPredefinedType()}',
</#if>
<#if panelItem.getPSEditor().getRenderMode?? && panelItem.getPSEditor().getRenderMode()??>
renderMode: '${panelItem.getPSEditor().getRenderMode()}',
</#if>
</#if>
<#if panelItem.getViewFieldName?? && panelItem.getViewFieldName()??>
dataItemName:'${panelItem.getViewFieldName()}',
</#if>
<#if panelItem.getEditorType?? && panelItem.getEditorType()?? && (panelItem.getEditorType() == "SPAN")>
<#if panelItem.getPSEditor?? && panelItem.getPSEditor()??>
<#assign panelEditor = panelItem.getPSEditor() />
<#if panelEditor.getWrapMode?? && panelEditor.getWrapMode()??>
wrapMode:'${panelEditor.getWrapMode()}',
</#if>
<#if panelEditor.getVAlign?? && panelEditor.getVAlign()??>
vAlign:'${panelEditor.getVAlign()}',
</#if>
<#if panelEditor.getHAlign?? && panelEditor.getHAlign()??>
hAlign:'${panelEditor.getHAlign()}',
</#if>
</#if>
</#if>
</#assign>
<@compress single_line=true>${panelItem.name}:{ ${detail}, ${field} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'CONTROL'>
<@compress single_line=true>${panelItem.name}:{ ${detail} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'BUTTON'>
<#assign button>
<#if panelItem.getButtonStyle?? && panelItem.getButtonStyle()??>
buttonStyle: '${panelItem.getButtonStyle()}',
</#if>
<#if panelItem.getBorderStyle?? && panelItem.getBorderStyle()??>
borderStyle: '${panelItem.getBorderStyle()}',
</#if>
iconAlign: '${panelItem.getIconAlign()}',
<#if panelItem.getPSUIAction?? && panelItem.getPSUIAction()??>
<#if panelItem.getPSUIAction().getPredefinedType?? && panelItem.getPSUIAction().getPredefinedType()??>
predefinedType: '${panelItem.getPSUIAction().getPredefinedType()}',
</#if>
</#if>
<#if panelItem.getRenderMode?? && panelItem.getRenderMode()??>
renderMode: '${panelItem.getRenderMode()}',
</#if>
</#assign>
<@compress single_line=true>${panelItem.name}:{ ${detail}, ${button} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'USERCONTROL'>
<@compress single_line=true>${panelItem.name}:{ ${detail} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'TABPANEL'>
<@compress single_line=true>${panelItem.name}:{ ${detail}<#if panelItem.getPSPanelTabPages()??>,
details:[<#list panelItem.getPSPanelTabPages() as tabpage>'${tabpage.getName()}'<#if tabpage_has_next>,</#if></#list>]</#if> }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'CTRLPOS'>
<@compress single_line=true>${panelItem.name}:{ ${detail} }<#if panelItem_has_next>,</#if></@compress>
<#elseif panelItem.getItemType() == 'TABPAGE'>
<@compress single_line=true>${panelItem.name}:{ ${detail}<#if panelItem.getPSPanelItems()??>,
details:[<#list panelItem.getPSPanelItems() as childPanelItem>'${childPanelItem.getName()}'<#if childPanelItem_has_next>,</#if></#list>]</#if>}<#if panelItem_has_next>,</#if></@compress>
</#if>
</#list>
};
<@panelBase view>
/**
* 视图布局是否加载
*
* @public
* @memberof ${srfclassname('${view.name}')}Base
*/
public isLayoutLoadding: boolean = true;
/**
* 视图布局数据
*
* @public
* @memberof ${srfclassname('${view.name}')}Base
*/
public layoutData:any = {};
/**
* 视图布局面板模型对象
*
* @public
* @memberof ${srfclassname('${view.name}')}Base
*/
public layoutModelDetails:any = {};
/**
* 初始化布局
*
* @public
* @memberof ${srfclassname('${view.name}')}Base
*/
public async initLayout() {
if (this.rootLayoutDetailNames.length > 0) {
for (let i = 0; i < this.rootLayoutDetailNames.length; i++) {
const name = this.rootLayoutDetailNames[i];
const rootItem = this.layoutItems[name];
if (!rootItem) {
return;
}
await this.initLayoutItem(rootItem);
}
}
return true;
}
/**
* 初始化布局项
*
* @public
* @memberof ${srfclassname('${view.name}')}Base
*/
public async initLayoutItem(layoutModelItem: any, index: number = 0) {
const { name } = layoutModelItem;
const layoutModelDetail = Util.getLayoutItemInstance(layoutModelItem);
if (!index) {
await layoutModelDetail.load(this.context, this.viewparams);
this.$set(this.layoutModelDetails, name, layoutModelDetail);
this.$set(this.layoutData, name, layoutModelDetail.getData());
} else {
layoutModelDetail.setIndex(index);
await layoutModelDetail.load(this.context, this.viewparams);
<#noparse>this.$set(this.layoutModelDetails, `${name}_${index}`, layoutModelDetail);</#noparse>
<#noparse>this.$set(this.layoutData, `${name}_${index}`, layoutModelDetail.getData());</#noparse>
}
if (layoutModelDetail && layoutModelDetail.details) {
if (layoutModelDetail.dataRegionType === 'MULTIDATA') {
const multiData = layoutModelDetail.getData();
if (multiData && multiData.length > 0) {
for (let i = 0; i < multiData.length; i++) {
for (let j = 0; j < layoutModelDetail.details.length; j++) {
const key = layoutModelDetail.details[j];
if (this.layoutItems[key]) {
await this.initLayoutItem(this.layoutItems[key], i);
}
}
}
}
} else {
for (let i = 0; i < layoutModelDetail.details.length; i++) {
const key = layoutModelDetail.details[i];
if (this.layoutItems[key]) {
await this.initLayoutItem(this.layoutItems[key],index);
}
}
}
}
}
/**
* 处理值改变
......@@ -370,7 +593,51 @@ ${P.getCtrlCode('toolbar', 'CONTROL.vue').code}
*/
public panelLogic(name: string): void {
<#list view.getPSViewLayoutPanel().getAllPSPanelItems() as panelItem>
<#-- <@panelItemLogic panelItem> -->
<#if panelItem.getPSPanelItemGroupLogic('ITEMBLANK')??>
<#assign ITEMBLANK = panelItem.getPSPanelItemGroupLogic('ITEMBLANK')/>
if (Object.is(name, '')<#if ITEMBLANK.getRelatedItemNames()??><#list ITEMBLANK.getRelatedItemNames() as detailName> || Object.is(name, '${detailName}')</#list></#if>) {
let ret = true;
<#if ITEMBLANK.getRelatedItemNames()??>
<#list ITEMBLANK.getRelatedItemNames() as detailName>
const _${detailName} = this.layoutData['${detailName}'];
</#list>
</#if>
if (<@panelLogic ITEMBLANK/>) {
ret = false;
}
this.layoutModelDetails['${panelItem.name}'].required = ret;
}
</#if>
<#if panelItem.getPSPanelItemGroupLogic('ITEMENABLE')??>
<#assign ITEMENABLE = panelItem.getPSPanelItemGroupLogic('ITEMENABLE')/>
if (Object.is(name, '')<#if ITEMENABLE.getRelatedItemNames()??><#list ITEMENABLE.getRelatedItemNames() as detailName> || Object.is(name, '${detailName}')</#list></#if>) {
let ret = false;
<#if ITEMENABLE.getRelatedItemNames()??>
<#list ITEMENABLE.getRelatedItemNames() as detailName>
const _${detailName} = this.layoutData['${detailName}'];
</#list>
</#if>
if (<@panelLogic ITEMENABLE/>) {
ret = true;
}
this.layoutModelDetails['${panelItem.name}'].disabled = !ret;
}
</#if>
<#if panelItem.getPSPanelItemGroupLogic('PANELVISIBLE')??>
<#assign PANELVISIBLE = panelItem.getPSPanelItemGroupLogic('PANELVISIBLE')/>
if (Object.is(name, '')<#if PANELVISIBLE.getRelatedItemNames()??><#list PANELVISIBLE.getRelatedItemNames() as detailName> || Object.is(name, '${detailName}')</#list></#if>) {
let ret = false;
<#if PANELVISIBLE.getRelatedItemNames()??>
<#list PANELVISIBLE.getRelatedItemNames() as detailName>
const _${detailName} = this.layoutData['${detailName}'];
</#list>
</#if>
if (<@panelLogic PANELVISIBLE/>) {
ret = true;
}
this.layoutModelDetails['${panelItem.name}'].visible = ret;
}
</#if>
</#list>
}
......
<#macro panelLogic item>
<@compress single_line=true>
<#if item.getLogicType() == 'GROUP'>
<#if item.isNotMode()>
!(
</#if>
<#if item.getPSPanelItemLogics()??>
<#list item.getPSPanelItemLogics() as subLogic>
<#if subLogic_index gt 0>
<#if item.getGroupOP() == 'AND'>
&&
</#if>
<#if item.getGroupOP() == 'OR'>
||
</#if>
</#if>
<@panelLogic subLogic/>
</#list>
</#if>
<#if item.isNotMode()>
)
</#if>
<#elseif item.getLogicType() == 'SINGLE'>
this.$verify.testCond(_${item.getDstModelField()?lower_case}, "${item.getCondOp()}", "${item.getValue()}")
</#if>
</@compress>
</#macro>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册