提交 f797cd88 编写于 作者: tony001's avatar tony001

补充表单按钮权限

上级 41670877
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
${item.render.code} ${item.render.code}
<#else> <#else>
<@badge item> <@badge item>
<i-button type="primary" @click="${item.getName()}_click($event)"<#if item.getPSSysCss?? && item.getPSSysCss()??> class="${item.getPSSysCss().getCssName()}"</#if> <i-button type="primary" :disabled="detailsModel.${item.getName()}.disabled" @click="${item.getName()}_click($event)"<#if item.getPSSysCss?? && item.getPSSysCss()??> class="${item.getPSSysCss().getCssName()}"</#if>
style="<#if item.getHeight() gt 0>height: ${item.getHeight()?c}px;</#if><#if item.getWidth() gt 0>width: ${item.getWidth()?c}px;</#if>"> style="<#if item.getHeight() gt 0>height: ${item.getHeight()?c}px;</#if><#if item.getWidth() gt 0>width: ${item.getWidth()?c}px;</#if>">
<#if item.getPSSysImage()??><#assign img=item.getPSSysImage()><#if img.getCssClass()?? && (img.getCssClass()?length gt 0)><i class="${img.getCssClass()}" style="margin-right: 2px;"></i></#if></#if> <#if item.getPSSysImage()??><#assign img=item.getPSSysImage()><#if img.getCssClass()?? && (img.getCssClass()?length gt 0)><i class="${img.getCssClass()}" style="margin-right: 2px;"></i></#if></#if>
<#if item.isShowCaption()><span ><#if item.getCaptionItemName()?? && item.getCaptionItemName()?length gt 0>{{data.${item.getCaptionItemName()}}}<#else><#if langbase??>{{$t('${langbase}.details.${item.name}')}}<#else>${item.getCaption()}</#if></#if></span></#if> <#if item.isShowCaption()><span ><#if item.getCaptionItemName()?? && item.getCaptionItemName()?length gt 0>{{data.${item.getCaptionItemName()}}}<#else><#if langbase??>{{$t('${langbase}.details.${item.name}')}}<#else>${item.getCaption()}</#if></#if></span></#if>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<#assign detail>caption: '${item.getCaption()}', detailType: '${item.getDetailType()}', name: '${item.getName()}', visible: <#if item.getPSDEFDGroupLogic('PANELVISIBLE')??>false<#else>true</#if>, isShowCaption: ${item.isShowCaption()?c}, form: this, isControlledContent: <#if item.getShowMoreMode?? && item.getShowMoreMode()?? && item.getShowMoreMode() == 1>true<#else>false</#if> </#assign> <#assign detail>caption: '${item.getCaption()}', detailType: '${item.getDetailType()}', name: '${item.getName()}', visible: <#if item.getPSDEFDGroupLogic('PANELVISIBLE')??>false<#else>true</#if>, isShowCaption: ${item.isShowCaption()?c}, form: this, isControlledContent: <#if item.getShowMoreMode?? && item.getShowMoreMode()?? && item.getShowMoreMode() == 1>true<#else>false</#if> </#assign>
<#if item.getDetailType() == 'BUTTON'> <#if item.getDetailType() == 'BUTTON'>
new FormButtonModel({ ${detail},disabled: false<#if item.getPSUIAction()??><#assign uiaction=item.getPSUIAction()>, uiaction: { type: '${uiaction.getUIActionType()}', new FormButtonModel({ ${detail},disabled: false<#if item.getPSUIAction()??><#assign uiaction=item.getPSUIAction()>, uiaction: { type: '${uiaction.getUIActionType()}',
tag: '${uiaction.getUIActionTag()}'<#if (uiaction.getActionTarget()!="")>,noprivdisplaymode:<#if uiaction.getNoPrivDisplayMode(view)??>${uiaction.getNoPrivDisplayMode(view)}</#if>,dataaccaction:'<#if uiaction.getDataAccessAction()??>${uiaction.getDataAccessAction()}</#if>', actiontarget: '${uiaction.getActionTarget()}'</#if> }</#if> }) tag: '${uiaction.getUIActionTag()}'<#if (uiaction.getActionTarget()!="")>,actiontarget: '${uiaction.getActionTarget()}'</#if><#if uiaction.getNoPrivDisplayMode(view)??>,noprivdisplaymode:${uiaction.getNoPrivDisplayMode(view)}</#if><#if uiaction.getDataAccessAction()??>,dataaccaction:'${uiaction.getDataAccessAction()}'</#if>,visabled: true,disabled: false}</#if> })
<#elseif item.getDetailType() == 'DRUIPART'> <#elseif item.getDetailType() == 'DRUIPART'>
new FormDRUIPartModel({ ${detail} }) new FormDRUIPartModel({ ${detail} })
<#elseif item.getDetailType() == 'FORMITEM'> <#elseif item.getDetailType() == 'FORMITEM'>
......
...@@ -730,6 +730,26 @@ import schema from 'async-validator'; ...@@ -730,6 +730,26 @@ import schema from 'async-validator';
this.data[name] = value; this.data[name] = value;
} }
/**
* 计算表单按钮权限状态
*
* @param {*} [data] 传入数据
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public computeButtonState(data:any){
let targetData:any = this.transformData(data);
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].detailType,"BUTTON")){
let tempUIAction:any = JSON.parse(JSON.stringify(this.detailsModel[name].uiaction));
ViewTool.calcActionItemAuthState(targetData,[tempUIAction],this.appUIService);
this.detailsModel[name].visible = tempUIAction.visabled;
this.detailsModel[name].disabled = tempUIAction.disabled;
}
})
}
}
<#list ctrl.getAllPSDEFormDetails() as formdetail> <#list ctrl.getAllPSDEFormDetails() as formdetail>
<#if formdetail.getDetailType?? && formdetail.getDetailType() == 'BUTTON'> <#if formdetail.getDetailType?? && formdetail.getDetailType() == 'BUTTON'>
<#if formdetail.getActionType?? && formdetail.getActionType()??> <#if formdetail.getActionType?? && formdetail.getActionType()??>
...@@ -1024,6 +1044,7 @@ import schema from 'async-validator'; ...@@ -1024,6 +1044,7 @@ import schema from 'async-validator';
const data = response.data; const data = response.data;
this.onFormLoad(data,'load'); this.onFormLoad(data,'load');
this.$emit('load', data); this.$emit('load', data);
this.computeButtonState(data);
this.$nextTick(() => { this.$nextTick(() => {
this.formState.next({ type: 'load', data: data }); this.formState.next({ type: 'load', data: data });
}); });
...@@ -1074,6 +1095,7 @@ import schema from 'async-validator'; ...@@ -1074,6 +1095,7 @@ import schema from 'async-validator';
</#list> </#list>
data.${appde.getCodeName()?lower_case} = null; data.${appde.getCodeName()?lower_case} = null;
this.$emit('load', data); this.$emit('load', data);
this.computeButtonState(data);
this.$nextTick(() => { this.$nextTick(() => {
this.formState.next({ type: 'load', data: data }); this.formState.next({ type: 'load', data: data });
}); });
...@@ -1131,6 +1153,7 @@ import schema from 'async-validator'; ...@@ -1131,6 +1153,7 @@ import schema from 'async-validator';
const data = response.data; const data = response.data;
this.onFormLoad(data,'autoSave'); this.onFormLoad(data,'autoSave');
this.$emit('save', data); this.$emit('save', data);
this.computeButtonState(data);
<#if ctrl.getControlType() == 'FORM'> <#if ctrl.getControlType() == 'FORM'>
AppCenterService.notifyMessage({name:"${ctrl.getPSAppDataEntity().getCodeName()}",action:'appRefresh',data:data}); AppCenterService.notifyMessage({name:"${ctrl.getPSAppDataEntity().getCodeName()}",action:'appRefresh',data:data});
</#if> </#if>
...@@ -1217,6 +1240,7 @@ import schema from 'async-validator'; ...@@ -1217,6 +1240,7 @@ import schema from 'async-validator';
const data = response.data; const data = response.data;
this.onFormLoad(data,'save'); this.onFormLoad(data,'save');
this.$emit('save', data); this.$emit('save', data);
this.computeButtonState(data);
<#if ctrl.getControlType() == 'FORM'> <#if ctrl.getControlType() == 'FORM'>
AppCenterService.notifyMessage({name:"${ctrl.getPSAppDataEntity().getCodeName()}",action:'appRefresh',data:data}); AppCenterService.notifyMessage({name:"${ctrl.getPSAppDataEntity().getCodeName()}",action:'appRefresh',data:data});
</#if> </#if>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册