提交 93cdc68b 编写于 作者: Mosher's avatar Mosher

表单保存提示信息优化

上级 a348ff6b
......@@ -281,6 +281,14 @@ import { Environment } from '@/environments/environment';
*/
public saveState:any ;
/**
* 主信息属性映射表单项名称
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public majorMessageField: string = "<#list ctrl.getAllPSDEFormDetails() as item><#if item.getDetailType()?? && (item.getDetailType() == "FORMITEM" || item.getDetailType() == "FORMPART") && !item.isHidden()><#if item.getPSAppDEField?? && item.getPSAppDEField()?? && item.getPSAppDEField().isMajorField()>${item.getName()}</#if></#if></#list>";
/**
* 值规则
*
......@@ -1213,6 +1221,7 @@ import { Environment } from '@/environments/environment';
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
Object.assign(arg,{srfmajortext:data[this.majorMessageField]});
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
......@@ -1240,24 +1249,40 @@ import { Environment } from '@/environments/environment';
});
}).catch((response: any) => {
if (response && response.status && response.data) {
if(response.data.errorKey && Object.is(response.data.errorKey,"versionCheck")){
this.$Modal.confirm({
title: (this.$t('app.formpage.saveerror') as string),
content: (this.$t('app.formpage.savecontent') as string),
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
}else{
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
if (response.data.errorKey) {
if(Object.is(response.data.errorKey, "versionCheck")) {
this.$Modal.confirm({
title: (this.$t('app.formpage.saveerror') as string),
content: (this.$t('app.formpage.savecontent') as string),
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
} else if(Object.is(response.data.errorKey, 'DupCheck')) {
let errorProp: string = response.data.message.match(/\[[a-zA-Z]*\]/)[0];
let name: string = this.service.getNameByProp(errorProp.substr(1, errorProp.length-2));
if(name) {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: this.detailsModel[name].caption + " : " + arg[name] + (this.$t('app.commonWords.isExist') as string) + '!',
});
} else {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: response.data.message,
})
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return;
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
}
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
return;
}
});
}
......@@ -1289,6 +1314,7 @@ import { Environment } from '@/environments/environment';
const data = this.getValues();
Object.assign(arg, this.context);
Object.assign(arg, data);
Object.assign(arg,{srfmajortext:data[this.majorMessageField]});
if (ifStateNext) {
<#assign drcounter = 0>
<#list ctrl.getAllPSDEFormDetails() as formdetail>
......@@ -1339,27 +1365,43 @@ import { Environment } from '@/environments/environment';
</#if>
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
if(response.data.errorKey && Object.is(response.data.errorKey,"versionCheck")){
this.$Modal.confirm({
title: (this.$t('app.formpage.saveerror') as string),
content: (this.$t('app.formpage.savecontent') as string),
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
}else{
if (response && response.status && response.data) {
if (response.data.errorKey) {
if(Object.is(response.data.errorKey, "versionCheck")) {
this.$Modal.confirm({
title: (this.$t('app.formpage.saveerror') as string),
content: (this.$t('app.formpage.savecontent') as string),
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
} else if(Object.is(response.data.errorKey, 'DupCheck')) {
let errorProp: string = response.data.message.match(/\[[a-zA-Z]*\]/)[0];
let name: string = this.service.getNameByProp(errorProp.substr(1, errorProp.length-2));
if(name) {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: this.detailsModel[name].caption + " : " + arg[name] + (this.$t('app.commonWords.isExist') as string) + '!',
});
} else {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: response.data.message,
})
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
}
return;
}
if (!response || !response.status || !response.data) {
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
}
reject(response);
});
})
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册