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

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

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