提交 1fe8a86c 编写于 作者: zcdtk's avatar zcdtk

upate

上级 98b51d8f
...@@ -1134,67 +1134,55 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -1134,67 +1134,55 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
/** /**
* 保存并退出 * 保存并退出
* *
* @param {any[]} args * @protected
* @param {any[]} data
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
protected saveAndExit(data:any[]):Promise<any>{ protected async saveAndExit(data: any[]): Promise<any> {
let _this = this; const arg: any = { ...data[0] };
return new Promise((resolve: any, reject: any) =>{ this.currentAction = 'saveAndExit';
let arg: any = {}; const response: any = await this.save([arg]);
Object.assign(arg,data[0]); if (response && response.status === 200) {
_this.currentAction = "saveAndExit"; this.closeView(response.data);
_this.save([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
} }
resolve(res); return response;
}).catch((error) =>{
reject(error);
})
})
} }
/** /**
* 保存并新建 * 保存并新建
* *
* @param {any[]} args * @protected
* @param {any[]} data
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
protected saveAndNew(data:any[]):Promise<any>{ protected async saveAndNew(data: any[]): Promise<any> {
let _this = this; let arg: any = { ...data[0] };
return new Promise((resolve: any, reject: any) =>{ this.currentAction = 'saveAndNew';
let arg: any = {}; const response: any = await this.save([arg]);
Object.assign(arg,data[0]); if (response && response.status === 200) {
_this.currentAction = "saveAndNew"; this.ResetData(res);
_this.save([arg]).then((res) =>{ this.loadDraft({});
_this.ResetData(res); }
_this.loadDraft({}); return response;
}).catch((error) =>{
reject(error);
})
})
} }
/** /**
* 删除并退出 * 删除并退出
* *
* @param {any[]} args * @protected
* @param {any[]} data
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
protected removeAndExit(data:any[]):Promise<any>{ protected async removeAndExit(data: any[]): Promise<any> {
let _this = this; let arg: any = { ...data[0] };
return new Promise((resolve: any, reject: any) =>{ const response: any = await this.remove([arg]);
let arg: any = {}; if (response && response.status === 200) {
Object.assign(arg,data[0]); this.closeView(response.data);
_this.remove([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
} }
resolve(res); return response;
}).catch((error) =>{
reject(error);
})
})
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册