From ffe009f0947fd55f81814c9cfc7cbadab8cc6f48 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Sat, 11 Jul 2020 12:23:21 +0800 Subject: [PATCH] update Former-commit-id: 04f5fa567dc4440aa186c30839078691e31fd618 Former-commit-id: 09351787e42bbefe9d4c9c6abb8bfa68223a9289 --- .../Application/Models/EditNodeModel.cs | 1 + .../Application/Models/EditProductModel.cs | 1 + .../WebMVC/wwwroot/router/shared/edit.html | 10 +++--- .../wwwroot/router/shared/edit/imageurl.html | 32 ++++++++++++------- .../router/shared/edit/selectlist.html | 23 +++++++------ .../wwwroot/router/shared/edit/string.html | 9 +++--- 6 files changed, 45 insertions(+), 31 deletions(-) diff --git a/projects/IoT.Shared/Application/Models/EditNodeModel.cs b/projects/IoT.Shared/Application/Models/EditNodeModel.cs index 7a9cfe8a..c27f8c04 100644 --- a/projects/IoT.Shared/Application/Models/EditNodeModel.cs +++ b/projects/IoT.Shared/Application/Models/EditNodeModel.cs @@ -46,6 +46,7 @@ namespace Application.Models [ReadOnly(true)] public bool IsOnline { get; set; } + [Required(ErrorMessage = nameof(RequiredAttribute))] [Display(Name = "图片")] [DataType(DataType.ImageUrl)] public string Image { get; set; } diff --git a/projects/IoT.Shared/Application/Models/EditProductModel.cs b/projects/IoT.Shared/Application/Models/EditProductModel.cs index 9ff6230f..f764001c 100644 --- a/projects/IoT.Shared/Application/Models/EditProductModel.cs +++ b/projects/IoT.Shared/Application/Models/EditProductModel.cs @@ -7,6 +7,7 @@ namespace Application.Models [Display(Name = "产品")] public class EditProductModel : EditModel { + [Required(ErrorMessage = nameof(RequiredAttribute))] [Display(Name = "产品分类")] [DataType("SelectList")] public Guid? CategoryId { get; set; } diff --git a/projects/WebMVC/wwwroot/router/shared/edit.html b/projects/WebMVC/wwwroot/router/shared/edit.html index c7fe5741..918db0b4 100644 --- a/projects/WebMVC/wwwroot/router/shared/edit.html +++ b/projects/WebMVC/wwwroot/router/shared/edit.html @@ -22,11 +22,11 @@
- {{getErrors(key)}} - + {{getErrors(key)}} +
{{value.description}}
@@ -169,7 +169,7 @@ this.data.errors.push(error); } else { - if (!Enumerable.from(error.value.errors).any(o => o === message)) { + if (!Enumerable.from(error.value.errors).any(o => o.errorMessage === message)) { error.value.errors.push({ errorMessage: message }); } } @@ -195,7 +195,7 @@ getErrors: function (key) { key = key.toLowerCase(); return Enumerable.from(this.data.errors) - .where(o => o.key.toLowerCase() === key).selectMany(o => o.value.errors).select(o => o.errorMessage).toArray(); + .where(o => o.key.toLowerCase() === key).selectMany(o => o.value.errors).select(o => o.errorMessage).toArray().join(','); }, hasPermission: function () { var permission = this.mode + '-' + this.entity; diff --git a/projects/WebMVC/wwwroot/router/shared/edit/imageurl.html b/projects/WebMVC/wwwroot/router/shared/edit/imageurl.html index b5c30a59..cdd02923 100644 --- a/projects/WebMVC/wwwroot/router/shared/edit/imageurl.html +++ b/projects/WebMVC/wwwroot/router/shared/edit/imageurl.html @@ -1,6 +1,6 @@  \ No newline at end of file