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

update:补充工作流开始流程

上级 983e1f86
...@@ -1324,21 +1324,54 @@ import { Util } from '@/ibiz-core/utils'; ...@@ -1324,21 +1324,54 @@ import { Util } from '@/ibiz-core/utils';
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
protected async wfsubmit(data: any, linkItem: any, datas: any): Promise<any> { protected async wfsubmit(data: any, linkItem: any, datas: any): Promise<any> {
const arg: any = { ...data }; if (!(await this.validAll())) {
Object.assign(arg, this.viewparams, linkItem); this.$notice.error('值规则校验错误');
// 强制补充srfwfmemo
if (this.srfwfmemo) {
Object.assign(datas, { srfwfmemo: this.srfwfmemo });
}
const response: any = await this.service.wfsubmit(this.currentAction, { ...this.context }, datas, this.showBusyIndicator, arg);
if (response && response.status === 200) {
<#if ctrl.getControlType() == 'FORM'>
AppCenterService.notifyMessage({name:"${ctrl.getPSAppDataEntity().getCodeName()}",action:'appRefresh',data:data});
</#if>
return response
} else if (response && response.status !== 401) {
return response;
} }
return new Promise((resolve: any, reject: any) => {
const arg: any = data[0];
Object.assign(arg, linkItem);
const copyData: any = Util.deepCopy(arg);
Object.assign(copyData, this.viewparams);
Object.assign(arg, { viewparams: copyData });
if (!arg['${ctrl.getPSAppDataEntity().getKeyPSAppDEField().getCodeName()?lower_case}']) {
return;
}
const submitData: Function = (arg: any, responseData: any) => {
// 准备工作流数据,填充未存库数据
let tempWFData: any = {};
if (copyData && Object.keys(copyData).length > 0) {
Object.keys(copyData).forEach((key: string) => {
if ((!arg.hasOwnProperty(key)) || (!arg[key] && copyData[key])) {
tempWFData[key] = copyData[key];
}
})
}
// 准备提交参数
if (this.viewparams) {
Object.assign(responseData, this.viewparams);
}
if (tempWFData && Object.keys(tempWFData).length > 0) {
Object.assign(responseData, tempWFData);
}
Object.assign(arg, { viewparams: responseData });
// 强制补充srfwfmemo
if (copyData.srfwfmemo) {
Object.assign(arg, { srfwfmemo: copyData.srfwfmemo });
}
this.service.wfsubmit(this.WFSubmitAction, { ...this.context }, datas, this.showBusyIndicator, arg).then((response: any) => {
if (response && response.status === 200) {
AppCenterService.notifyMessage({name:"${ctrl.getPSAppDataEntity().getCodeName()}",action:'appRefresh',data:data});
resolve(response);
} else if (response && response.status !== 401) {
resolve(response)
}
}).catch((response: any) => {
reject(response);
})
}
const formData: any = this.getData();
submitData(arg, formData);
})
} }
</#if> </#if>
......
...@@ -12,10 +12,97 @@ ...@@ -12,10 +12,97 @@
* @memberof <#if item.getPSControlContainer?? && item.getPSControlContainer()??>${srfclassname('${item.getPSControlContainer().name}')}Base</#if> * @memberof <#if item.getPSControlContainer?? && item.getPSControlContainer()??>${srfclassname('${item.getPSControlContainer().name}')}Base</#if>
*/ */
public async ${item.getFullCodeName()}(args: any[], contextJO: any = {}, paramJO: any = {}, $event?: any, xData?: any, container?: any, srfParentDeName?: string): Promise<any> { public async ${item.getFullCodeName()}(args: any[], contextJO: any = {}, paramJO: any = {}, $event?: any, xData?: any, container?: any, srfParentDeName?: string): Promise<any> {
let response: any; const that: any = container;
if (xData && xData.wfstart instanceof Function) { if (!xData || !(xData.wfstart instanceof Function) || !(that.appEntityService)) {
const _data = {}; return;
response = await xData.wfstart(args);
} }
return response; let validateStatus: boolean = true;
if (xData.validAll instanceof Function) {
validateStatus = await xData.validAll();
}
if (!validateStatus) {
return;
}
const startWorkFlow: Function = (param: any, localdata: any) => {
xData.wfstart(param, localdata).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
that.closeView(_data);
});
}
const openStartView: Function = async (item: any, localdata: any) => {
if (item['wfversion']) {
<#noparase>const targetView: any = that.viewRefData ? that.viewRefData[`WFSTART@${item['wfversion']}`] : null;</#noparse>
if (targetView) {
const tempContext = Util.deepCopy(that.context);
<#noparase>const tempViewParams = { actionView: `WFSTART@${item['wfversion']}`, actionForm: item['process-form'] };</#noparse>
ViewOpenService.getInstance().openModal(targetView, tempContext, tempViewParams).then((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
const tempSubmitData: any = Util.deepCopy(args[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] || (resultData[key] === 0) || (resultData[key] === false)) {
tempData[key] = resultData[key];
}
})
Object.assign(tempSubmitData, tempData);
}
}
startWorkFlow([tempSubmitData], localdata);
})
} else {
startWorkFlow(args, localdata);
}
} else {
startWorkFlow(args, localdata);
}
}
let localData: any;
const localContext = Util.deepCopy(that.context);
const requestResult: Promise<any> = that.appEntityService.getStandWorkflow(localContext);
requestResult.then((response: any) => {
const { data: targetData, status } = response;
if (status !== 200 || targetData.length === 0) {
return;
}
if (targetData && targetData.length > 1) {
const h = that.$createElement;
const msgBoxContent = h('app-wfversion-select', {
props: {
versionItems: targetData,
majorKey: 'definitionkey',
versionTitle: 'definitionname'
},
on: {
valueChange: (value: any) => {
localData = { processDefinitionKey: value };
}
}
});
ViewOpenService.getInstance().openMsgBox({
type: 'info',
title: '请选择流程版本',
showCancelButton: true,
content: msgBoxContent
}).then((result: boolean) => {
if (result === true) {
const targetItem = targetData.find((item: any) => {
return item.definitionkey === localData.processDefinitionKey;
})
openStartView(targetItem, localData);
}
})
} else {
localData = { processDefinitionKey: targetData[0]['definitionkey'] }
targetData[0]['process-view'] = "WFSTART@1";
openStartView(targetData[0], localData);
}
})
} }
\ No newline at end of file
...@@ -32,6 +32,22 @@ ...@@ -32,6 +32,22 @@
../@MACRO/VIEW_CONTENT-BASE.vue.ftl ../@MACRO/VIEW_CONTENT-BASE.vue.ftl
</#ibizinclude> </#ibizinclude>
/**
* 视图引用数据
*
* @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>
};
/** /**
* 保存 * 保存
* *
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册