提交 7f589264 编写于 作者: tony001's avatar tony001

优化数据拷贝逻辑

上级 c6fb17d6
...@@ -947,26 +947,6 @@ import schema from 'async-validator'; ...@@ -947,26 +947,6 @@ import schema from 'async-validator';
</#if> </#if>
} }
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public copy(srfkey: string): void {
let copyData = this.$store.getters.getCopyData(srfkey);
copyData.srfkey = Util.createUUID();
copyData.${appde.getCodeName()?lower_case} = copyData.srfkey;
copyData.${appde.getKeyPSAppDEField().getCodeName()?lower_case} = copyData.srfkey;
Object.assign(this.context,{${appde.getCodeName()?lower_case}:copyData.${appde.getCodeName()?lower_case}})
this.data = copyData;
this.$nextTick(() => {
this.formState.next({ type: 'load', data: copyData });
this.data.srfuf = '0';
this.setFormEnableCond(this.data);
});
}
/** /**
*打印 *打印
*@memberof @memberof ${srfclassname('${ctrl.codeName}')}Base *@memberof @memberof ${srfclassname('${ctrl.codeName}')}Base
...@@ -1209,6 +1189,9 @@ import schema from 'async-validator'; ...@@ -1209,6 +1189,9 @@ import schema from 'async-validator';
return; return;
} }
} }
if(this.viewparams && this.viewparams.copymode){
data.srfuf = '0';
}
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction; const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){ if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction"; let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
...@@ -1216,9 +1199,6 @@ import schema from 'async-validator'; ...@@ -1216,9 +1199,6 @@ import schema from 'async-validator';
return; return;
} }
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg,{viewparams:this.viewparams});
if(this.viewparams && this.viewparams.copymode){
data.srfuf = '0';
}
const post: Promise<any> = Object.is(data.srfuf, '1')?this.service.update(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(action,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const post: Promise<any> = Object.is(data.srfuf, '1')?this.service.update(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(action,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response: any) => { post.then((response: any) => {
if (!response.status || response.status !== 200) { if (!response.status || response.status !== 200) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册