mirror of
https://github.com/ThingsGateway/ThingsGateway.git
synced 2026-10-28 20:11:14 +08:00
设备组列宽调整,补充上传设备组
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ namespace ThingsGateway.Web.Foundation
|
||||
var query = Context.Queryable<UploadDevice>()
|
||||
.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() })
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
@layout MainLayout
|
||||
|
||||
<MRow>
|
||||
<MCol Md=3 Cols="12">
|
||||
<MCol Md=2 Cols="12">
|
||||
<MCard Class="ma-2" Style="height:100%">
|
||||
<MCardTitle>
|
||||
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_searchName"
|
||||
@@ -36,7 +36,7 @@
|
||||
</MTreeview>
|
||||
</MCard>
|
||||
</MCol>
|
||||
<MCol Md=9 Cols="12">
|
||||
<MCol Md=10 Cols="12">
|
||||
<div style="height: calc(100vh - 200px)">
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
@layout MainLayout
|
||||
|
||||
<MRow>
|
||||
<MCol Md=3 Cols="12">
|
||||
<MCol Md=2 Cols="12">
|
||||
<MCard Class="ma-2" Style="height:100%">
|
||||
<MCardTitle>
|
||||
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_searchName"
|
||||
@@ -37,7 +37,7 @@
|
||||
</MTreeview>
|
||||
</MCard>
|
||||
</MCol>
|
||||
<MCol Md=9 Cols="12">
|
||||
<MCol Md=10 Cols="12">
|
||||
<div style="height: calc(100vh - 200px)">
|
||||
|
||||
<AppDataTable @ref="_datatable" TItem="CollectDeviceVariable" SearchItem="VariablePageInput"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
@layout MainLayout
|
||||
|
||||
<MRow>
|
||||
<MCol Md=3 Cols="12">
|
||||
<MCol Md=2 Cols="12">
|
||||
<MCard Class="ma-2" Style="height:100%">
|
||||
<MCardTitle>
|
||||
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_searchName"
|
||||
@@ -37,7 +37,7 @@
|
||||
</MTreeview>
|
||||
</MCard>
|
||||
</MCol>
|
||||
<MCol Md=9 Cols="12">
|
||||
<MCol Md=10 Cols="12">
|
||||
<div style="height: calc(100vh - 200px)">
|
||||
|
||||
<AppDataTable @ref="_datatable" TItem="CollectVariableRunTime" SearchItem="VariablePageInput"
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
|
||||
<MCard Height=@("calc(100vh - 320px)") Style="overflow-y:auto" Flat Class="ml-2 my-4">
|
||||
<MRow NoGutters>
|
||||
@foreach (var item in UploadDeviceHostService.UploadDeviceCores)
|
||||
@foreach (var item in _uploadDeviceCores)
|
||||
{
|
||||
<MCol Md=12 Cols="12">
|
||||
<MCard Elevation="1" Class="ma-2">
|
||||
|
||||
@@ -14,70 +14,103 @@
|
||||
@inject UserResoures UserResoures
|
||||
@inject IDriverPluginService DriverPluginService
|
||||
@layout MainLayout
|
||||
<AppDataTable @ref="_datatable" TItem="UploadDevice" SearchItem="UploadDevicePageInput"
|
||||
AddItem="UploadDeviceAddInput" EditItem="UploadDeviceEditInput"
|
||||
IsMenuOperTemplate=false
|
||||
QueryCall="QueryCall" AddCall="AddCall" EditCall="EditCall" DeleteCall="DeleteCall"
|
||||
FilterHeaders="FilterHeaders" Filters="Filters" ShowDetailButton
|
||||
ShowQueryButton
|
||||
ShowAddButton=@UserResoures.IsHasButtonWithRole("tguploaddeviceadd")
|
||||
ShowDeleteButton=@UserResoures.IsHasButtonWithRole("tguploaddevicedelete")
|
||||
ShowEditButton=@UserResoures.IsHasButtonWithRole("tguploaddeviceedit")>
|
||||
<SearchTemplate>
|
||||
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="my-1 mx-2 " @bind-Value="context.Name" Clearable
|
||||
Outlined Label=@context.Description(x => x.Name) />
|
||||
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="my-1 mx-2 " @bind-Value="context.PluginName" Clearable
|
||||
Outlined Label=@context.Description(x => x.PluginName) />
|
||||
</SearchTemplate>
|
||||
<OtherToolbarTemplate>
|
||||
|
||||
<MButton Class="my-1 mx-2" Loading=@isDownExport OnClick=DownDeviceExport Color="primary">
|
||||
@T("导出")
|
||||
</MButton>
|
||||
<MButton Disabled=@(!UserResoures.IsHasButtonWithRole("tguploaddeviceedit")) Class="my-1 mx-2" OnClick="()=>{ ImportExcel.Step=1; ImportExcel.IsShowImport=true;}" Color="primary">
|
||||
@T("导入")
|
||||
</MButton>
|
||||
</OtherToolbarTemplate>
|
||||
<AddTemplate>
|
||||
@GetRenderFragment(context)
|
||||
</AddTemplate>
|
||||
|
||||
<EditTemplate>
|
||||
@GetRenderFragment(context)
|
||||
|
||||
</EditTemplate>
|
||||
<MRow>
|
||||
<MCol Md=2 Cols="12">
|
||||
<MCard Class="ma-2" Style="height:100%">
|
||||
<MCardTitle>
|
||||
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_searchName"
|
||||
Outlined Label=@typeof(CollectDevice).GetDescription(nameof(CollectDevice.DeviceGroup)) />
|
||||
</MCardTitle>
|
||||
<MTreeview Dense TItem="string" TKey="string" ActiveChanged=@(async a=>
|
||||
{
|
||||
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)>
|
||||
</MTreeview>
|
||||
</MCard>
|
||||
</MCol>
|
||||
<MCol Md=10 Cols="12">
|
||||
<div style="height: calc(100vh - 200px)">
|
||||
|
||||
|
||||
<ItemColTemplate>
|
||||
@switch (context.Header.Value)
|
||||
{
|
||||
<AppDataTable @ref="_datatable" TItem="UploadDevice" SearchItem="UploadDevicePageInput"
|
||||
AddItem="UploadDeviceAddInput" EditItem="UploadDeviceEditInput"
|
||||
IsMenuOperTemplate=false SearchModel="search"
|
||||
QueryCall="QueryCall" AddCall="AddCall" EditCall="EditCall" DeleteCall="DeleteCall"
|
||||
FilterHeaders="FilterHeaders" Filters="Filters" ShowDetailButton
|
||||
ShowQueryButton
|
||||
ShowAddButton=@UserResoures.IsHasButtonWithRole("tguploaddeviceadd")
|
||||
ShowDeleteButton=@UserResoures.IsHasButtonWithRole("tguploaddevicedelete")
|
||||
ShowEditButton=@UserResoures.IsHasButtonWithRole("tguploaddeviceedit")>
|
||||
<SearchTemplate>
|
||||
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="my-1 mx-2 " @bind-Value="context.Name" Clearable
|
||||
Outlined Label=@context.Description(x => x.Name) />
|
||||
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="my-1 mx-2 " @bind-Value="context.PluginName" Clearable
|
||||
Outlined Label=@context.Description(x => x.PluginName) />
|
||||
</SearchTemplate>
|
||||
<OtherToolbarTemplate>
|
||||
|
||||
case nameof(context.Item.Enable):
|
||||
<EnableChip Value="context.Item.Enable">
|
||||
</EnableChip>
|
||||
break;
|
||||
case nameof(context.Item.PluginId):
|
||||
<span>
|
||||
@(
|
||||
DriverPluginService.GetNameById(context.Item.PluginId)
|
||||
)
|
||||
</span>
|
||||
break;
|
||||
default:
|
||||
@context.Value
|
||||
break;
|
||||
<MButton Class="my-1 mx-2" Loading=@isDownExport OnClick=DownDeviceExport Color="primary">
|
||||
@T("导出")
|
||||
</MButton>
|
||||
<MButton Disabled=@(!UserResoures.IsHasButtonWithRole("tguploaddeviceedit")) Class="my-1 mx-2" OnClick="()=>{ ImportExcel.Step=1; ImportExcel.IsShowImport=true;}" Color="primary">
|
||||
@T("导入")
|
||||
</MButton>
|
||||
</OtherToolbarTemplate>
|
||||
<AddTemplate>
|
||||
@GetRenderFragment(context)
|
||||
</AddTemplate>
|
||||
|
||||
}
|
||||
<EditTemplate>
|
||||
@GetRenderFragment(context)
|
||||
|
||||
</ItemColTemplate>
|
||||
</AppDataTable>
|
||||
</EditTemplate>
|
||||
|
||||
|
||||
<ItemColTemplate>
|
||||
@switch (context.Header.Value)
|
||||
{
|
||||
|
||||
case nameof(context.Item.Enable):
|
||||
<EnableChip Value="context.Item.Enable">
|
||||
</EnableChip>
|
||||
break;
|
||||
case nameof(context.Item.PluginId):
|
||||
<span>
|
||||
@(
|
||||
DriverPluginService.GetNameById(context.Item.PluginId)
|
||||
)
|
||||
</span>
|
||||
break;
|
||||
default:
|
||||
@context.Value
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
</ItemColTemplate>
|
||||
</AppDataTable>
|
||||
|
||||
</div>
|
||||
</MCol>
|
||||
</MRow>
|
||||
|
||||
<ImportExcel @ref=ImportExcel Import="SaveDeviceImport" Preview="DeviceImport" Template="DownTemplate" />
|
||||
|
||||
|
||||
@code {
|
||||
string _searchName;
|
||||
List<string> _deviceGroups = new();
|
||||
private UploadDevicePageInput search = new();
|
||||
|
||||
|
||||
ImportExcel ImportExcel;
|
||||
|
||||
async Task SaveDeviceImport(Dictionary<string, ImportPreviewOutputBase> data)
|
||||
@@ -156,6 +189,10 @@
|
||||
<MSubheader Class="mt-4 font-weight-black"> @(context.Description(x => x.Description)) </MSubheader>
|
||||
<MTextField Dense Outlined HideDetails="@("auto")" @bind-Value=@context.Description />
|
||||
|
||||
<MSubheader Class="mt-4 font-weight-black"> @(context.Description(x => x.DeviceGroup)) </MSubheader>
|
||||
<MTextField Dense Outlined HideDetails="@("auto")" @bind-Value=@context.DeviceGroup />
|
||||
|
||||
|
||||
<MSubheader Class="mt-4 font-weight-black"> @(typeof(UploadDeviceRunTime).GetDescription(nameof(UploadDeviceRunTime.PluginName))) </MSubheader>
|
||||
<MCascader Value="context.PluginId" Class="mt-3 mr-3" Clearable TValue=long TItem="DriverPluginCategory"
|
||||
ValueChanged=@(a=>DriverValueChanged(context,a))
|
||||
|
||||
@@ -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<DataTableHeader<UploadDevice>> datas)
|
||||
|
||||
Reference in New Issue
Block a user