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

update:更新流程

上级 09188357
......@@ -134,6 +134,22 @@ ${P.getCtrlCode('searchform', 'MODEL_CONTENT.ts').code}
prop: 'srffrontuf',
dataType: 'TEXT',
},
// 预置工作流数据字段
{
name: 'srfprocessdefinitionkey',
prop: 'srfprocessdefinitionkey',
dataType: 'TEXT'
},
{
name: 'srftaskdefinitionkey',
prop: 'srftaskdefinitionkey',
dataType: 'TEXT'
},
{
name: 'srftaskid',
prop: 'srftaskid',
dataType: 'TEXT'
}
]
}
}
......
......@@ -10,34 +10,122 @@
* @memberof ${srfclassname('${view.name}')}Base
*/
public ${item.getFullCodeName()}(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
const that: any = this;
if (!xData || !(xData.wfstart instanceof Function)) {
return;
}
<#if view.getPSWorkflow()??>
<#assign curWorkflow = view.getPSWorkflow() />
<#-- 通过是否使用代理模式来区分流程启动的模式 -->
<#if curWorkflow.isUseWFProxyApp()>
xData.wfstart(args).then((response: any) => {
<#else>
let localdata:any = {processDefinitionKey:null};
xData.wfstart(args,localdata).then((response: any) => {
</#if>
<#else>
xData.wfstart(args).then((response: any) => {
</#if>
if (!response || response.status !== 200) {
return;
let validateStatus: boolean = true;
if (xData.formValidateStatus && xData.formValidateStatus instanceof Function) {
validateStatus = xData.formValidateStatus();
}
if (!validateStatus) {
return;
}
const startWorkFlow: Function = (param: any, localdata: any) => {
<#if view.getPSWorkflow()??>
<#assign curWorkflow = view.getPSWorkflow() />
<#-- 通过是否使用代理模式来区分流程启动的模式 -->
<#if curWorkflow.isUseWFProxyApp()>
xData.wfstart(args).then((response: any) => {
<#else>
let localdata:any = {processDefinitionKey:null};
xData.wfstart(args,localdata).then((response: any) => {
</#if>
<#else>
xData.wfstart(args).then((response: any) => {
</#if>
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
that.closeView(_data);
});
}
const openStartView: Function = async (item: any, localdata: any) => {
if (item['wfversion']) {
<#noparse>const targetView: any = that.viewRefData ? that.viewRefData[`WFSTART@${item['wfversion']}`] : null;</#noparse>
if (targetView) {
const tempContext = Util.deepCopy(that.context);
<#noparse>const tempViewParams = { actionView: `WFSTART@${item['wfversion']}`, actionForm: item['process-form'] };</#noparse>
const container: Subject<any> = that.$appmodal.openModal(targetView, tempContext, tempViewParams);
container.subscribe((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);
}
const { data: _data } = response;
if(window.parent){
window.parent.postMessage({ ..._data },'*');
}
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 (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
}else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
if (targetData && targetData.length > 1) {
const h = that.$createElement;
targetData.forEach((element: any) => {
Object.assign(element, { value: element.definitionkey, label: element.definitionname });
})
that.$msgbox({
title: '请选择流程版本',
message: h('i-select', {
key: Util.createUUID(),
props: {
value: localData,
placeholder: "请选择流程版本...",
transfer: true,
transferClassName: "start-workflow-select-wraper"
},
on: {
'on-change': ($event: any) => {
localData = { processDefinitionKey: $event };
}
}
}, targetData.map((item: any) => {
return h('i-option', {
key: item.value,
props: {
value: item.value,
label: item.label
}
})
})),
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then((action: string) => {
if (Object.is(action, 'confirm') && localData && Object.keys(localData).length > 0) {
let targetItem: any = 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
......@@ -164,6 +164,18 @@
<#elseif dataview.getOpenMode() == 'INDEXVIEWTAB' || dataview.getOpenMode() == ''>
<#-- 打开顶级分页视图 -->
const _this: any = this;
if (fullargs && fullargs.length > 0) {
const _args = fullargs[0];
if (_args['srfprocessdefinitionkey'] && _args['srftaskdefinitionkey']) {
Object.assign(data, {
processDefinitionKey: _args['srfprocessdefinitionkey'],
taskDefinitionKey: _args['srftaskdefinitionkey']
});
if (_args['srftaskid']) {
Object.assign(data, { 'srftaskid': _args['srftaskid'] });
}
}
}
if(fullargs && fullargs.copymode){
Object.assign(data,{copymode:true});
}
......
......@@ -105,8 +105,9 @@
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()];
if (Object.keys(this.viewparams).length > 0) {
Object.assign(datas, { 'processDefinitionKey': this.viewparams.processDefinitionKey });
Object.assign(datas, { 'taskDefinitionKey': this.viewparams.taskDefinitionKey });
}
const submit:Function = (submitData:any,linkItem:any) =>{
xData.wfsubmit(submitData,linkItem).then((response: any) => {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册