315 lines
11 KiB
Plaintext
315 lines
11 KiB
Plaintext
@page "/system/app/version/list"
|
|
@page "/{locale}/system/app/version/list"
|
|
|
|
@inject ILogger<AppVersionList> Logger
|
|
@attribute [Authorize]
|
|
|
|
<PageContainer Title="App版本管理">
|
|
<Breadcrumb>
|
|
<Breadcrumb>
|
|
<BreadcrumbItem Href="/">管理后台</BreadcrumbItem>
|
|
<BreadcrumbItem Href="/settings">系统配置</BreadcrumbItem>
|
|
<BreadcrumbItem>版本管理</BreadcrumbItem>
|
|
</Breadcrumb>
|
|
</Breadcrumb>
|
|
<ChildContent>
|
|
<Card Class="">
|
|
<Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish">
|
|
<Row Justify="RowJustify.Start" Gutter="16">
|
|
<Col>
|
|
<FormItem Label="名称">
|
|
<Input @bind-Value="search.Name" Placeholder="名称" AllowClear />
|
|
</FormItem>
|
|
</Col>
|
|
<Col>
|
|
<FormItem Label="状态">
|
|
<SimpleSelect DefaultValue="" Style="width:120px;" @bind-Value="@context.Status">
|
|
<SelectOptions>
|
|
<SimpleSelectOption Value="" Label="全部"></SimpleSelectOption>
|
|
<SimpleSelectOption Value="1" Label="草稿"></SimpleSelectOption>
|
|
<SimpleSelectOption Value="2" Label="已发布"></SimpleSelectOption>
|
|
</SelectOptions>
|
|
</SimpleSelect>
|
|
</FormItem>
|
|
</Col>
|
|
<Col>
|
|
<div class="ant-form-item" style="width:200px;display:flex;">
|
|
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button>
|
|
<Button Style="margin: 0 8px;" OnClick="OnReset">重置</Button>
|
|
</div>
|
|
</Col>
|
|
</Row>
|
|
</Form>
|
|
</Card>
|
|
<br />
|
|
<Card Class="mt-3">
|
|
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true" Resizable>
|
|
<TitleTemplate>
|
|
<Flex Justify="FlexJustify.SpaceBetween">
|
|
版本记录
|
|
<div>
|
|
<AuthorizeCheck Permission="@Permissions.Admin.Create">
|
|
<Button Class="me-3" OnClick="OnCreateClick" Type="ButtonType.Primary">新增</Button>
|
|
</AuthorizeCheck>
|
|
</div>
|
|
</Flex>
|
|
</TitleTemplate>
|
|
<ColumnDefinitions>
|
|
<PropertyColumn Property="c => c.Title" Title="标题">
|
|
</PropertyColumn>
|
|
<PropertyColumn Property="c => c.AppName" Title="应用">
|
|
|
|
</PropertyColumn>
|
|
<PropertyColumn Property="c => c.Platform" Title="平台">
|
|
@if (context.Platform == 1)
|
|
{
|
|
<Tag>windows</Tag>
|
|
}
|
|
else if (context.Platform == 2)
|
|
{
|
|
<Tag>安卓</Tag>
|
|
}
|
|
else if (context.Platform == 3)
|
|
{
|
|
<Tag>iOS</Tag>
|
|
}
|
|
else
|
|
{
|
|
<Tag>未设置</Tag>
|
|
}
|
|
</PropertyColumn>
|
|
<PropertyColumn Property="c => c.VersionX" Title="版本号">
|
|
@context.VersionX.@context.VersionY.@context.VersionZ
|
|
</PropertyColumn>
|
|
<PropertyColumn Property="c => c.VersionState" Title="版本状态">
|
|
@if (context.VersionState == 1)
|
|
{
|
|
<Tag>开发版</Tag>
|
|
}
|
|
else if (context.VersionState == 2)
|
|
{
|
|
<Tag>Alphal内测版</Tag>
|
|
}
|
|
else if (context.VersionState == 3)
|
|
{
|
|
<Tag>Beta公测版</Tag>
|
|
}
|
|
else if (context.VersionState == 4)
|
|
{
|
|
<Tag>Rc版</Tag>
|
|
}
|
|
else if (context.VersionState == 5)
|
|
{
|
|
<Tag>正式版</Tag>
|
|
}
|
|
else
|
|
{
|
|
<Tag>未设置</Tag>
|
|
}
|
|
</PropertyColumn>
|
|
<PropertyColumn Property="c => c.Status" Title="状态" Width="80px" Align="ColumnAlign.Center">
|
|
@if (context.Status == 1)
|
|
{
|
|
<Tag>草稿</Tag>
|
|
}
|
|
else if (context.Status == 2)
|
|
{
|
|
<Tag>发布</Tag>
|
|
}
|
|
else
|
|
{
|
|
<Tag>未设置</Tag>
|
|
}
|
|
</PropertyColumn>
|
|
<PropertyColumn Property="c => c.UpdateTime" Title="最后更新" />
|
|
<ActionColumn Title="操作" Align="ColumnAlign.Right" Width="160px">
|
|
<Space>
|
|
<SpaceItem>
|
|
<Dropdown Trigger="@(new Trigger[] { Trigger.Click })">
|
|
<Overlay>
|
|
<Menu>
|
|
|
|
<MenuItem>
|
|
<a @onclick="(e) => OnEditClick(context.Id)"> <Icon Type="@IconType.Outline.Edit" /> 编辑</a>
|
|
</MenuItem>
|
|
<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>
|
|
</ChildContent>
|
|
</PageContainer>
|
|
|
|
|
|
@code {
|
|
[Parameter]
|
|
public string Locale { get; set; } = string.Empty;
|
|
|
|
[SupplyParameterFromQuery]
|
|
int? Page { get; set; }
|
|
|
|
[SupplyParameterFromQuery(Name = "size")]
|
|
int? PageSize { get; set; }
|
|
|
|
[SupplyParameterFromForm]
|
|
AppVersionSearch search { get; set; } = new();
|
|
Form<AppVersionSearch> searchForm = null!;
|
|
|
|
PagingList<AppVersion> PagingList = new();
|
|
bool loading { get; set; } = true;
|
|
bool searchExpand { get; set; } = false;
|
|
|
|
bool drawerVisible;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
base.OnInitialized();
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
|
|
loadQueryString();
|
|
_ = LoadList();
|
|
|
|
base.OnParametersSet();
|
|
}
|
|
|
|
void loadQueryString()
|
|
{
|
|
var uri = new Uri(Navigation.Uri);
|
|
var query = uri.Query;
|
|
search.Name = query.GetQueryString("Name");
|
|
search.Status = query.GetQueryString("Status");
|
|
|
|
var data = query.GetQueryString("RangeTime");
|
|
if (!string.IsNullOrEmpty(data))
|
|
{
|
|
var rangetime = data.Split("-");
|
|
if (rangetime != null && rangetime.Length > 0)
|
|
{
|
|
searchExpand = true;
|
|
search.RangeTime[0] = rangetime[0].NumberToDateTime();
|
|
search.RangeTime[1] = rangetime[1].NumberToDateTime();
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
private async Task LoadList()
|
|
{
|
|
|
|
loading = true;
|
|
var url = "/api/appversion/search";
|
|
var apiResult = await HttpService.GetPagingList<AppVersion>(url, search, Page.GetValueOrDefault(1), PageSize.GetValueOrDefault(20));
|
|
if (apiResult.Success)
|
|
{
|
|
if (apiResult.Data != null)
|
|
{
|
|
PagingList = apiResult.Data;
|
|
}
|
|
}
|
|
loading = false;
|
|
StateHasChanged();
|
|
}
|
|
|
|
void OnSearchFinish()
|
|
{
|
|
Page = Page.GetValueOrDefault(1) - 1;
|
|
|
|
OnSearch(Page.Value);
|
|
}
|
|
|
|
|
|
private void OnReset()
|
|
{
|
|
search = new();
|
|
}
|
|
|
|
private void OnSearch(int page)
|
|
{
|
|
var queryString = search.BuildQueryString();
|
|
if (string.IsNullOrEmpty(queryString))
|
|
{
|
|
if (page > 1)
|
|
{
|
|
Navigation.NavigateTo($"/system/app/version/list?page={page}");
|
|
}
|
|
else
|
|
{
|
|
Navigation.NavigateTo($"/system/app/version/list");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (page > 1)
|
|
{
|
|
Navigation.NavigateTo($"/system/app/version/list?page={page}&{queryString}");
|
|
}
|
|
else
|
|
{
|
|
Navigation.NavigateTo($"/system/app/version/list?{queryString}");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
async Task HandleDeleteConfirmAsync(MouseEventArgs e, long id)
|
|
{
|
|
var url = $"/api/appversion/delete/{id}";
|
|
var apiResult = await HttpService.Post<ApiResult<string>>(url, new());
|
|
if (apiResult.Success)
|
|
{
|
|
await LoadList();
|
|
await ModalService.InfoAsync(new ConfirmOptions() { Title = "操作提示", Content = "删除数据成功" });
|
|
}
|
|
else
|
|
{
|
|
await ModalService.ErrorAsync(new ConfirmOptions() { Title = "操作提示", Content = $"数据删除失败.{apiResult.Message}" });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void OnPageChanged(PaginationEventArgs args)
|
|
{
|
|
OnSearch(args.Page);
|
|
}
|
|
|
|
|
|
|
|
|
|
void OnCreateClick()
|
|
{
|
|
Navigation.NavigateTo($"/system/app/version/create");
|
|
}
|
|
|
|
void OnEditClick(long id)
|
|
{
|
|
Navigation.NavigateTo($"/system/app/version/edit/{id}");
|
|
}
|
|
} |