Explorar el Código

fix:1、修复设备不填写备注无法添加的bug;2、修复同一设备可重复添加的bug;3、修复站点更换父站后打开编辑框还是显示绑定旧父站的bug;4、修复用户绑定站点后打开编辑框还是旧站点的bug

Zhenghanjv hace 4 semanas
padre
commit
039974a7db

+ 12 - 1
Platform/AI.Platform.Page/Pages/Site/Screen.razor.cs

@@ -33,6 +33,9 @@ public partial class Screen
     /// 
     /// </summary>
     [Inject] IJSRuntime IJSRuntime { get; set; }
+
+
+    [Inject] IMessageService MessageService { get; set; }
     /// <summary>
     ///
     /// </summary>
@@ -107,7 +110,15 @@ public partial class Screen
         switch (model.Type)
         {
             case 1:
-                await _Repository.InsertAsync(model.ToCompany());
+                ScreentEntity screentEntity = await _Repository.AsQueryable().Where(it => it.sn == model.sn).FirstAsync();
+                if(screentEntity == null)
+                {
+                    await _Repository.InsertAsync(model.ToCompany());
+                } else
+                {
+                    MessageService.Error("该设备已存在");
+                }
+                
                 break;
             case 2:
                 ScreentEntity siteEntity = model.ToCompany();

+ 2 - 1
Platform/AI.Platform.Page/Pages/Site/Site.razor.cs

@@ -64,7 +64,7 @@ public partial class Site
     private StateDialogModel model = new StateDialogModel();
 
     // <summary>
-    /// 站点
+    /// 可供选择的父站列表
     /// </summary>
     private List<SiteInfo> Sites;
 
@@ -86,6 +86,7 @@ public partial class Site
             model.Name = media?.Name ?? "";
             model.Contact = media?.Contact ?? "";
             model.Id = media?.Id;
+            model.ParentId = media?.ParentID ?? 0;
         }
 
         isOpen = true;

+ 9 - 0
Platform/AI.Platform.Page/Pages/Site/UpdateScreenDialog.razor

@@ -67,6 +67,15 @@
                 </div>
             }
 
+            @* @if(Model?.Type == 4)
+            {
+                <h3>该设备已存在:@(Model.sn)</h3>
+                <div class="filter_row" style="justify-content:end;margin-top:5%;">
+                    <button Icon="plus" @onclick="onSure" Class="confirm_button">确定</button>
+                    <button Icon="reload" @onclick="Close" Class="cancel_button">取消</button>
+                </div>
+            } *@
+
             
         </div>
 

+ 1 - 1
Platform/AI.Platform.Page/Pages/Site/UpdateSiteDialog.razor

@@ -27,7 +27,7 @@
                                         Style="width:75%"
                                         TItemValue="long"
                                         TItem="string"
-                                        DefaultActiveFirstOption="true" EnableSearch AllowClear>
+                                        DefaultActiveFirstOption="false" EnableSearch AllowClear>
                                     <SelectOptions>
                                         @foreach (var department in Model.Sites)
                                         {

+ 2 - 2
Platform/AI.Platform.Tool/Configuration/DataBase.json

@@ -10,8 +10,8 @@
       {
         "ConfigId": "0", //默认库标识-禁止修改
         "DbType": "MySql", //MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
-        //"ConnectionString": "Data Source=localhost;Port=3306;Initial Catalog=media;Persist Security Info=True;User ID=root;Password=123456;Pooling=True;charset=utf8mb4;MAX Pool Size=200;Min Pool Size=1;Connection Lifetime=30;AllowLoadLocalInfile=true;", // 库连接字符串
-        "ConnectionString": "Data Source=localhost;Port=3307;Initial Catalog=media;Persist Security Info=True;User ID=root;Password=Wayne@123;Pooling=True;charset=utf8mb4;MAX Pool Size=200;Min Pool Size=1;Connection Lifetime=30;AllowLoadLocalInfile=true;", // 库连接字符串
+        "ConnectionString": "Data Source=localhost;Port=3306;Initial Catalog=media;Persist Security Info=True;User ID=root;Password=123456;Pooling=True;charset=utf8mb4;MAX Pool Size=200;Min Pool Size=1;Connection Lifetime=30;AllowLoadLocalInfile=true;", // 库连接字符串
+        //"ConnectionString": "Data Source=localhost;Port=3307;Initial Catalog=media;Persist Security Info=True;User ID=root;Password=Wayne@123;Pooling=True;charset=utf8mb4;MAX Pool Size=200;Min Pool Size=1;Connection Lifetime=30;AllowLoadLocalInfile=true;", // 库连接字符串
         //"ConnectionString": "Data Source=./thesystem.db",
         "DbSettings": {
           "EnableDiffLog": true, //启用库表差异日志

+ 1 - 1
Platform/AI.Platform.Tool/Entity/Device/ScreentEntity.cs

@@ -18,6 +18,6 @@ namespace AI.Platform.Core.Entity.Device
         public DateTime EditTime { get; set; }
 
         [SugarColumn(ColumnDescription = "备注", IsNullable = false)]
-        public string Remark { get; set; }
+        public string? Remark { get; set; }
     }
 }

+ 2 - 1
Platform/AI.Platform.Web/Components/Pages/Management/User/User.razor.cs

@@ -75,7 +75,8 @@ public partial class User
                 Enabled = c.Enabled,
                 Signature = c.Signature,
                 AreaIds = c.AreaIds,
-                CreateTime = c.CreateTime
+                CreateTime = c.CreateTime,
+                SiteId = c.SiteId
             })
             .ToPageListAsync(Pi, Ps, total);
         list.ForEach(x => {