提交 a464e732 编写于 作者: KK's avatar KK

动态编辑--fix2

上级 89855dfc
<#if view.hasPSControl('form')> <#if view.hasPSControl('form')>
<#assign view_content>
<#assign view_content> <#assign view_content>
<component <component
:is="activeForm.name" :is="activeForm.name"
...@@ -25,7 +24,6 @@ ...@@ -25,7 +24,6 @@
@closeview="closeView($event)"> @closeview="closeView($event)">
</component> </component>
</#assign> </#assign>
</#assign>
<#assign view_footer> <#assign view_footer>
<div class="wf_btn"> <div class="wf_btn">
<ion-button v-for="(linkItem,index) in linkModel" :key="index" @click="dynamic_toolbar_click(linkItem, $event)" class="wf_btn_item"> <ion-button v-for="(linkItem,index) in linkModel" :key="index" @click="dynamic_toolbar_click(linkItem, $event)" class="wf_btn_item">
......
...@@ -125,155 +125,7 @@ import { toastController, alertController } from '@ionic/core'; ...@@ -125,155 +125,7 @@ import { toastController, alertController } from '@ionic/core';
</#list> </#list>
</#if> </#if>
}; };
/**
* 工具栏模型数据
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public linkModel:Array<any> = [];
/**
* 激活表单
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public activeForm:any = {};
/**
* 所有表单数据
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public allForm: any = {
<#if view.getAllPSControls?? && view.getAllPSControls()??>
<#list view.getAllPSControls() as singleControl>
<#if singleControl.getControlType?? && singleControl.getControlType()?? && singleControl.getControlType() != "TOOLBAR">
"${singleControl.getName()}":{name:"view_${singleControl.getName()}",autosave:"${singleControl.isEnableAutoSave()?c}",showBusyIndicator:"${singleControl.isShowBusyIndicator()?c}",updateAction:"<#if singleControl.getUpdatePSControlAction()?? && singleControl.getUpdatePSControlAction().getPSAppDEMethod()??>${singleControl.getUpdatePSControlAction().getPSAppDEMethod().getCodeName()}</#if>",removeAction:"<#if singleControl.getRemovePSControlAction()?? && singleControl.getRemovePSControlAction().getPSAppDEMethod()??>${singleControl.getRemovePSControlAction().getPSAppDEMethod().getCodeName()}</#if>",loaddraftAction:"<#if singleControl.getGetDraftPSControlAction()?? && singleControl.getGetDraftPSControlAction().getPSAppDEMethod()??>${singleControl.getGetDraftPSControlAction().getPSAppDEMethod().getCodeName()}</#if>",loadAction:"<#if singleControl.getGetPSControlAction()?? && singleControl.getGetPSControlAction().getPSAppDEMethod()??>${singleControl.getGetPSControlAction().getPSAppDEMethod().getCodeName()}</#if>",createAction:"<#if singleControl.getCreatePSControlAction()?? && singleControl.getCreatePSControlAction().getPSAppDEMethod()??>${singleControl.getCreatePSControlAction().getPSAppDEMethod().getCodeName()}</#if>",WFSubmitAction:"<#if singleControl.getWFSubmitPSControlAction()?? && singleControl.getWFSubmitPSControlAction().getPSAppDEMethod()??>${singleControl.getWFSubmitPSControlAction().getPSAppDEMethod().getCodeName()}</#if>",WFStartAction:"<#if singleControl.getWFStartPSControlAction()?? && singleControl.getWFStartPSControlAction().getPSAppDEMethod()??>${singleControl.getWFStartPSControlAction().getPSAppDEMethod().getCodeName()}</#if>"}<#if singleControl_has_next>,</#if>
</#if>
</#list>
</#if>
};
/**
* 视图引用数据
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public viewRefData:any = {
<#if view.getPSAppViewRefs?? && view.getPSAppViewRefs()??>
<#list view.getPSAppViewRefs() as viewRef>
<#if viewRef.getName?? && viewRef.getName()?? && viewRef.getRefPSAppView?? && viewRef.getRefPSAppView()??>
<#assign refAppView = viewRef.getRefPSAppView() />
"${viewRef.getName()}":{viewname:"${srffilepath2(refAppView.getCodeName())}",title:"<#if refAppView.getPSAppDataEntity()??>entities.${refAppView.getPSAppDataEntity().getCodeName()?lower_case}.views.${refAppView.getPSDEViewCodeName()?lower_case}.caption<#else>app.views.${refAppView.getCodeName()?lower_case}.caption</#if>", width: <#if refAppView.getWidth?? && refAppView.getWidth() gt 0>${refAppView.getWidth()?c}<#else>800</#if>, height: <#if refAppView.getHeight?? && refAppView.getHeight() gt 0>${refAppView.getHeight()?c}<#else>500</#if>}<#if viewRef_has_next>,</#if>
</#if>
</#list>
</#if>
};
/**
* 获取工具栏按钮
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public getWFLinkModel():Promise<any>{
return new Promise((resolve:any, reject:any) =>{
let datas: any[] = [];
if(Object.keys(this.viewparams).length > 0){
Object.assign(datas,{'taskDefinitionKey':this.viewparams.userTaskId});
}
this.appEntityService.GetWFLink(JSON.parse(JSON.stringify(this.context)),datas,true).then((response:any) =>{
if (response && response.status === 200) {
this.linkModel = response.data;
if(response.headers && response.headers['process-form']){
this.computeActivedForm(response.headers['process-form']);
}else{
this.computeActivedForm(null);
}
resolve(response.data);
}
}).catch((response: any) => {
if (response && response.status) {
this.$Notice.error({ title: '错误', desc: response.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
});
}
/**
* 计算激活表单
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public computeActivedForm(inputForm:any){
if(!inputForm){
this.activeForm = this.allForm && Object.values(this.allForm)[0];
return;
}
if(this.allForm && Object.keys(this.allForm).length >0){
Object.keys(this.allForm).forEach((name:string) =>{
<#noparse>if(Object.is(name,`wfform_${inputForm.toLowerCase()}`)){</#noparse>
this.activeForm = this.allForm[name];
}
})
}
}
/**
* 动态工具栏点击
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public dynamic_toolbar_click(linkItem:any, $event:any){
let datas: any[] = [];
let xData: any = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
const submit:Function = (submitData:any,linkItem:any) =>{
xData.wfsubmit(submitData,linkItem).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if (this.viewdata) {
this.$emit('viewdataschange', [{ ..._data }]);
this.$emit('close');
} else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
}
});
}
if(linkItem && linkItem.sequenceflowview && <#noparse>this.viewRefData[`WFACTION@${linkItem.sequenceflowview}`]</#noparse>){
let tempContext:any = Util.deepCopy(this.context);
Object.assign(tempContext,{${appde.getCodeName()?lower_case}:datas && datas[0].srfkey});
let tempViewParam:any = {actionView:linkItem.sequenceflowview,actionForm:linkItem.sequenceflowform};
let targetView:any = <#noparse>this.viewRefData[`WFACTION@${linkItem.sequenceflowview}`];</#noparse>
const appmodal = this.$appmodal.openModal({viewname:targetView.viewname, title:(this.$t(targetView.title) as string), height: targetView.height, width: targetView.width}, tempContext,tempViewParam);
appmodal.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
let tempSubmitData:any = Util.deepCopy(datas);
tempSubmitData.forEach((element:any) => {
Object.assign(element,result.datas && result.datas[0]);
});
submit(tempSubmitData,linkItem);
});
}else{
submit(datas,linkItem);
}
}
</#assign> </#assign>
<#ibizinclude> <#ibizinclude>
../@MACRO/VIEW-BASE.vue.ftl ../@MACRO/VIEW-BASE.vue.ftl
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册