提交 f3f17739 编写于 作者: Mosher's avatar Mosher

update:更新

上级 3f759fc9
......@@ -4,6 +4,15 @@
<#ibizinclude>
../@MACRO/VIEW_CAPTION.vue.ftl
</#ibizinclude>
<div slot="extra">
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600" v-for="(linkItem, index) in linkModel" :key="index">
<i-button @click="dynamic_toolbar_click(linkItem, $event)">
<span class='caption'>{{linkItem.sequenceFlowName}}</span>
</i-button>
<div slot='content'>{{linkItem.sequenceFlowName}}</div>
</tooltip>
</div>
</div>
</card>
</div>
\ No newline at end of file
<#assign self_content>
/**
* 工具栏模型数据
*
* @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:this.$t("<#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: {} = {};
if (Object.keys(this.viewparams).length > 0) {
Object.assign(datas, { 'processDefinitionKey': this.viewparams.processDefinitionKey });
Object.assign(datas, { 'taskDefinitionKey': this.viewparams.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>
<#ibizinclude>
../@MACRO/VIEW-BASE.vue.ftl
</#ibizinclude>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册