调整UI布局,消息模版新增语言字段

This commit is contained in:
yxw
2025-12-15 18:28:17 +08:00
parent 9b8bf43eb6
commit 98e3f7ab73
11 changed files with 510 additions and 328 deletions

View File

@@ -1,112 +1,123 @@
@page "/system/role/list"
@page "/{locale}/system/role/list"
@attribute [Authorize]
@inject ILogger<RoleList> Logger
<PageTitle>角色管理</PageTitle>
<PageContainer Title="角色管理">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
<BreadcrumbItem Href="/admin/list">系统功能</BreadcrumbItem>
<BreadcrumbItem>角色管理</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
<Card Class="mt-3">
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween">
角色列表
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
</Flex>
</TitleTemplate>
<ColumnDefinitions>
<PropertyColumn Property="c => c.Name" Title="角色">
</PropertyColumn>
<PropertyColumn Property="c => c.Description" Title="说明" />
<PropertyColumn Property="c => c.IsSystemRole" Title="系统" Width="80px" Align="ColumnAlign.Center">
@if (context.IsSystemRole)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
}
else
{
<AntDesign.Text Type="TextElementType.Secondary"><Icon Type="minus" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
}
</PropertyColumn>
<PropertyColumn Property="c => c.Count" Title="用户数" Width="100px" />
<PropertyColumn Property="c => c.Enabled" Title="状态" Width="80px" Align="ColumnAlign.Center">
@if (context.Enabled)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
<Title Level="4">角色管理</Title>
}
else
{
<Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" />
}
</PropertyColumn>
<Card Class="mt-3">
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable>
<TitleTemplate>
<Flex Justify="FlexJustify.SpaceBetween">
角色列表
<div>
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
</div>
</Flex>
</TitleTemplate>
<ColumnDefinitions>
<PropertyColumn Property="c => c.Name" Title="角色">
</PropertyColumn>
<PropertyColumn Property="c => c.Description" Title="说明" />
<PropertyColumn Property="c => c.IsSystemRole" Title="系统" Width="80px" Align="ColumnAlign.Center">
@if (context.IsSystemRole)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
}
else
{
<AntDesign.Text Type="TextElementType.Secondary"><Icon Type="minus" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
}
</PropertyColumn>
<PropertyColumn Property="c => c.Count" Title="用户数" Width="100px" />
<PropertyColumn Property="c => c.Enabled" Title="状态" Width="80px" Align="ColumnAlign.Center">
@if (context.Enabled)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
<PropertyColumn Property="c => c.UpdateTime" Title="最后更新" Width="190px" />
<ActionColumn Title="操作" Align="ColumnAlign.Right" Width="160px">
<Space>
<SpaceItem>
<Button Type="ButtonType.Link" OnClick="() => OnEditPermissionClick(context)">权限管理</Button>
</SpaceItem>
<SpaceItem>
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
<Overlay>
<Menu>
}
else
{
<Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" />
}
</PropertyColumn>
<MenuItem>
<a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
</MenuItem>
@if (!context.IsSystemRole)
{
<MenuDivider />
<MenuItem>
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
OkText="确定"
CancelText="取消">
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a>
</Popconfirm>
</MenuItem>
}
</Menu>
</Overlay>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
<br />
<Row Justify="RowJustify.End">
<Pagination PageIndex="pager.Index" Total="PagingList.Count" PageSize="PagingList.Size" ShowSizeChanger="false" OnChange="OnPageChanged"></Pagination>
</Row>
</Card>
<PropertyColumn Property="c => c.UpdateTime" Title="最后更新" Width="190px" />
<ActionColumn Title="操作" Align="ColumnAlign.Right" Width="160px">
<Space>
<SpaceItem>
<Button Type="ButtonType.Link" OnClick="() => OnEditPermissionClick(context)">权限管理</Button>
</SpaceItem>
<SpaceItem>
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
<Overlay>
<Menu>
<MenuItem>
<a @onclick="(e) => OnEditClick(context)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
</MenuItem>
@if (!context.IsSystemRole)
{
<MenuDivider />
<MenuItem>
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
OnConfirm="@(e=>HandleDeleteConfirmAsync(e,context.Id))"
OkText="确定"
CancelText="取消">
<a> <Icon Type="@IconType.Outline.Delete" /> 删除</a>
</Popconfirm>
</MenuItem>
}
</Menu>
</Overlay>
<ChildContent>
<a class="ant-dropdown-link" @onclick:preventDefault>
<Icon Type="@IconType.Outline.Menu" />
</a>
</ChildContent>
</Dropdown>
</SpaceItem>
</Space>
</ActionColumn>
</ColumnDefinitions>
</Table>
<br />
<Row Justify="RowJustify.End">
<Pagination PageIndex="pager.Index" Total="PagingList.Count" PageSize="PagingList.Size" ShowSizeChanger="false" OnChange="OnPageChanged"></Pagination>
</Row>
</Card>
<Drawer Closable="true" Width="520" Visible="drawerVisible" Title='(model.Id == 0 ? "新增角色" : "编辑角色")' OnClose="_ => CloseDrawer()">
<Form LabelColSpan="5" @ref="@editform" Model="@model" OnFinish="OnFormFinish">
<FluentValidationValidator />
<FormItem Label="角色名称">
<Input @bind-Value="model.Name" For="(()=>model.Name)" Placeholder="角色名称" />
</FormItem>
<FormItem Label="角色说明">
<Input @bind-Value="model.Description" For="(()=>model.Culture)" Placeholder="角色说明" />
</FormItem>
<FormItem Label="可用状态">
<Checkbox T="bool" Label="启用" @bind-value="model.Enabled" Size="InputSize.Small" Class="ps-0" />
</FormItem>
<FormItem WrapperColOffset="4">
<Button Type="ButtonType.Primary" HtmlType="submit" Style="width: 100%;">保存</Button>
</FormItem>
</Form>
</Drawer>
<Drawer Closable="true" Width="520" Visible="drawerVisible" Title='(model.Id == 0 ? "新增角色" : "编辑角色")' OnClose="_ => CloseDrawer()">
<Form LabelColSpan="5" @ref="@editform" Model="@model" OnFinish="OnFormFinish">
<FluentValidationValidator />
<FormItem Label="角色名称">
<Input @bind-Value="model.Name" For="(()=>model.Name)" Placeholder="角色名称" />
</FormItem>
<FormItem Label="角色说明">
<Input @bind-Value="model.Description" For="(()=>model.Culture)" Placeholder="角色说明" />
</FormItem>
<FormItem Label="可用状态">
<Checkbox T="bool" Label="启用" @bind-value="model.Enabled" Size="InputSize.Small" Class="ps-0" />
</FormItem>
<FormItem WrapperColOffset="4">
<Button Type="ButtonType.Primary" HtmlType="submit" Style="width: 100%;">保存</Button>
</FormItem>
</Form>
</Drawer>
</ChildContent>
</PageContainer>
@code {
[Parameter]
public string Locale { get; set; } = string.Empty;
[SupplyParameterFromQuery]
int? Page { get; set; }