diff --git a/docs/研发/v1.0任务分解.xlsx b/docs/研发/v1.0任务分解.xlsx index 67ef239e..19c7c006 100644 Binary files a/docs/研发/v1.0任务分解.xlsx and b/docs/研发/v1.0任务分解.xlsx differ diff --git a/projects/Infrastructure/Data/EfDbContext.cs b/projects/Infrastructure/Data/EfDbContext.cs index 32d8e4e9..ca6c9abf 100644 --- a/projects/Infrastructure/Data/EfDbContext.cs +++ b/projects/Infrastructure/Data/EfDbContext.cs @@ -1,23 +1,17 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; using Infrastructure.Domain; using Infrastructure.Extensions; -using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; namespace Infrastructure.Data { public class EfDbContext : DbContext { - public static readonly LoggerFactory MyLoggerFactory = new LoggerFactory( - //new[] - //{ - // //new ConsoleLoggerProvider((_, __) => true, true) - //} - ); + public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); public EfDbContext(DbContextOptions options) : base(options) { diff --git a/projects/IoT.Shared/Application/Domain/Entities/Category.cs b/projects/IoT.Shared/Application/Domain/Entities/Category.cs index e1768ec4..37faff2e 100644 --- a/projects/IoT.Shared/Application/Domain/Entities/Category.cs +++ b/projects/IoT.Shared/Application/Domain/Entities/Category.cs @@ -13,7 +13,7 @@ namespace Application.Domain.Entities public string Number { get; set; } [Display(Name = "分类图标")] - public string Icon { get; set; } + public string Image { get; set; } public List Products { get; set; } = new List(); } diff --git a/projects/IoT.Shared/Application/Domain/Entities/Node.cs b/projects/IoT.Shared/Application/Domain/Entities/Node.cs index d259c63e..17ba6e69 100644 --- a/projects/IoT.Shared/Application/Domain/Entities/Node.cs +++ b/projects/IoT.Shared/Application/Domain/Entities/Node.cs @@ -14,12 +14,6 @@ namespace Application.Domain.Entities [Required] public string Number { get; set; } - [Display(Name = "是否在线")] - public bool IsOnline { get; set; } - - [Display(Name = "图标")] - public string Icon { get; set; } - [Display(Name = "图片")] public string Image { get; set; } diff --git a/projects/IoT.Shared/Application/Domain/Entities/Product.cs b/projects/IoT.Shared/Application/Domain/Entities/Product.cs index be8933d6..da2c61d6 100644 --- a/projects/IoT.Shared/Application/Domain/Entities/Product.cs +++ b/projects/IoT.Shared/Application/Domain/Entities/Product.cs @@ -16,7 +16,7 @@ namespace Application.Domain.Entities public string Number { get; set; } [Display(Name = "图标")] - public string Icon { get; set; } + public string Image { get; set; } [Display(Name = "ApiJson")] public string ApiJson { get; set; } diff --git a/projects/IoT.Shared/Application/Models/DeviceSearchMode.cs b/projects/IoT.Shared/Application/Models/DeviceSearchMode.cs index 29b3491a..762dca90 100644 --- a/projects/IoT.Shared/Application/Models/DeviceSearchMode.cs +++ b/projects/IoT.Shared/Application/Models/DeviceSearchMode.cs @@ -10,6 +10,14 @@ namespace Application.Models [Display(Name = "节点")] public Guid? NodeId { get; set; } + [DataType("SelectList")] + [Display(Name = "分类")] + public Guid? CategoryId { get; set; } + + [DataType("SelectList")] + [Display(Name = "产品")] + public Guid? ProductId { get; set; } + [Display(Name = "关键词")] public string Keyword { get; set; } } diff --git a/projects/IoT.Shared/Application/Models/EditCategoryModel.cs b/projects/IoT.Shared/Application/Models/EditCategoryModel.cs index 05521fa0..67048e23 100644 --- a/projects/IoT.Shared/Application/Models/EditCategoryModel.cs +++ b/projects/IoT.Shared/Application/Models/EditCategoryModel.cs @@ -18,6 +18,7 @@ namespace Application.Models [Display(Name = "Icon")] [Required(ErrorMessage = nameof(RequiredAttribute))] - public string Icon { get; set; } + [DataType(DataType.ImageUrl)] + public string Image { get; set; } } } \ No newline at end of file diff --git a/projects/IoT.Shared/Application/Models/EditNodeModel.cs b/projects/IoT.Shared/Application/Models/EditNodeModel.cs index 0baedf8d..33ae23f6 100644 --- a/projects/IoT.Shared/Application/Models/EditNodeModel.cs +++ b/projects/IoT.Shared/Application/Models/EditNodeModel.cs @@ -16,16 +16,10 @@ namespace Application.Models [Required(ErrorMessage = nameof(RequiredAttribute))] public string Number { get; set; } - [Display(Name = "Icon")] - [Required(ErrorMessage = nameof(RequiredAttribute))] - public string Icon { get; set; } - [Display(Name = "图片")] + [DataType(DataType.ImageUrl)] public string Image { get; set; } - [Display(Name = "是否在线")] - public bool IsOnline { get; set; } - [Display(Name = "经度")] public decimal Longitude { get; set; } diff --git a/projects/IoT.Shared/Application/Models/EditProductModel.cs b/projects/IoT.Shared/Application/Models/EditProductModel.cs index 1fc97890..20b8d5d7 100644 --- a/projects/IoT.Shared/Application/Models/EditProductModel.cs +++ b/projects/IoT.Shared/Application/Models/EditProductModel.cs @@ -17,8 +17,9 @@ namespace Application.Models [Display(Name = "产品型号")] public string Number { get; set; } - [Display(Name = "图标")] - public string Icon { get; set; } + [Display(Name = "图片")] + [DataType(DataType.ImageUrl)] + public string Image { get; set; } [Display(Name = "ApiJson")] [DataType(DataType.MultilineText)] diff --git a/projects/IoT.Shared/Application/Models/HomeViewModel.cs b/projects/IoT.Shared/Application/Models/HomeViewModel.cs deleted file mode 100644 index d6836d1e..00000000 --- a/projects/IoT.Shared/Application/Models/HomeViewModel.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Application.Domain.Entities; -using System.Collections.Generic; - -namespace Application.Models -{ - public class HomeViewModel - { - public Node Node { get; set; } = new Node(); - public List Devices { get; set; } = new List(); - public List Scenes { get; set; } = new List(); - } -} \ No newline at end of file diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/DeviceController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/DeviceController.cs index f05f1537..d74695d1 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/DeviceController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/DeviceController.cs @@ -32,8 +32,13 @@ namespace IoT.Shared.Areas.Admin.Controlls { throw new ArgumentNullException(nameof(model)); } + ViewData.SelectList(o => model.NodeId, () => this._ajax.GetNodeSelectList(model.NodeId)); + ViewData.SelectList(o => model.CategoryId, () => this._ajax.GetCategorySelectList(model.CategoryId)); + ViewData.SelectList(o => model.ProductId, () => this._ajax.GetProductSelectList(model.ProductId)); return query .WhereIf(model.NodeId.HasValue, o => o.NodeId == model.NodeId.Value) + .WhereIf(model.CategoryId.HasValue, o => o.Product.CategoryId == model.CategoryId.Value) + .WhereIf(model.ProductId.HasValue, o => o.ProductId == model.ProductId.Value) .WhereIf(!string.IsNullOrEmpty(model.Keyword), o => o.Name.Contains(model.Keyword)); } diff --git a/projects/IoT.Shared/IoT.Shared.csproj b/projects/IoT.Shared/IoT.Shared.csproj index 531de393..023ab65a 100644 --- a/projects/IoT.Shared/IoT.Shared.csproj +++ b/projects/IoT.Shared/IoT.Shared.csproj @@ -26,7 +26,9 @@   - + + + diff --git a/projects/IoT.Shared/IoTServiceStartup.cs b/projects/IoT.Shared/IoTServiceStartup.cs index 3ed8b7fa..63fb6677 100644 --- a/projects/IoT.Shared/IoTServiceStartup.cs +++ b/projects/IoT.Shared/IoTServiceStartup.cs @@ -176,11 +176,11 @@ namespace IoT.UI.Shard }); dbContext.SaveChanges(); - dbContext.Set().Add(new Category { Id = Guid.Parse("BA92B82B-1E92-428B-92ED-28AD93FB7514"), Number = "00", Name = "网关", Icon = "gateway" }); - dbContext.Set().Add(new Category { Id = Guid.Parse("8E271914-622C-4B4D-BD33-78993F99BE43"), Number = "10", Name = "安防", Icon = "safe" }); - dbContext.Set().Add(new Category { Id = Guid.Parse("F510E634-5D1E-4398-A121-6945D43B5A5C"), Number = "20", Name = "电器", Icon = "electric" }); - dbContext.Set().Add(new Category { Id = Guid.Parse("AC2A427C-173C-4277-B9C5-3B73FFE841C9"), Number = "30", Name = "照明", Icon = "lighting" }); - dbContext.Set().Add(new Category { Id = Guid.Parse("67FC5B9D-6479-4714-8D07-E24EF0AEB502"), Number = "40", Name = "监测", Icon = "monitor" }); + dbContext.Set().Add(new Category { Id = Guid.Parse("BA92B82B-1E92-428B-92ED-28AD93FB7514"), Number = "00", Name = "网关", Image = "/images/gateway.png" }); + dbContext.Set().Add(new Category { Id = Guid.Parse("8E271914-622C-4B4D-BD33-78993F99BE43"), Number = "10", Name = "安防", Image = "/images/safe.png" }); + dbContext.Set().Add(new Category { Id = Guid.Parse("F510E634-5D1E-4398-A121-6945D43B5A5C"), Number = "20", Name = "电器", Image = "/images/socket.png" }); + dbContext.Set().Add(new Category { Id = Guid.Parse("AC2A427C-173C-4277-B9C5-3B73FFE841C9"), Number = "30", Name = "照明", Image = "/images/light.png" }); + dbContext.Set().Add(new Category { Id = Guid.Parse("67FC5B9D-6479-4714-8D07-E24EF0AEB502"), Number = "40", Name = "监测", Image = "/images/monitor.png" }); dbContext.SaveChanges(); } } diff --git a/projects/IoT.Shared/Views/Device/Details.cshtml b/projects/IoT.Shared/Views/Device/Details.cshtml index 664648c9..bd4e29ef 100644 --- a/projects/IoT.Shared/Views/Device/Details.cshtml +++ b/projects/IoT.Shared/Views/Device/Details.cshtml @@ -47,7 +47,7 @@
- {{model.DisplayName}} + {{model.DisplayName}}
@@ -160,7 +160,7 @@
- + diff --git a/projects/IoT.Shared/Views/Device/Index.cshtml b/projects/IoT.Shared/Views/Device/Index.cshtml index 5cea08bb..70a015f0 100644 --- a/projects/IoT.Shared/Views/Device/Index.cshtml +++ b/projects/IoT.Shared/Views/Device/Index.cshtml @@ -37,7 +37,7 @@
- {{device.DisplayName}} + {{device.DisplayName}}
@@ -126,7 +126,7 @@
- + diff --git a/projects/IoT.Shared/Views/Home/Node.cshtml b/projects/IoT.Shared/Views/Home/Node.cshtml index 0b4db400..b5d9e1ce 100644 --- a/projects/IoT.Shared/Views/Home/Node.cshtml +++ b/projects/IoT.Shared/Views/Home/Node.cshtml @@ -40,7 +40,7 @@
-
+
{{scene.Name}}
@@ -59,32 +59,32 @@
-
+
{{getDeviceDataValue(d,"温度")}} {{getDeviceDataValue(d,"湿度")}}
-
+
{{getDeviceDataValue(d,"二氧化碳")}}
-
+
{{getDeviceDataValue(d,"光照强度")}}
-
+
{{getDeviceDataValue(d,"粉尘")}}
-
+
{{getDeviceDataValue(d,"状态")}}
-
+
{{getDeviceDataValue(d,"状态")}}
@@ -97,14 +97,14 @@ 主机
- - + +
-
+
{{getDeviceDataValue(d,"计算机名")}}
@@ -114,9 +114,9 @@
发送:{{getDeviceDataValue(d,"发送")}} 接收{{getDeviceDataValue(d,"接收")}}
- - - + + +
@@ -131,7 +131,7 @@
-
+
{{getDeviceDataValue(d,"名称")}}
@@ -152,20 +152,20 @@ 窗帘
- - - + + +
-
+
{{d.DisplayName}} {{getDeviceDataValue(d,"状态")}}
- - - + + +
@@ -176,65 +176,65 @@ 开关
- - + +
-
+
{{d.DisplayName}} {{getDeviceDataValue(d,"状态")}}
- - + +
-
+
{{d.DisplayName}} {{getDeviceDataValue(d,"状态")}}
- - + +
-
+
{{d.DisplayName}}
- - + +
- - - - + + + +
-
+
{{d.DisplayName}}
- - + +
- - - - - - + + + + + +
@@ -245,18 +245,18 @@ 插座
- - + +
-
+
{{d.DisplayName}} {{getDeviceDataValue(d,"状态")}}
- - + +
@@ -267,18 +267,18 @@ 插座
- - + +
-
+
{{d.DisplayName}} {{getDeviceDataValue(d,"状态")}}
- - + +
@@ -289,18 +289,18 @@ 插座
- - + +
-
+
{{d.DisplayName}} {{getDeviceDataValue(d,"状态")}}
- - + +
@@ -311,16 +311,16 @@ 门锁
- +
-
+
{{d.DisplayName}} {{getDeviceDataValue(d,"状态")}}
- +
@@ -333,14 +333,14 @@
-
+
{{d.DisplayName}}