提交 5cbe7ba3 编写于 作者: tony001's avatar tony001

zpc --- 调整提交流程逻辑

上级 20a4d263
...@@ -129,20 +129,21 @@ import ${srfclassname('${_appde.getCodeName()}')}Service from '@/service/${srffi ...@@ -129,20 +129,21 @@ import ${srfclassname('${_appde.getCodeName()}')}Service from '@/service/${srffi
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}Service * @memberof ${srfclassname('${ctrl.codeName}')}Service
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -1146,10 +1146,11 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -1146,10 +1146,11 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
* 工作流提交 * 工作流提交
* *
* @param {*} [data={}] * @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
protected async wfsubmit(data: any): Promise<any> { protected async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
if(!this.WFSubmitAction){ if(!this.WFSubmitAction){
this.$Notice.error({ title: '错误', desc: '${view.getName()}视图表单WFSubmitAction参数未配置' }); this.$Notice.error({ title: '错误', desc: '${view.getName()}视图表单WFSubmitAction参数未配置' });
...@@ -1161,7 +1162,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -1161,7 +1162,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
if (!arg.${ctrl.getPSAppDataEntity().getCodeName()?lower_case} || Object.is(arg.${ctrl.getPSAppDataEntity().getCodeName()?lower_case}, '')) { if (!arg.${ctrl.getPSAppDataEntity().getCodeName()?lower_case} || Object.is(arg.${ctrl.getPSAppDataEntity().getCodeName()?lower_case}, '')) {
return; return;
} }
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
post.then((response:any) =>{ post.then((response:any) =>{
const arg:any = response.data; const arg:any = response.data;
if(this.viewparams){ if(this.viewparams){
......
...@@ -45,30 +45,22 @@ ...@@ -45,30 +45,22 @@
* @memberof ${srfclassname('${view.codeName}')}Base * @memberof ${srfclassname('${view.codeName}')}Base
*/ */
public dynamic_toolbar_click(linkItem:any, $event:any){ public dynamic_toolbar_click(linkItem:any, $event:any){
(this.$refs.form as any).save().then((response:any) =>{ let datas: any[] = [];
let requestData:any = Object.assign(linkItem,{activedata:response.data}); let xData: any = this.$refs.form;
this.appEntityService.WFSubmit(JSON.parse(JSON.stringify(this.context)),JSON.parse(JSON.stringify(requestData)),true,true).then((res:any) =>{ if (xData.getDatas && xData.getDatas instanceof Function) {
if (response && response.status === 200) { datas = [...xData.getDatas()];
this.$Notice.success({ title: '成功', desc: linkItem.sequenceFlowName+'操作成功' }); }
} xData.wfsubmit(datas,linkItem).then((response: any) => {
}).catch((res: any) => { if (!response || response.status !== 200) {
if (res && res.status) {
this.$Notice.error({ title: '错误', desc: res.message });
return;
}
if (!res || !res.status || !res.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}).catch((response: any) => {
if (response && response.status) {
this.$Notice.error({ title: '错误', desc: response.message });
return; return;
} }
if (!response || !response.status || !response.data) { const { data: _data } = response;
this.$Notice.error({ title: '错误', desc: '系统异常' });
return; if (this.viewdata) {
this.$emit('viewdataschange', [{ ..._data }]);
this.$emit('close');
} else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
} }
}); });
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册