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

update:更新工作流辅助功能

上级 0c2ad0f6
......@@ -13,6 +13,28 @@
*/
public activeForm:any = {};
/**
* 工作流附加功能类型映射关系对象
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public wfAddiFeatureRef: any = {
// 转办
"reassign": { featureTag: "REASSIGN", action: "TransFerTask" },
// 前加签
"addstepbefore": { featureTag: "ADDSTEPBEFORE", action: "BeforeSign" },
// 后加签
"addstepafter": { featureTag: "ADDSTEPAFTER", action: "AfterSign" },
// 回退
"sendback": { featureTag: "SENDBACK", action: "SendBack" },
// 抄送
"sendcopy": { featureTag: "SENDCOPY", action: "sendCopy" },
// 补充信息
"supplyinfo": { featureTag: "SUPPLYINFO", action: "supplyInfo" },
// 征求意见
"takeadvice": { featureTag: "TAKEADVICE", action: "takeAdvice" }
};
/**
* 所有表单数据
*
......@@ -124,25 +146,107 @@
}
});
}
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')) {
const submitAction: Function = () => {
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);
}
}
if (linkItem && linkItem.type) {
if (Object.is(linkItem.type, "finish")) {
submitAction();
} else {
this.handleWFAddiFeature(linkItem, datas);
}
} else {
submitAction();
}
}
/**
* 处理工作流辅助功能
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public handleWFAddiFeature(linkItem: any, data: any) {
let featureTag: string = this.wfAddiFeatureRef[linkItem.type].featureTag;
if (!featureTag) return;
<#noparse>let targetView: any = this.viewRefData[`WFUTILACTION@${featureTag}`];</#noparse>
if (!targetView) {
<#noparse>this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: `未找到${featureTag}映射视图` });</#noparse>
return;
}
let tempContext: any = Util.deepCopy(this.context);
Object.assign(tempContext,{${appde.getCodeName()?lower_case}:datas && datas[0].srfkey});
let tempViewParam: any = { actionForm: linkItem.sequenceflowform };
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(data[0]);
if (result.datas && result.datas[0]) {
const resultData: any = result.datas[0];
if (Object.keys(resultData).length > 0) {
let tempData: any = {};
Object.keys(resultData).forEach((key: any) => {
if (resultData[key] && (key !== "srfuf")) tempData[key] = resultData[key];
})
Object.assign(tempSubmitData, tempData);
}
this.submitWFAddiFeature(linkItem, tempSubmitData);
}
});
}
/**
* 提交工作流辅助功能
*
* @memberof ${srfclassname('${view.codeName}')}Base
*/
public submitWFAddiFeature(linkItem: any, submitData: any) {
const that: any = this;
let tempSubmitData: any = Object.assign(linkItem, { "activedata": submitData });
let action: string = this.wfAddiFeatureRef[linkItem.type].action;
if (!action) return;
if (that.appEntityService && that.appEntityService[action] && that.appEntityService[action] instanceof Function) {
const tempContext = Util.deepCopy(this.context);
Object.assign(tempContext, { taskId: linkItem.taskId })
that.appEntityService[action](tempContext, tempSubmitData).then((response: any) => {
const { data } = response;
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: data.message ? data.message : this.$t('app.commonWords.sysException') as string });
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);
}
if (this.viewdata) {
this.$emit('viewdataschange', [{ ...data }]);
this.$emit('close');
} else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
}
this.$Notice.success({ title: '', desc: (this.$t('app.formpage.workflow.submitsuccess') as string) });
}).catch((error: any) => {
const { data } = error;
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: data.message ? data.message : this.$t('app.commonWords.sysException') as string });
})
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: `${action}暂未实现` });
}
}
</#assign>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册