This commit is contained in:
2025-12-25 12:41:37 +08:00
parent 7b6ec9c1d8
commit f7bb6bb2dc
10 changed files with 363 additions and 109 deletions

View File

@@ -5,12 +5,12 @@
<PageContainer Title="国家地区">
<PageContainer Title="国家管理">
<Breadcrumb>
<Breadcrumb>
<BreadcrumbItem>Home</BreadcrumbItem>
<BreadcrumbItem>系统配置</BreadcrumbItem>
<BreadcrumbItem>货币管理</BreadcrumbItem>
<BreadcrumbItem>国家管理</BreadcrumbItem>
</Breadcrumb>
</Breadcrumb>
<ChildContent>
@@ -22,41 +22,9 @@
<FormItem Label="名称">
<Input @bind-Value="search.Name" Placeholder="名称" AllowClear />
</FormItem>
</Col>
@if (searchExpand)
{
<AntDesign.Col>
<FormItem Label="发布时间">
<RangePicker @bind-Value="search.RangeTime"></RangePicker>
</FormItem>
</AntDesign.Col>
<AntDesign.Col>
<FormItem Label="状态">
<SimpleSelect DefaultValue="" Style="width:120px;" @bind-Value="@search.Status">
<SelectOptions>
<SimpleSelectOption Value="" Label="全部"></SimpleSelectOption>
<SimpleSelectOption Value="1" Label="草稿"></SimpleSelectOption>
<SimpleSelectOption Value="2" Label="已发布"></SimpleSelectOption>
<SimpleSelectOption Value="3" Label="已删除"></SimpleSelectOption>
</SelectOptions>
</SimpleSelect>
</FormItem>
</AntDesign.Col>
}
<Col>
<div class="ant-form-item">
<Button Type="ButtonType.Primary" HtmlType="submit">查询</Button>
<Button Style="margin: 0 8px;" OnClick="OnSearchReset">重置</Button>
<a style="font-size:12px; display:flex; align-items:center;text-align:center;" @onclick="()=>{searchExpand=!searchExpand;}">
<Icon Type="@(searchExpand?"up":"down")"></Icon> @if (searchExpand)
{
<span>收起</span>
}
else
{
<span>展开</span>
}
</a>
</div>
</Col>
</Row>
@@ -65,25 +33,15 @@
<Card Title="" Class="hideborder">
<Extra>
<div class="extraContent">
<Button Type="ButtonType.Primary" HtmlType="submit" OnClick="HandleAddNew">新增货币</Button>
<Button Type="ButtonType.Primary" HtmlType="submit" OnClick="HandleAddNew">新增国家</Button>
</div>
</Extra>
<ChildContent>
<Table DataSource="PagingList.Items" PageSize="100" HidePagination="true">
<Selection CheckStrictly />
<PropertyColumn Property="c => c.Name" Title="名称" />
<PropertyColumn Property="c => c.CurrencyCode" Title="货币代码" />
<PropertyColumn Property="c => c.Rate" Title="汇率" />
<PropertyColumn Property="c => c.PrimaryCurrency" Title="默认货币">
@if (context.PrimaryCurrency)
{
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme="IconThemeType.Outline" /></AntDesign.Text>
}
else
{
<Icon Type="minus" Theme="IconThemeType.Outline" />
}
</PropertyColumn>
<PropertyColumn Property="c => c.Initial" Title="首字母" />
<PropertyColumn Property="c => c.NumericISOCode" Title="ISO代码" />
<PropertyColumn Property="c => c.Enabled" Title="状态">
@if (context.Enabled)
{
@@ -135,12 +93,11 @@
int? PageSize { get; set; }
bool pageLoading = false;
bool searchExpand = false;
Form<CurrencySearchModel> searchForm = new();
CurrencySearchModel search = new();
Form<CountrySearch> searchForm = new();
CountrySearch search = new();
PagingList<CurrencyModel> PagingList = new() { Size = 20 };
PagingList<Country> PagingList = new() { Size = 20 };
protected override async Task OnInitializedAsync()
@@ -160,21 +117,6 @@
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();
}
}
}
async Task LoadListAsync()
@@ -182,8 +124,8 @@
try
{
pageLoading = true;
var url = "/api/currency/search";
var apiResult = await HttpService.GetPagingList<CurrencyModel>(url, search, Page.GetValueOrDefault(1), PageSize.GetValueOrDefault(20));
var url = "/api/country/search";
var apiResult = await HttpService.GetPagingList<Country>(url, search, Page.GetValueOrDefault(1), PageSize.GetValueOrDefault(20));
if (apiResult.Success)
{
if (apiResult.Data != null)
@@ -206,7 +148,7 @@
void OnSearchReset()
{
search = new CurrencySearchModel();
search = new CountrySearch();
searchForm?.Reset();
}
@@ -217,22 +159,22 @@
{
if (page > 1)
{
Navigation.NavigateTo($"/currency/list?page={page}");
Navigation.NavigateTo($"/country/list?page={page}");
}
else
{
Navigation.NavigateTo($"/currency/list");
Navigation.NavigateTo($"/country/list");
}
}
else
{
if (page > 1)
{
Navigation.NavigateTo($"/currency/list?page={page}&{queryString}");
Navigation.NavigateTo($"/country/list?page={page}&{queryString}");
}
else
{
Navigation.NavigateTo($"/currency/list?{queryString}");
Navigation.NavigateTo($"/country/list?{queryString}");
}
}
}
@@ -251,17 +193,13 @@
void HandleAddNew()
{
Navigation.NavigateTo($"/currency/create");
Navigation.NavigateTo($"/country/create");
}
void HandleEdit(CurrencyModel model)
void HandleEdit(Country model)
{
Navigation.NavigateTo($"/currency/edit/{model.Id}");
Navigation.NavigateTo($"/country/edit/{model.Id}");
}
}
@code {
}