diff --git a/src/ThingsGateway.Web.Foundation/Services/UploadDevice/Dto/UploadDeviceInput.cs b/src/ThingsGateway.Web.Foundation/Services/UploadDevice/Dto/UploadDeviceInput.cs index e85fb95b5..770b41624 100644 --- a/src/ThingsGateway.Web.Foundation/Services/UploadDevice/Dto/UploadDeviceInput.cs +++ b/src/ThingsGateway.Web.Foundation/Services/UploadDevice/Dto/UploadDeviceInput.cs @@ -33,11 +33,9 @@ namespace ThingsGateway.Application [Description("设备名称")] public string Name { get; set; } [Description("插件名称")] - public string PluginName - { - get; - set; - } + public string PluginName { get; set; } + [Description("设备组")] + public string DeviceGroup { get; set; } } diff --git a/src/ThingsGateway.Web.Foundation/Services/UploadDevice/UploadDeviceService.cs b/src/ThingsGateway.Web.Foundation/Services/UploadDevice/UploadDeviceService.cs index 691795bda..013fef79f 100644 --- a/src/ThingsGateway.Web.Foundation/Services/UploadDevice/UploadDeviceService.cs +++ b/src/ThingsGateway.Web.Foundation/Services/UploadDevice/UploadDeviceService.cs @@ -96,6 +96,7 @@ namespace ThingsGateway.Web.Foundation var query = Context.Queryable() .WhereIF(!string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name)) .WhereIF(!string.IsNullOrEmpty(input.PluginName), u => u.PluginId == (pluginid ?? 0)) + .WhereIF(!string.IsNullOrEmpty(input.DeviceGroup), u => u.DeviceGroup == input.DeviceGroup) .OrderByIF(!string.IsNullOrEmpty(input.SortField), $"{input.SortField} {input.SortOrder}") .OrderBy(u => u.Id)//排序 .Select((u) => new UploadDevice { Id = u.Id.SelectAll() }) diff --git a/src/ThingsGateway.Web.Page/Page/CollectDevicePage.razor b/src/ThingsGateway.Web.Page/Page/CollectDevicePage.razor index 8530fb204..9bdee2664 100644 --- a/src/ThingsGateway.Web.Page/Page/CollectDevicePage.razor +++ b/src/ThingsGateway.Web.Page/Page/CollectDevicePage.razor @@ -16,7 +16,7 @@ @layout MainLayout - + - +
diff --git a/src/ThingsGateway.Web.Page/Page/CollectVariablePage.razor b/src/ThingsGateway.Web.Page/Page/CollectVariablePage.razor index 4924ab7b5..06720519a 100644 --- a/src/ThingsGateway.Web.Page/Page/CollectVariablePage.razor +++ b/src/ThingsGateway.Web.Page/Page/CollectVariablePage.razor @@ -17,7 +17,7 @@ @layout MainLayout - + - +
- + - +
- @foreach (var item in UploadDeviceHostService.UploadDeviceCores) + @foreach (var item in _uploadDeviceCores) { diff --git a/src/ThingsGateway.Web.Page/Page/UploadDevicePage.razor b/src/ThingsGateway.Web.Page/Page/UploadDevicePage.razor index fae251147..f90f7e046 100644 --- a/src/ThingsGateway.Web.Page/Page/UploadDevicePage.razor +++ b/src/ThingsGateway.Web.Page/Page/UploadDevicePage.razor @@ -14,70 +14,103 @@ @inject UserResoures UserResoures @inject IDriverPluginService DriverPluginService @layout MainLayout - - - x.Name) /> - x.PluginName) /> - - - - @T("导出") - - - @T("导入") - - - - @GetRenderFragment(context) - - - - @GetRenderFragment(context) - - + + + + + + + + { + if(search.DeviceGroup!=a.FirstOrDefault()) + { + search.DeviceGroup=a.FirstOrDefault(); + await datatableQuery(); + } + } ) + Items="_deviceGroups" ItemText="r=>r" ItemChildren="r=>null" + Search="@_searchName" + Activatable ItemKey=@(r=>r)> + + + + +
- - @switch (context.Header.Value) - { + + + x.Name) /> + x.PluginName) /> + + - case nameof(context.Item.Enable): - - - break; - case nameof(context.Item.PluginId): - - @( - DriverPluginService.GetNameById(context.Item.PluginId) - ) - - break; - default: - @context.Value - break; + + @T("导出") + + + @T("导入") + + + + @GetRenderFragment(context) + - } + + @GetRenderFragment(context) - - + + + @switch (context.Header.Value) + { + + case nameof(context.Item.Enable): + + + break; + case nameof(context.Item.PluginId): + + @( + DriverPluginService.GetNameById(context.Item.PluginId) + ) + + break; + default: + @context.Value + break; + + } + + + + +
+
+
@code { + string _searchName; + List _deviceGroups = new(); + private UploadDevicePageInput search = new(); + + ImportExcel ImportExcel; async Task SaveDeviceImport(Dictionary data) @@ -156,6 +189,10 @@ @(context.Description(x => x.Description)) + @(context.Description(x => x.DeviceGroup)) + + + @(typeof(UploadDeviceRunTime).GetDescription(nameof(UploadDeviceRunTime.PluginName))) DriverValueChanged(context,a)) diff --git a/src/ThingsGateway.Web.Page/Page/UploadDevicePage.razor.cs b/src/ThingsGateway.Web.Page/Page/UploadDevicePage.razor.cs index 28768551b..2b7303d61 100644 --- a/src/ThingsGateway.Web.Page/Page/UploadDevicePage.razor.cs +++ b/src/ThingsGateway.Web.Page/Page/UploadDevicePage.razor.cs @@ -20,12 +20,14 @@ namespace ThingsGateway.Web.Page protected override async Task OnParametersSetAsync() { DriverPlugins = DriverPluginService.GetDriverPluginChildrenList(DriverEnum.Upload); + _deviceGroups = UploadDeviceService.GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList(); await base.OnParametersSetAsync(); } private async Task AddCall(UploadDeviceAddInput input) { await UploadDeviceService.Add(input); + _deviceGroups = UploadDeviceService.GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList(); } private async Task datatableQuery() { @@ -36,11 +38,13 @@ namespace ThingsGateway.Web.Page { await UploadDeviceService.Delete(input.ToList().ConvertAll(it => new BaseIdInput() { Id = it.Id })); + _deviceGroups = UploadDeviceService.GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList(); } private async Task EditCall(UploadDeviceEditInput input) { await UploadDeviceService.Edit(input); + _deviceGroups = UploadDeviceService.GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList(); } private void FilterHeaders(List> datas)