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

优化表格值规则校验提示

上级 93cdc68b
...@@ -715,16 +715,18 @@ import { Environment } from '@/environments/environment'; ...@@ -715,16 +715,18 @@ import { Environment } from '@/environments/environment';
this.errorMessages = []; this.errorMessages = [];
let validateState = true; let validateState = true;
let index = -1; let index = -1;
for(let item of this.items){ for (let item of this.items) {
index++; let tempMessage: string = '';
if(item.rowDataState === "create" || item.rowDataState === "update"){ index++;
for(let property of Object.keys(this.rules)){ if (item.rowDataState === "create" || item.rowDataState === "update") {
if(!await this.validate(property,item,index)){ for (let property of Object.keys(this.rules)) {
validateState = false; if (!await this.validate(property, item, index)) {
this.errorMessages.push(this.gridItemsModel[index][property].error); validateState = false;
} tempMessage = tempMessage + '<p>' + this.gridItemsModel[index][property].error + '<p>';
}
}
} }
} this.errorMessages.push(tempMessage);
} }
return validateState; return validateState;
} }
...@@ -1958,11 +1960,7 @@ import { Environment } from '@/environments/environment'; ...@@ -1958,11 +1960,7 @@ import { Environment } from '@/environments/environment';
} }
if (!await this.validateAll()) { if (!await this.validateAll()) {
if(this.errorMessages && this.errorMessages.length > 0) { if(this.errorMessages && this.errorMessages.length > 0) {
let descMessage: string = ''; this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: this.errorMessages[0] });
this.errorMessages.forEach((message: any) => {
descMessage = descMessage + '<p>' + message + '<p>';
})
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: descMessage });
} else { } else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.rulesException') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.rulesException') as string) });
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册