mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-25 12:43:09 +08:00
fix: page取消注入瞬时服务,改为App.GetService
This commit is contained in:
@@ -14,8 +14,7 @@
|
||||
@using System.Linq.Expressions;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
|
||||
@inject IConfigService ConfigService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -41,26 +41,26 @@ public partial class Config
|
||||
MainLayout MainLayout { get; set; }
|
||||
private Task AddCallAsync(ConfigAddInput input)
|
||||
{
|
||||
return ConfigService.AddAsync(input);
|
||||
return App.GetService<ConfigService>().AddAsync(input);
|
||||
}
|
||||
|
||||
private Task DeleteCallAsync(IEnumerable<SysConfig> sysConfigs)
|
||||
{
|
||||
return ConfigService.DeleteAsync(sysConfigs.Select(a => a.Id).ToArray());
|
||||
return App.GetService<ConfigService>().DeleteAsync(sysConfigs.Select(a => a.Id).ToArray());
|
||||
}
|
||||
private Task EditCallAsync(ConfigEditInput sysConfigs)
|
||||
{
|
||||
return ConfigService.EditAsync(sysConfigs);
|
||||
return App.GetService<ConfigService>().EditAsync(sysConfigs);
|
||||
}
|
||||
|
||||
private async Task OnSaveAsync()
|
||||
{
|
||||
await ConfigService.EditBatchAsync(_sysConfig);
|
||||
await App.GetService<ConfigService>().EditBatchAsync(_sysConfig);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
|
||||
}
|
||||
private Task<SqlSugarPagedList<SysConfig>> QueryCallAsync(ConfigPageInput input)
|
||||
{
|
||||
return ConfigService.PageAsync(input);
|
||||
return App.GetService<ConfigService>().PageAsync(input);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
@using Masa.Blazor.Presets;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
@inject IMenuService MenuService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inherits BaseComponentBase
|
||||
|
||||
@@ -29,14 +29,11 @@ public partial class Menu
|
||||
long buttonParentId;
|
||||
bool IsShowButtonList;
|
||||
List<SysResource> MenuCatalog = new();
|
||||
[Inject]
|
||||
IButtonService ButtonService { get; set; }
|
||||
|
||||
|
||||
[CascadingParameter]
|
||||
MainLayout MainLayout { get; set; }
|
||||
|
||||
[Inject]
|
||||
IResourceService ResourceService { get; set; }
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
@@ -52,23 +49,23 @@ public partial class Menu
|
||||
private async Task AddCallAsync(MenuAddInput input)
|
||||
{
|
||||
input.ParentId = search.ParentId;
|
||||
await MenuService.AddAsync(input);
|
||||
await App.GetService<MenuService>().AddAsync(input);
|
||||
await NavChangeAsync();
|
||||
}
|
||||
private async Task ButtonAddCallAsync(ButtonAddInput input)
|
||||
{
|
||||
input.ParentId = buttonParentId;
|
||||
await ButtonService.AddAsync(input);
|
||||
await App.GetService<ButtonService>().AddAsync(input);
|
||||
}
|
||||
|
||||
private Task ButtonDeleteCallAsync(IEnumerable<SysResource> input)
|
||||
{
|
||||
return ButtonService.DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
return App.GetService<ButtonService>().DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
}
|
||||
|
||||
private Task ButtonEditCallAsync(ButtonEditInput input)
|
||||
{
|
||||
return ButtonService.EditAsync(input);
|
||||
return App.GetService<ButtonService>().EditAsync(input);
|
||||
|
||||
}
|
||||
|
||||
@@ -92,7 +89,7 @@ public partial class Menu
|
||||
private async Task<SqlSugarPagedList<SysResource>> ButtonQueryCallAsync(ButtonPageInput input)
|
||||
{
|
||||
input.ParentId = buttonParentId;
|
||||
var data = await ButtonService.PageAsync(input);
|
||||
var data = await App.GetService<ButtonService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -103,13 +100,13 @@ public partial class Menu
|
||||
|
||||
private async Task DeleteCallAsync(IEnumerable<SysResource> input)
|
||||
{
|
||||
await MenuService.DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
await App.GetService<MenuService>().DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
await NavChangeAsync();
|
||||
|
||||
}
|
||||
private async Task EditCallAsync(MenuEditInput input)
|
||||
{
|
||||
await MenuService.EditAsync(input);
|
||||
await App.GetService<MenuService>().EditAsync(input);
|
||||
await NavChangeAsync();
|
||||
|
||||
}
|
||||
@@ -117,9 +114,9 @@ public partial class Menu
|
||||
private async Task<List<SysResource>> GetMenuCatalogAsync()
|
||||
{
|
||||
//获取所有菜单
|
||||
List<SysResource> sysResources = await ResourceService.GetListByCategoryAsync(ResourceCategoryEnum.MENU);
|
||||
List<SysResource> sysResources = await App.GetService<ResourceService>().GetListByCategoryAsync(ResourceCategoryEnum.MENU);
|
||||
sysResources = sysResources.Where(it => it.TargetType == TargetTypeEnum.None).ToList();
|
||||
MenuCatalog = ResourceService.ResourceListToTree(sysResources);
|
||||
MenuCatalog = App.GetService<ResourceService>().ResourceListToTree(sysResources);
|
||||
return MenuCatalog;
|
||||
}
|
||||
|
||||
@@ -130,7 +127,7 @@ public partial class Menu
|
||||
}
|
||||
private async Task<SqlSugarPagedList<SysResource>> QueryCallAsync(MenuPageInput input)
|
||||
{
|
||||
var data = await MenuService.TreeAsync(input);
|
||||
var data = await App.GetService<MenuService>().TreeAsync(input);
|
||||
return data.ToPagedList(input);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
@using Masa.Blazor.Presets;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
@inject IOpenApiSessionService SessionService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -33,13 +33,13 @@ public partial class OpenApiSession
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("警告", "确定 ?");
|
||||
if (confirm)
|
||||
{
|
||||
await SessionService.ExitSessionAsync(id);
|
||||
await App.GetService<OpenApiSessionService>().ExitSessionAsync(id);
|
||||
}
|
||||
}
|
||||
|
||||
private Task<SqlSugarPagedList<OpenApiSessionOutput>> SessionQueryCallAsync(OpenApiSessionPageInput input)
|
||||
{
|
||||
return SessionService.PageAsync(input);
|
||||
return App.GetService<OpenApiSessionService>().PageAsync(input);
|
||||
}
|
||||
|
||||
private async Task ShowVerificatListAsync(List<VerificatInfo> verificatInfos)
|
||||
@@ -57,7 +57,7 @@ public partial class OpenApiSession
|
||||
VerificatIds = verificats.Select(it => it.Id).ToList(),
|
||||
Id = verificats.First().UserId
|
||||
};
|
||||
await SessionService.ExitVerificatAsync(send);
|
||||
await App.GetService<OpenApiSessionService>().ExitVerificatAsync(send);
|
||||
_verificatInfos.RemoveWhere(it => send.VerificatIds.Contains(it.Id));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
@using Masa.Blazor.Presets;
|
||||
@inject IOpenApiUserService OpenApiUserService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -31,21 +31,20 @@ public partial class OpenApiUserR
|
||||
bool IsShowRoles;
|
||||
List<OpenApiPermissionTreeSelector> RolesChoice = new();
|
||||
string SearchName;
|
||||
[Inject]
|
||||
IRoleService SysRoleService { get; set; }
|
||||
|
||||
private Task AddCallAsync(OpenApiUserAddInput input)
|
||||
{
|
||||
return OpenApiUserService.AddAsync(input);
|
||||
return App.GetService<OpenApiUserService>().AddAsync(input);
|
||||
}
|
||||
|
||||
private async Task DeleteCallAsync(IEnumerable<OpenApiUser> users)
|
||||
{
|
||||
await OpenApiUserService.DeleteAsync(users.Select(a => a.Id).ToArray());
|
||||
await App.GetService<OpenApiUserService>().DeleteAsync(users.Select(a => a.Id).ToArray());
|
||||
}
|
||||
|
||||
private Task EditCallAsync(OpenApiUserEditInput users)
|
||||
{
|
||||
return OpenApiUserService.EditAsync(users);
|
||||
return App.GetService<OpenApiUserService>().EditAsync(users);
|
||||
}
|
||||
|
||||
private List<OpenApiPermissionTreeSelector> GetRouters()
|
||||
@@ -61,7 +60,7 @@ public partial class OpenApiUserR
|
||||
OpenApiUserGrantPermissionInput userGrantRoleInput = new();
|
||||
userGrantRoleInput.Id = ChoiceUserId;
|
||||
userGrantRoleInput.PermissionList = RolesChoice.Select(it => it.ApiRoute).ToList();
|
||||
await OpenApiUserService.GrantRoleAsync(userGrantRoleInput);
|
||||
await App.GetService<OpenApiUserService>().GrantRoleAsync(userGrantRoleInput);
|
||||
IsShowRoles = false;
|
||||
await _datatable?.QueryClickAsync();
|
||||
}
|
||||
@@ -73,7 +72,7 @@ public partial class OpenApiUserR
|
||||
}
|
||||
private Task<SqlSugarPagedList<OpenApiUser>> QueryCallAsync(OpenApiUserPageInput input)
|
||||
{
|
||||
return OpenApiUserService.PageAsync(input);
|
||||
return App.GetService<OpenApiUserService>().PageAsync(input);
|
||||
}
|
||||
|
||||
private async Task UserStatusChangeAsync(OpenApiUser context, bool enable)
|
||||
@@ -81,9 +80,9 @@ public partial class OpenApiUserR
|
||||
try
|
||||
{
|
||||
if (enable)
|
||||
await OpenApiUserService.EnableUserAsync(context.Id);
|
||||
await App.GetService<OpenApiUserService>().EnableUserAsync(context.Id);
|
||||
else
|
||||
await OpenApiUserService.DisableUserAsync(context.Id);
|
||||
await App.GetService<OpenApiUserService>().DisableUserAsync(context.Id);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
@using System.Linq.Expressions;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
@inject IOperateLogService OperateLogService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -44,7 +44,7 @@ public partial class Oplog
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("删除", "确定 ?");
|
||||
if (confirm)
|
||||
{
|
||||
await OperateLogService.DeleteAsync(CategoryFilters.Select(it => it.Value).ToArray());
|
||||
await App.GetService<OperateLogService>().DeleteAsync(CategoryFilters.Select(it => it.Value).ToArray());
|
||||
await _datatable?.QueryClickAsync();
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public partial class Oplog
|
||||
input.Account = search.Account;
|
||||
input.Category = search.Category;
|
||||
input.ExeStatus = search.ExeStatus;
|
||||
return OperateLogService.PageAsync(input);
|
||||
return App.GetService<OperateLogService>().PageAsync(input);
|
||||
}
|
||||
[Inject]
|
||||
AjaxService AjaxService { get; set; }
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
@using Masa.Blazor.Presets;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
@inject IRoleService SysRoleService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -38,27 +38,23 @@ public partial class Role
|
||||
[CascadingParameter]
|
||||
MainLayout MainLayout { get; set; }
|
||||
|
||||
[Inject]
|
||||
IResourceService ResourceService { get; set; }
|
||||
|
||||
|
||||
private string SearchKey { get; set; }
|
||||
|
||||
[Inject]
|
||||
ISysUserService SysUserService { get; set; }
|
||||
|
||||
private Task AddCallAsync(RoleAddInput input)
|
||||
{
|
||||
return SysRoleService.AddAsync(input);
|
||||
return App.GetService<RoleService>().AddAsync(input);
|
||||
}
|
||||
private async Task DeleteCallAsync(IEnumerable<SysRole> sysRoles)
|
||||
{
|
||||
await SysRoleService.DeleteAsync(sysRoles.Select(a => a.Id).ToArray());
|
||||
await App.GetService<RoleService>().DeleteAsync(sysRoles.Select(a => a.Id).ToArray());
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
private async Task EditCallAsync(RoleEditInput input)
|
||||
{
|
||||
await SysRoleService.EditAsync(input);
|
||||
await App.GetService<RoleService>().EditAsync(input);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
private async Task OnRoleHasResuorcesSaveAsync(ModalActionEventArgs args)
|
||||
@@ -69,7 +65,7 @@ public partial class Role
|
||||
var data = new List<SysResource>();
|
||||
userGrantRoleInput.Id = ChoiceRoleId;
|
||||
userGrantRoleInput.GrantInfoList = RoleHasResuorces;
|
||||
await SysRoleService.GrantResourceAsync(userGrantRoleInput);
|
||||
await App.GetService<RoleService>().GrantResourceAsync(userGrantRoleInput);
|
||||
IsShowResuorces = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -86,7 +82,7 @@ public partial class Role
|
||||
GrantUserInput userGrantRoleInput = new();
|
||||
userGrantRoleInput.Id = ChoiceRoleId;
|
||||
userGrantRoleInput.GrantInfoList = UsersChoice.Select(it => it.Id).ToList();
|
||||
await SysRoleService.GrantUserAsync(userGrantRoleInput);
|
||||
await App.GetService<RoleService>().GrantUserAsync(userGrantRoleInput);
|
||||
IsShowUsers = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -99,19 +95,19 @@ public partial class Role
|
||||
|
||||
private Task<SqlSugarPagedList<SysRole>> QueryCallAsync(RolePageInput input)
|
||||
{
|
||||
return SysRoleService.PageAsync(input);
|
||||
return App.GetService<RoleService>().PageAsync(input);
|
||||
}
|
||||
|
||||
private async Task ResuorceInitAsync()
|
||||
{
|
||||
ResTreeSelectors = (await ResourceService.GetRoleGrantResourceMenusAsync());
|
||||
RoleHasResuorces = (await SysRoleService.OwnResourceAsync(ChoiceRoleId))?.GrantInfoList;
|
||||
ResTreeSelectors = (await App.GetService<ResourceService>().GetRoleGrantResourceMenusAsync());
|
||||
RoleHasResuorces = (await App.GetService<RoleService>().OwnResourceAsync(ChoiceRoleId))?.GrantInfoList;
|
||||
}
|
||||
|
||||
private async Task<List<UserSelectorOutput>> UserInitAsync()
|
||||
{
|
||||
AllUsers = await SysUserService.UserSelectorAsync(SearchKey);
|
||||
var data = await SysRoleService.OwnUserAsync(ChoiceRoleId);
|
||||
AllUsers = await App.GetService<SysUserService>().UserSelectorAsync(SearchKey);
|
||||
var data = await App.GetService<RoleService>().OwnUserAsync(ChoiceRoleId);
|
||||
UsersChoice = AllUsers.Where(a => data.Contains(a.Id)).ToList();
|
||||
return AllUsers;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
@using Masa.Blazor.Presets;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
|
||||
@inject ISessionService SessionService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -33,14 +33,14 @@ public partial class Session
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("警告", "确定 ?");
|
||||
if (confirm)
|
||||
{
|
||||
await SessionService.ExitSessionAsync(id);
|
||||
await App.GetService<SessionService>().ExitSessionAsync(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Task<SqlSugarPagedList<SessionOutput>> SessionQueryCallAsync(SessionPageInput input)
|
||||
{
|
||||
return SessionService.PageAsync(input);
|
||||
return App.GetService<SessionService>().PageAsync(input);
|
||||
}
|
||||
|
||||
private async Task ShowVerificatListAsync(List<VerificatInfo> verificatInfos)
|
||||
@@ -58,7 +58,7 @@ public partial class Session
|
||||
VerificatIds = verificats.Select(it => it.Id).ToList(),
|
||||
Id = verificats.First().UserId
|
||||
};
|
||||
await SessionService.ExitVerificatAsync(send);
|
||||
await App.GetService<SessionService>().ExitVerificatAsync(send);
|
||||
_verificatInfos.RemoveWhere(it => send.VerificatIds.Contains(it.Id));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
@using Masa.Blazor.Presets;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
@inject ISpaService SpaService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inherits BaseComponentBase
|
||||
|
||||
@@ -27,23 +27,23 @@ public partial class Spa
|
||||
|
||||
private async Task AddCallAsync(SpaAddInput input)
|
||||
{
|
||||
await SpaService.AddAsync(input);
|
||||
await App.GetService<SpaService>().AddAsync(input);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
private async Task DeleteCallAsync(IEnumerable<SysResource> input)
|
||||
{
|
||||
await SpaService.DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
await App.GetService<SpaService>().DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
private async Task EditCallAsync(SpaEditInput input)
|
||||
{
|
||||
await SpaService.EditAsync(input);
|
||||
await App.GetService<SpaService>().EditAsync(input);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
private Task<SqlSugarPagedList<SysResource>> QueryCallAsync(SpaPageInput input)
|
||||
{
|
||||
return SpaService.PageAsync(input);
|
||||
return App.GetService<SpaService>().PageAsync(input);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
*@
|
||||
|
||||
@page "/admin/user"
|
||||
@inject ISysUserService SysUserService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@using Masa.Blazor.Presets;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
@@ -34,21 +34,20 @@ public partial class User
|
||||
[CascadingParameter]
|
||||
MainLayout MainLayout { get; set; }
|
||||
|
||||
[Inject]
|
||||
IRoleService SysRoleService { get; set; }
|
||||
|
||||
private Task AddCallAsync(UserAddInput input)
|
||||
{
|
||||
return SysUserService.AddAsync(input);
|
||||
return App.GetService<SysUserService>().AddAsync(input);
|
||||
}
|
||||
private async Task DeleteCallAsync(IEnumerable<SysUser> users)
|
||||
{
|
||||
await SysUserService.DeleteAsync(users.Select(a => a.Id).ToArray());
|
||||
await App.GetService<SysUserService>().DeleteAsync(users.Select(a => a.Id).ToArray());
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
private async Task EditCallAsync(UserEditInput users)
|
||||
{
|
||||
await SysUserService.EditAsync(users);
|
||||
await App.GetService<SysUserService>().EditAsync(users);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
@@ -59,7 +58,7 @@ public partial class User
|
||||
UserGrantRoleInput userGrantRoleInput = new();
|
||||
userGrantRoleInput.Id = ChoiceUserId;
|
||||
userGrantRoleInput.RoleIdList = RolesChoice.Select(it => it.Id).ToList();
|
||||
await SysUserService.GrantRoleAsync(userGrantRoleInput);
|
||||
await App.GetService<SysUserService>().GrantRoleAsync(userGrantRoleInput);
|
||||
IsShowRoles = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -71,20 +70,20 @@ public partial class User
|
||||
}
|
||||
private Task<SqlSugarPagedList<SysUser>> QueryCallAsync(UserPageInput input)
|
||||
{
|
||||
return SysUserService.PageAsync(input);
|
||||
return App.GetService<SysUserService>().PageAsync(input);
|
||||
}
|
||||
|
||||
private async Task ResetPasswordAsync(SysUser sysUser)
|
||||
{
|
||||
await SysUserService.ResetPasswordAsync(sysUser.Id);
|
||||
await App.GetService<SysUserService>().ResetPasswordAsync(sysUser.Id);
|
||||
await PopupService.EnqueueSnackbarAsync(new("成功", AlertTypes.Success));
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
private async Task RoleInitAsync()
|
||||
{
|
||||
AllRoles = await SysRoleService.RoleSelectorAsync();
|
||||
var data = await SysRoleService.GetRoleIdListByUserIdAsync(ChoiceUserId);
|
||||
AllRoles = await App.GetService<RoleService>().RoleSelectorAsync();
|
||||
var data = await App.GetService<RoleService>().GetRoleIdListByUserIdAsync(ChoiceUserId);
|
||||
RolesChoice = AllRoles.Where(a => data.Contains(a.Id)).ToList();
|
||||
}
|
||||
private async Task UserStatusChangeAsync(SysUser context, bool enable)
|
||||
@@ -92,9 +91,9 @@ public partial class User
|
||||
try
|
||||
{
|
||||
if (enable)
|
||||
await SysUserService.EnableUserAsync(context.Id);
|
||||
await App.GetService<SysUserService>().EnableUserAsync(context.Id);
|
||||
else
|
||||
await SysUserService.DisableUserAsync(context.Id);
|
||||
await App.GetService<SysUserService>().DisableUserAsync(context.Id);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -33,8 +33,7 @@ public partial class UserCenter
|
||||
[Inject]
|
||||
NavigationManager NavigationManager { get; set; }
|
||||
|
||||
[Inject]
|
||||
IUserCenterService UserCenterService { get; set; }
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override async Task OnParametersSetAsync()
|
||||
@@ -48,14 +47,14 @@ public partial class UserCenter
|
||||
|
||||
async Task OnDefaultRazorSaveAsync()
|
||||
{
|
||||
await UserCenterService.UpdateUserDefaultRazorAsync(UserManager.UserId, DefaultMenuId);
|
||||
await App.GetService<UserCenterService>().UpdateUserDefaultRazorAsync(UserManager.UserId, DefaultMenuId);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
|
||||
}
|
||||
|
||||
async Task OnShortcutSaveAsync()
|
||||
{
|
||||
await UserCenterService.UpdateWorkbenchAsync(_menusChoice);
|
||||
await App.GetService<UserCenterService>().UpdateWorkbenchAsync(_menusChoice);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
|
||||
}
|
||||
@@ -66,7 +65,7 @@ public partial class UserCenter
|
||||
{
|
||||
//验证成功,操作业务
|
||||
_passwordInfoInput.Id = UserResoures.CurrentUser.Id;
|
||||
await UserCenterService.EditPasswordAsync(_passwordInfoInput);
|
||||
await App.GetService<UserCenterService>().EditPasswordAsync(_passwordInfoInput);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("成功,将重新登录", AlertTypes.Success);
|
||||
await Task.Delay(2000);
|
||||
@@ -76,7 +75,7 @@ public partial class UserCenter
|
||||
|
||||
async Task OnUpdateUserInfoAsync()
|
||||
{
|
||||
await UserCenterService.UpdateUserInfoAsync(_updateInfoInput);
|
||||
await App.GetService<UserCenterService>().UpdateUserInfoAsync(_updateInfoInput);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
@using System.Linq.Expressions;
|
||||
@using Microsoft.AspNetCore.Authorization;
|
||||
@using ThingsGateway.Admin.Application;
|
||||
|
||||
@inject IVisitLogService VisitLogService
|
||||
|
||||
@namespace ThingsGateway.Admin.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -51,14 +51,14 @@ public partial class Vislog
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("删除", "确定 ?");
|
||||
if (confirm)
|
||||
{
|
||||
await VisitLogService.DeleteAsync(CategoryFilters.Select(it => it.Value).ToArray());
|
||||
await App.GetService<VisitLogService>().DeleteAsync(CategoryFilters.Select(it => it.Value).ToArray());
|
||||
await _datatable?.QueryClickAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<SqlSugarPagedList<SysVisitLog>> QueryCallAsync(VisitLogPageInput input)
|
||||
{
|
||||
var data = await VisitLogService.PageAsync(input);
|
||||
var data = await App.GetService<VisitLogService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
[Inject]
|
||||
|
||||
@@ -40,10 +40,6 @@ public partial class Login
|
||||
AjaxService AjaxService { get; set; }
|
||||
|
||||
|
||||
[Inject]
|
||||
IAuthService AuthService { get; set; }
|
||||
|
||||
|
||||
|
||||
string UserLogoUrl { get; set; } = BlazorResourceConst.ResourceUrl + "images/defaultUser.svg";
|
||||
|
||||
@@ -65,12 +61,7 @@ public partial class Login
|
||||
}
|
||||
}
|
||||
private PImageCaptcha captcha;
|
||||
[Inject]
|
||||
IUserCenterService UserCenterService { get; set; }
|
||||
[Inject]
|
||||
IResourceService ResourceService { get; set; }
|
||||
[Inject]
|
||||
ISysUserService SysUserService { get; set; }
|
||||
|
||||
private async Task LoginAsync()
|
||||
{
|
||||
loginModel.ValidCodeReqNo = CaptchaInfo.ValidCodeReqNo;
|
||||
@@ -102,9 +93,9 @@ public partial class Login
|
||||
{
|
||||
await PopupService.EnqueueSnackbarAsync(new("登录成功", AlertTypes.Success));
|
||||
await Task.Delay(500);
|
||||
var userId = await SysUserService.GetIdByAccountAsync(loginModel.Account);
|
||||
var data = await UserCenterService.GetLoginDefaultRazorAsync(userId);
|
||||
var sameLevelMenus = await ResourceService.GetaMenuAndSpaListAsync();
|
||||
var userId = await App.GetService<SysUserService>().GetIdByAccountAsync(loginModel.Account);
|
||||
var data = await App.GetService<UserCenterService>().GetLoginDefaultRazorAsync(userId);
|
||||
var sameLevelMenus = await App.GetService<ResourceService>().GetaMenuAndSpaListAsync();
|
||||
if (NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsolutePath == "/Login" || NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsolutePath == "/")
|
||||
await AjaxService.GotoAsync(sameLevelMenus.FirstOrDefault(a => a.Id == data)?.Component ?? "index");
|
||||
else
|
||||
@@ -141,12 +132,12 @@ public partial class Login
|
||||
|
||||
private void GetCaptchaInfo()
|
||||
{
|
||||
CaptchaInfo = AuthService.GetCaptchaInfo();
|
||||
CaptchaInfo = App.GetService<AuthService>().GetCaptchaInfo();
|
||||
}
|
||||
|
||||
private Task<string> RefreshCode()
|
||||
{
|
||||
CaptchaInfo = AuthService.GetCaptchaInfo();
|
||||
CaptchaInfo = App.GetService<AuthService>().GetCaptchaInfo();
|
||||
return Task.FromResult(CaptchaInfo.CodeValue);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class DeviceVariableRunTime : DeviceVariable
|
||||
/// <param name="value"></param>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <param name="isOnline"></param>
|
||||
public OperResult SetValue(object value, DateTime dateTime = default,bool isOnline=true)
|
||||
public OperResult SetValue(object value, DateTime dateTime = default, bool isOnline = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -677,9 +677,9 @@ public class CollectDeviceCore
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isRead&& !result.IsSuccess)
|
||||
if (isRead && !result.IsSuccess)
|
||||
{
|
||||
var operResult = deviceVariableMethodSource.DeviceVariable.SetValue(null,isOnline: false);
|
||||
var operResult = deviceVariableMethodSource.DeviceVariable.SetValue(null, isOnline: false);
|
||||
if (!operResult.IsSuccess)
|
||||
{
|
||||
_logger?.LogWarning(operResult.Message, ToString());
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
using Furion;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.JSInterop;
|
||||
@@ -65,11 +67,7 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
/// 写入值
|
||||
/// </summary>
|
||||
public virtual string WriteValue { get; set; }
|
||||
[Inject]
|
||||
private ICollectDeviceService CollectDeviceService { get; set; }
|
||||
|
||||
[Inject]
|
||||
private IVariableService VariableService { get; set; }
|
||||
[Inject]
|
||||
private InitTimezone InitTimezone { get; set; }
|
||||
|
||||
@@ -133,7 +131,7 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
{
|
||||
isDownExport = true;
|
||||
StateHasChanged();
|
||||
await CollectDeviceService.AddAsync(data);
|
||||
await App.GetService<CollectDeviceService>().AddAsync(data);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -151,7 +149,7 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
{
|
||||
isDownExport = true;
|
||||
StateHasChanged();
|
||||
await VariableService.AddBatchAsync(data);
|
||||
await App.GetService<VariableService>().AddBatchAsync(data);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -199,7 +197,7 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
{
|
||||
isDownExport = true;
|
||||
StateHasChanged();
|
||||
using var memoryStream = await CollectDeviceService.ExportFileAsync(new List<CollectDevice>() { data });
|
||||
using var memoryStream = await App.GetService<CollectDeviceService>().ExportFileAsync(new List<CollectDevice>() { data });
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
using var streamRef = new DotNetStreamReference(stream: memoryStream);
|
||||
_helper ??= await JS.InvokeAsync<IJSObjectReference>("import", $"/_content/ThingsGateway.Admin.Blazor.Core/js/downloadFileFromStream.js");
|
||||
@@ -221,7 +219,7 @@ public abstract class DriverDebugUIBase : ComponentBase, IDisposable
|
||||
{
|
||||
isDownExport = true;
|
||||
StateHasChanged();
|
||||
using var memoryStream = await VariableService.ExportFileAsync(data, devName);
|
||||
using var memoryStream = await App.GetService<VariableService>().ExportFileAsync(data, devName);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
using var streamRef = new DotNetStreamReference(stream: memoryStream);
|
||||
_helper ??= await JS.InvokeAsync<IJSObjectReference>("import", $"/_content/ThingsGateway.Admin.Blazor.Core/js/downloadFileFromStream.js");
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
@page "/gatewaylog/backendlog"
|
||||
@using System.Linq.Expressions;
|
||||
@inject IBackendLogService BackendLogService
|
||||
|
||||
@inject UserResoures UserResoures
|
||||
@namespace ThingsGateway.Blazor
|
||||
@using BlazorComponent;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
using Furion;
|
||||
|
||||
using Mapster;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@@ -37,7 +39,7 @@ public partial class BackendLogPage
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("删除", "确定 ?");
|
||||
if (confirm)
|
||||
{
|
||||
await BackendLogService.DeleteAsync();
|
||||
await App.GetService<BackendLogService>().DeleteAsync();
|
||||
await _datatable?.QueryClickAsync();
|
||||
}
|
||||
}
|
||||
@@ -56,7 +58,7 @@ public partial class BackendLogPage
|
||||
|
||||
private async Task<SqlSugarPagedList<BackendLog>> QueryCallAsync(BackendLogPageInput input)
|
||||
{
|
||||
var data = await BackendLogService.PageAsync(input);
|
||||
var data = await App.GetService<BackendLogService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
@namespace ThingsGateway.Blazor
|
||||
@using System.Linq.Expressions;
|
||||
@using BlazorComponent;
|
||||
@using Furion;
|
||||
@using Mapster;
|
||||
@using Masa.Blazor
|
||||
@using Masa.Blazor.Presets;
|
||||
@@ -22,11 +23,11 @@
|
||||
@using ThingsGateway.Admin.Blazor.Core;
|
||||
@using ThingsGateway.Admin.Blazor;
|
||||
@using ThingsGateway.Application;
|
||||
@inject ICollectDeviceService CollectDeviceService
|
||||
|
||||
@attribute [Authorize]
|
||||
@inherits BaseComponentBase
|
||||
@inject UserResoures UserResoures
|
||||
@inject IDriverPluginService DriverPluginService
|
||||
|
||||
@layout MainLayout
|
||||
@using ThingsGateway.Admin.Core;
|
||||
@if (IsMobile)
|
||||
@@ -172,7 +173,7 @@ else
|
||||
case nameof(context.Item.PluginId):
|
||||
<span title=@context.Value>
|
||||
@(
|
||||
DriverPluginService.GetNameById(context.Item.PluginId)
|
||||
App.GetService<DriverPluginService>().GetNameById(context.Item.PluginId)
|
||||
)
|
||||
</span>
|
||||
break;
|
||||
|
||||
@@ -57,8 +57,8 @@ public partial class CollectDevicePage
|
||||
|
||||
private async Task AddCallAsync(CollectDeviceAddInput input)
|
||||
{
|
||||
await CollectDeviceService.AddAsync(input);
|
||||
CollectDevices = CollectDeviceService.GetCacheList();
|
||||
await App.GetService<CollectDeviceService>().AddAsync(input);
|
||||
CollectDevices = App.GetService<CollectDeviceService>().GetCacheList();
|
||||
_deviceGroups = CollectDevices?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public partial class CollectDevicePage
|
||||
return;
|
||||
}
|
||||
|
||||
await CollectDeviceService.CopyDevAndVarAsync(data);
|
||||
await App.GetService<CollectDeviceService>().CopyDevAndVarAsync(data);
|
||||
await DatatableQueryAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("复制成功", AlertTypes.Success);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
@@ -85,7 +85,7 @@ public partial class CollectDevicePage
|
||||
return;
|
||||
}
|
||||
|
||||
await CollectDeviceService.CopyDevAsync(data);
|
||||
await App.GetService<CollectDeviceService>().CopyDevAsync(data);
|
||||
await DatatableQueryAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("复制成功", AlertTypes.Success);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
@@ -98,15 +98,15 @@ public partial class CollectDevicePage
|
||||
|
||||
private async Task DeleteCallAsync(IEnumerable<CollectDevice> input)
|
||||
{
|
||||
await CollectDeviceService.DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
CollectDevices = CollectDeviceService.GetCacheList();
|
||||
await App.GetService<CollectDeviceService>().DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
CollectDevices = App.GetService<CollectDeviceService>().GetCacheList();
|
||||
_deviceGroups = CollectDevices?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
Task<Dictionary<string, ImportPreviewOutputBase>> DeviceImportAsync(IBrowserFile file)
|
||||
{
|
||||
return CollectDeviceService.PreviewAsync(file);
|
||||
return App.GetService<CollectDeviceService>().PreviewAsync(file);
|
||||
}
|
||||
async Task DownExportAsync(CollectDevicePageInput input = null)
|
||||
{
|
||||
@@ -133,8 +133,8 @@ public partial class CollectDevicePage
|
||||
|
||||
private async Task EditCallAsync(CollectDeviceEditInput input)
|
||||
{
|
||||
await CollectDeviceService.EditAsync(input);
|
||||
CollectDevices = CollectDeviceService.GetCacheList();
|
||||
await App.GetService<CollectDeviceService>().EditAsync(input);
|
||||
CollectDevices = App.GetService<CollectDeviceService>().GetCacheList();
|
||||
_deviceGroups = CollectDevices?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
@@ -147,13 +147,13 @@ public partial class CollectDevicePage
|
||||
|
||||
private async Task<SqlSugarPagedList<CollectDevice>> QueryCallAsync(CollectDevicePageInput input)
|
||||
{
|
||||
var data = await CollectDeviceService.PageAsync(input);
|
||||
var data = await App.GetService<CollectDeviceService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
|
||||
async Task SaveDeviceImportAsync(Dictionary<string, ImportPreviewOutputBase> data)
|
||||
{
|
||||
await CollectDeviceService.ImportAsync(data);
|
||||
await App.GetService<CollectDeviceService>().ImportAsync(data);
|
||||
await DatatableQueryAsync();
|
||||
ImportExcel.IsShowImport = false;
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
@using ThingsGateway.Admin.Blazor;
|
||||
@using ThingsGateway.Admin.Core;
|
||||
@using ThingsGateway.Application;
|
||||
|
||||
@inject IConfigService ConfigService
|
||||
|
||||
@namespace ThingsGateway.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -56,7 +56,7 @@ public partial class ConfigPage
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("确认", "保存配置后将重启报警服务,是否确定?");
|
||||
if (confirm)
|
||||
{
|
||||
await ConfigService.EditBatchAsync(_alarmConfig);
|
||||
await App.GetService<ConfigService>().EditBatchAsync(_alarmConfig);
|
||||
await AlarmHostService.RestartAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public partial class ConfigPage
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("确认", "保存配置后将重启历史服务,是否确定?");
|
||||
if (confirm)
|
||||
{
|
||||
await ConfigService.EditBatchAsync(_hisConfig);
|
||||
await App.GetService<ConfigService>().EditBatchAsync(_hisConfig);
|
||||
await HistoryValueHostService.RestartAsync();
|
||||
await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success);
|
||||
}
|
||||
|
||||
@@ -24,14 +24,12 @@
|
||||
@using ThingsGateway.Admin.Core;
|
||||
@using ThingsGateway.Application;
|
||||
@using TouchSocket.Core;
|
||||
@inject ICollectDeviceService CollectDeviceService
|
||||
@inject IUploadDeviceService UploadDeviceService
|
||||
|
||||
|
||||
@attribute [Authorize]
|
||||
@inherits BaseComponentBase
|
||||
@inject UserResoures UserResoures
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IDriverPluginService DriverPluginService
|
||||
|
||||
@layout MainLayout
|
||||
<MSheet Style="overflow:auto">
|
||||
|
||||
|
||||
@@ -73,8 +73,6 @@ public partial class DeviceStatusPage : IDisposable
|
||||
|
||||
UploadDeviceWorker UploadDeviceHostService { get; set; }
|
||||
StringNumber Uppanel { get; set; }
|
||||
[Inject]
|
||||
IVariableService VariableService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -53,8 +53,6 @@ public partial class DeviceVariablePage
|
||||
[Inject]
|
||||
AjaxService AjaxService { get; set; }
|
||||
|
||||
[Inject]
|
||||
IVariableService VariableService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
@@ -70,7 +68,7 @@ public partial class DeviceVariablePage
|
||||
}
|
||||
private async Task AddCallAsync(DeviceVariableAddInput input)
|
||||
{
|
||||
await VariableService.AddAsync(input);
|
||||
await App.GetService<VariableService>().AddAsync(input);
|
||||
}
|
||||
|
||||
private async Task ClearAsync()
|
||||
@@ -78,7 +76,7 @@ public partial class DeviceVariablePage
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("确认", "清空?");
|
||||
if (confirm)
|
||||
{
|
||||
await VariableService.ClearDeviceVariableAsync();
|
||||
await App.GetService<VariableService>().ClearDeviceVariableAsync();
|
||||
}
|
||||
await DatatableQueryAsync();
|
||||
|
||||
@@ -91,7 +89,7 @@ public partial class DeviceVariablePage
|
||||
|
||||
private async Task DeleteCallAsync(IEnumerable<DeviceVariable> input)
|
||||
{
|
||||
await VariableService.DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
await App.GetService<VariableService>().DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
}
|
||||
|
||||
void DeviceChanged(long devId)
|
||||
@@ -107,7 +105,7 @@ public partial class DeviceVariablePage
|
||||
|
||||
Task<Dictionary<string, ImportPreviewOutputBase>> DeviceImportAsync(IBrowserFile file)
|
||||
{
|
||||
return VariableService.PreviewAsync(file);
|
||||
return App.GetService<VariableService>().PreviewAsync(file);
|
||||
}
|
||||
async Task DownExportAsync(DeviceVariablePageInput input = null)
|
||||
{
|
||||
@@ -116,7 +114,7 @@ public partial class DeviceVariablePage
|
||||
|
||||
private async Task EditCallAsync(VariableEditInput input)
|
||||
{
|
||||
await VariableService.EditAsync(input);
|
||||
await App.GetService<VariableService>().EditAsync(input);
|
||||
}
|
||||
|
||||
List<DependencyProperty> GetDriverProperties(long driverId, List<DependencyProperty> dependencyProperties)
|
||||
@@ -126,13 +124,13 @@ public partial class DeviceVariablePage
|
||||
|
||||
private async Task<SqlSugarPagedList<DeviceVariable>> QueryCallAsync(DeviceVariablePageInput input)
|
||||
{
|
||||
var data = await VariableService.PageAsync(input);
|
||||
var data = await App.GetService<VariableService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
|
||||
async Task SaveDeviceImportAsync(Dictionary<string, ImportPreviewOutputBase> data)
|
||||
{
|
||||
await VariableService.ImportAsync(data);
|
||||
await App.GetService<VariableService>().ImportAsync(data);
|
||||
await DatatableQueryAsync();
|
||||
ImportExcel.IsShowImport = false;
|
||||
}
|
||||
|
||||
@@ -52,8 +52,6 @@ public partial class DeviceVariableRunTimePage
|
||||
GlobalDeviceData GlobalDeviceData { get; set; }
|
||||
|
||||
VariablePageInput SearchModel { get; set; } = new();
|
||||
[Inject]
|
||||
IUploadDeviceService UploadDeviceService { get; set; }
|
||||
|
||||
CollectDeviceWorker CollectDeviceHostService { get; set; }
|
||||
[Inject]
|
||||
@@ -121,7 +119,7 @@ public partial class DeviceVariableRunTimePage
|
||||
|
||||
private Task<SqlSugarPagedList<DeviceVariableRunTime>> QueryCallAsync(VariablePageInput input)
|
||||
{
|
||||
var uploadDevId = UploadDeviceService.GetIdByName(input.UploadDeviceName);
|
||||
var uploadDevId = App.GetService<UploadDeviceService>().GetIdByName(input.UploadDeviceName);
|
||||
var data = GlobalDeviceData.AllVariables
|
||||
.WhereIF(!input.DeviceName.IsNullOrEmpty(), a => a.DeviceName == input.DeviceName)
|
||||
.WhereIF(!input.Name.IsNullOrEmpty(), a => a.Name.Contains(input.Name))
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
@using ThingsGateway.Admin.Blazor;
|
||||
@using ThingsGateway.Admin.Core;
|
||||
@using ThingsGateway.Application;
|
||||
@inject IVariableService VariableService
|
||||
|
||||
@attribute [Authorize]
|
||||
@inherits BaseComponentBase
|
||||
@inject UserResoures UserResoures
|
||||
@inject ICollectDeviceService CollectDeviceService
|
||||
|
||||
@layout MainLayout
|
||||
|
||||
<MRow NoGutters>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
using BlazorComponent;
|
||||
|
||||
using Furion;
|
||||
|
||||
using Masa.Blazor;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@@ -33,14 +35,13 @@ public partial class DriverDebugPage
|
||||
List<DriverPluginCategory> DriverPlugins;
|
||||
bool IsShowTreeView = true;
|
||||
PluginDebugUIInput SearchModel { get; set; } = new();
|
||||
[Inject]
|
||||
IDriverPluginService DriverPluginService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
DriverPlugins = DriverPluginService.GetDriverPluginChildrenList();
|
||||
DriverPlugins = App.GetService<DriverPluginService>().GetDriverPluginChildrenList();
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
@using ThingsGateway.Admin.Blazor;
|
||||
@using ThingsGateway.Admin.Core;
|
||||
@using ThingsGateway.Application;
|
||||
@inject IDriverPluginService DriverPluginService
|
||||
|
||||
@attribute [Authorize]
|
||||
@inherits BaseComponentBase
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
using Furion;
|
||||
|
||||
using ThingsGateway.Admin.Blazor.Core;
|
||||
using ThingsGateway.Admin.Core;
|
||||
using ThingsGateway.Application;
|
||||
@@ -25,12 +27,12 @@ public partial class DriverPluginPage
|
||||
|
||||
private async Task AddCallAsync(DriverPluginAddInput input)
|
||||
{
|
||||
await DriverPluginService.AddAsync(input);
|
||||
await App.GetService<DriverPluginService>().AddAsync(input);
|
||||
}
|
||||
|
||||
private async Task<SqlSugarPagedList<DriverPlugin>> QueryCallAsync(DriverPluginPageInput input)
|
||||
{
|
||||
var data = await DriverPluginService.PageAsync(input);
|
||||
var data = await App.GetService<DriverPluginService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -45,11 +45,6 @@ public partial class MemoryVariablePage
|
||||
[Inject]
|
||||
AjaxService AjaxService { get; set; }
|
||||
|
||||
[Inject]
|
||||
InitTimezone InitTimezone { get; set; }
|
||||
|
||||
[Inject]
|
||||
IVariableService VariableService { get; set; }
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
@@ -70,7 +65,7 @@ public partial class MemoryVariablePage
|
||||
|
||||
private async Task AddCallAsync(MemoryVariableAddInput input)
|
||||
{
|
||||
await VariableService.AddAsync(input);
|
||||
await App.GetService<VariableService>().AddAsync(input);
|
||||
}
|
||||
|
||||
private async Task ClearAsync()
|
||||
@@ -78,7 +73,7 @@ public partial class MemoryVariablePage
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("确认", "清空?");
|
||||
if (confirm)
|
||||
{
|
||||
await VariableService.ClearMemoryVariableAsync();
|
||||
await App.GetService<VariableService>().ClearMemoryVariableAsync();
|
||||
}
|
||||
await DatatableQueryAsync();
|
||||
|
||||
@@ -91,12 +86,12 @@ public partial class MemoryVariablePage
|
||||
|
||||
private async Task DeleteCallAsync(IEnumerable<DeviceVariable> input)
|
||||
{
|
||||
await VariableService.DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
await App.GetService<VariableService>().DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
}
|
||||
|
||||
Task<Dictionary<string, ImportPreviewOutputBase>> DeviceImportAsync(IBrowserFile file)
|
||||
{
|
||||
return VariableService.MemoryVariablePreviewAsync(file);
|
||||
return App.GetService<VariableService>().MemoryVariablePreviewAsync(file);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +103,7 @@ public partial class MemoryVariablePage
|
||||
|
||||
private async Task EditCallAsync(MemoryVariableAddInput input)
|
||||
{
|
||||
await VariableService.EditAsync(input);
|
||||
await App.GetService<VariableService>().EditAsync(input);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,12 +114,12 @@ public partial class MemoryVariablePage
|
||||
|
||||
private async Task<SqlSugarPagedList<DeviceVariable>> QueryCallAsync(MemoryVariablePageInput input)
|
||||
{
|
||||
var data = await VariableService.PageAsync(input);
|
||||
var data = await App.GetService<VariableService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
async Task SaveDeviceImportAsync(Dictionary<string, ImportPreviewOutputBase> data)
|
||||
{
|
||||
await VariableService.ImportAsync(data);
|
||||
await App.GetService<VariableService>().ImportAsync(data);
|
||||
await DatatableQueryAsync();
|
||||
ImportExcel.IsShowImport = false;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
@using ThingsGateway.Admin.Blazor;
|
||||
@using ThingsGateway.Admin.Core;
|
||||
@using ThingsGateway.Application;
|
||||
@inject IRpcLogService RpcLogService
|
||||
|
||||
@namespace ThingsGateway.Blazor
|
||||
@attribute [Authorize]
|
||||
@inject UserResoures UserResoures
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
using Furion;
|
||||
|
||||
using Mapster;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@@ -36,7 +38,7 @@ public partial class RpcLogPage
|
||||
var confirm = await PopupService.OpenConfirmDialogAsync("删除", "确定 ?");
|
||||
if (confirm)
|
||||
{
|
||||
await RpcLogService.DeleteAsync();
|
||||
await App.GetService<RpcLogService>().DeleteAsync();
|
||||
await _datatable?.QueryClickAsync();
|
||||
}
|
||||
}
|
||||
@@ -54,7 +56,7 @@ public partial class RpcLogPage
|
||||
|
||||
private async Task<SqlSugarPagedList<RpcLog>> QueryCallAsync(RpcLogPageInput input)
|
||||
{
|
||||
var data = await RpcLogService.PageAsync(input);
|
||||
var data = await App.GetService<RpcLogService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
@namespace ThingsGateway.Blazor
|
||||
@using System.Linq.Expressions;
|
||||
@using BlazorComponent;
|
||||
@using Furion;
|
||||
@using Mapster;
|
||||
@using Masa.Blazor.Presets;
|
||||
@using System.IO;
|
||||
@@ -149,7 +150,7 @@ else
|
||||
case nameof(context.Item.PluginId):
|
||||
<span title=@context.Value>
|
||||
@(
|
||||
DriverPluginService.GetNameById(context.Item.PluginId)
|
||||
App.GetService<DriverPluginService>().GetNameById(context.Item.PluginId)
|
||||
)
|
||||
</span>
|
||||
break;
|
||||
|
||||
@@ -44,16 +44,10 @@ public partial class UploadDevicePage
|
||||
StringNumber tab;
|
||||
[Inject]
|
||||
AjaxService AjaxService { get; set; }
|
||||
[Inject]
|
||||
IDriverPluginService DriverPluginService { get; set; }
|
||||
|
||||
[Inject]
|
||||
InitTimezone InitTimezone { get; set; }
|
||||
|
||||
[CascadingParameter]
|
||||
MainLayout MainLayout { get; set; }
|
||||
[Inject]
|
||||
IUploadDeviceService UploadDeviceService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
@@ -67,8 +61,8 @@ public partial class UploadDevicePage
|
||||
}
|
||||
private async Task AddCallAsync(UploadDeviceAddInput input)
|
||||
{
|
||||
await UploadDeviceService.AddAsync(input);
|
||||
_deviceGroups = UploadDeviceService.GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await App.GetService<UploadDeviceService>().AddAsync(input);
|
||||
_deviceGroups = App.GetService<UploadDeviceService>().GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
@@ -80,7 +74,7 @@ public partial class UploadDevicePage
|
||||
return;
|
||||
}
|
||||
|
||||
await UploadDeviceService.CopyDevAsync(data);
|
||||
await App.GetService<UploadDeviceService>().CopyDevAsync(data);
|
||||
await DatatableQuery();
|
||||
await PopupService.EnqueueSnackbarAsync("复制成功", AlertTypes.Success);
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
@@ -93,14 +87,14 @@ public partial class UploadDevicePage
|
||||
|
||||
private async Task DeleteCallAsync(IEnumerable<UploadDevice> input)
|
||||
{
|
||||
await UploadDeviceService.DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
_deviceGroups = UploadDeviceService.GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await App.GetService<UploadDeviceService>().DeleteAsync(input.Select(a => a.Id).ToArray());
|
||||
_deviceGroups = App.GetService<UploadDeviceService>().GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
Task<Dictionary<string, ImportPreviewOutputBase>> DeviceImportAsync(IBrowserFile file)
|
||||
{
|
||||
return UploadDeviceService.PreviewAsync(file);
|
||||
return App.GetService<UploadDeviceService>().PreviewAsync(file);
|
||||
}
|
||||
async Task DownExportAsync(UploadDevicePageInput input = null)
|
||||
{
|
||||
@@ -128,8 +122,8 @@ public partial class UploadDevicePage
|
||||
}
|
||||
private async Task EditCallAsync(UploadDeviceEditInput input)
|
||||
{
|
||||
await UploadDeviceService.EditAsync(input);
|
||||
_deviceGroups = UploadDeviceService.GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await App.GetService<UploadDeviceService>().EditAsync(input);
|
||||
_deviceGroups = App.GetService<UploadDeviceService>().GetCacheList()?.Select(a => a.DeviceGroup)?.Where(a => a != null).Distinct()?.ToList();
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
}
|
||||
|
||||
@@ -141,13 +135,13 @@ public partial class UploadDevicePage
|
||||
|
||||
private async Task<SqlSugarPagedList<UploadDevice>> QueryCallAsync(UploadDevicePageInput input)
|
||||
{
|
||||
var data = await UploadDeviceService.PageAsync(input);
|
||||
var data = await App.GetService<UploadDeviceService>().PageAsync(input);
|
||||
return data;
|
||||
}
|
||||
|
||||
async Task SaveDeviceImportAsync(Dictionary<string, ImportPreviewOutputBase> data)
|
||||
{
|
||||
await UploadDeviceService.ImportAsync(data);
|
||||
await App.GetService<UploadDeviceService>().ImportAsync(data);
|
||||
await DatatableQuery();
|
||||
ImportExcel.IsShowImport = false;
|
||||
await MainLayout.StateHasChangedAsync();
|
||||
|
||||
@@ -871,8 +871,8 @@ public class TcpClientBaseEx : BaseSocket, ITcpClient
|
||||
{
|
||||
#if NET45_OR_GREATER
|
||||
|
||||
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
|
||||
socket.IOControl(IOControlCode.KeepAliveValues, keepAliveValue.KeepAliveTime, null);
|
||||
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
|
||||
socket.IOControl(IOControlCode.KeepAliveValues, keepAliveValue.KeepAliveTime, null);
|
||||
#else
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ public class OPCNode
|
||||
/// </summary>
|
||||
[Description("检查域")]
|
||||
public bool CheckDomain { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新间隔
|
||||
/// </summary>
|
||||
|
||||
@@ -19,7 +19,6 @@ using ThingsGateway.Foundation;
|
||||
using ThingsGateway.Foundation.Serial;
|
||||
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace ThingsGateway.DLT645;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
using Furion;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
using System.Collections.Generic;
|
||||
@@ -56,8 +58,6 @@ public partial class ImportVariable
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
IDriverPluginService DriverPluginService { get; set; }
|
||||
|
||||
private List<BrowseElement> Selected { get; set; } = new();
|
||||
|
||||
@@ -129,7 +129,7 @@ public partial class ImportVariable
|
||||
Enable = true,
|
||||
IsLogOut = true,
|
||||
DevicePropertys = new(),
|
||||
PluginId = DriverPluginService.GetIdByName(nameof(OPCDAClient)).ToLong(),
|
||||
PluginId = App.GetService<DriverPluginService>().GetIdByName(nameof(OPCDAClient)).ToLong(),
|
||||
};
|
||||
data.DevicePropertys.Add(new() { PropertyName = nameof(OPCDAClientProperty.OPCName), Value = PLC.OPCNode.OPCName, Description = typeof(OPCDAClientProperty).GetProperty(nameof(OPCDAClientProperty.OPCName)).GetCustomAttribute<DevicePropertyAttribute>().Description });
|
||||
data.DevicePropertys.Add(new() { PropertyName = nameof(OPCDAClientProperty.OPCIP), Value = PLC.OPCNode.OPCIP, Description = typeof(OPCDAClientProperty).GetProperty(nameof(OPCDAClientProperty.OPCIP)).GetCustomAttribute<DevicePropertyAttribute>().Description });
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
//------------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
using Furion;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
using Opc.Ua;
|
||||
@@ -62,8 +64,7 @@ public partial class ImportVariable
|
||||
|
||||
}
|
||||
|
||||
[Inject]
|
||||
IDriverPluginService DriverPluginService { get; set; }
|
||||
|
||||
|
||||
private List<ReferenceDescription> Selected { get; set; } = new();
|
||||
/// <summary>
|
||||
@@ -155,7 +156,7 @@ public partial class ImportVariable
|
||||
Enable = true,
|
||||
IsLogOut = true,
|
||||
DevicePropertys = new(),
|
||||
PluginId = DriverPluginService.GetIdByName(nameof(OPCUAClient)).ToLong(),
|
||||
PluginId = App.GetService<DriverPluginService>().GetIdByName(nameof(OPCUAClient)).ToLong(),
|
||||
};
|
||||
|
||||
data.DevicePropertys.Add(new() { PropertyName = nameof(OPCUAClientProperty.OPCURL), Value = PLC.OPCNode.OPCUrl, Description = typeof(OPCUAClientProperty).GetProperty(nameof(OPCUAClientProperty.OPCURL)).GetCustomAttribute<DevicePropertyAttribute>().Description });
|
||||
@@ -236,9 +237,9 @@ public partial class ImportVariable
|
||||
if (data != null && data.Count > 0)
|
||||
{
|
||||
if (isAll)
|
||||
child.Nodes = await PopulateBranchAsync((NodeId)target.NodeId);
|
||||
else
|
||||
child.Nodes = new();
|
||||
child.Nodes = await PopulateBranchAsync((NodeId)target.NodeId);
|
||||
else
|
||||
child.Nodes = new();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -206,7 +206,7 @@ public class OPCUAClient : CollectBase
|
||||
UserName = driverPropertys.UserName,
|
||||
Password = driverPropertys.Password,
|
||||
CheckDomain = driverPropertys.CheckDomain,
|
||||
};
|
||||
};
|
||||
if (_plc == null)
|
||||
{
|
||||
_plc = new(LogMessage);
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#endregion
|
||||
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
using ThingsGateway.Application;
|
||||
|
||||
namespace ThingsGateway.OPCUA;
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
"SqlSugar": [
|
||||
{
|
||||
"ConfigId": "Default", //ID
|
||||
//"ConnectionString": "server=localhost;Database=test;Uid=root;Pwd=111111;AllowLoadLocalInfile=true;", //连接字符串
|
||||
//"DbType": "MySql", //数据库类型
|
||||
"ConnectionString": "Data Source=Default.db;", //连接字符串
|
||||
"DbType": "Sqlite", //数据库类型
|
||||
"ConnectionString": "server=localhost;Database=test;Uid=root;Pwd=111111;AllowLoadLocalInfile=true;", //连接字符串
|
||||
"DbType": "MySql", //数据库类型
|
||||
//"ConnectionString": "Data Source=Default.db;", //连接字符串
|
||||
//"DbType": "Sqlite", //数据库类型
|
||||
"IsAutoCloseConnection": true, //是否自动释放
|
||||
"IsInitDb": true, //是否初始化数据库,适用于codefirst
|
||||
"IsUnderLine": false, //是否驼峰转下划线
|
||||
@@ -17,10 +17,10 @@
|
||||
},
|
||||
{
|
||||
"ConfigId": "ThingsGateway", //ID
|
||||
//"ConnectionString": "server=localhost;Database=test;Uid=root;Pwd=111111;AllowLoadLocalInfile=true;", //连接字符串
|
||||
//"DbType": "MySql", //数据库类型
|
||||
"ConnectionString": "Data Source=ThingsGateway.db", //连接字符串
|
||||
"DbType": "Sqlite", //数据库类型
|
||||
"ConnectionString": "server=localhost;Database=test;Uid=root;Pwd=111111;AllowLoadLocalInfile=true;", //连接字符串
|
||||
"DbType": "MySql", //数据库类型
|
||||
//"ConnectionString": "Data Source=ThingsGateway.db", //连接字符串
|
||||
//"DbType": "Sqlite", //数据库类型
|
||||
"IsAutoCloseConnection": true, //是否自动释放
|
||||
"IsInitDb": true, //是否初始化数据库,适用于codefirst
|
||||
"IsUnderLine": false, //是否驼峰转下划线
|
||||
|
||||
Reference in New Issue
Block a user