完善国家管理和数据多语言
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
@page "/stateprovince/list"
|
||||
@page "/{locale}/stateprovince/list"
|
||||
@page "/stateprovince/list/{countryId:long}"
|
||||
@page "/{locale}/stateprovince/list/{countryId:long}"
|
||||
@inject ILogger<StateProvinceList> Logger
|
||||
@attribute [Authorize]
|
||||
|
||||
@@ -15,90 +15,52 @@
|
||||
</Breadcrumb>
|
||||
<ChildContent>
|
||||
<Spin Spinning="pageLoading">
|
||||
<Card>
|
||||
<Card>
|
||||
<Form @ref="searchForm" Model="search" Layout="FormLayout.Inline" Class="search-form" OnFinish="OnSearchFinish">
|
||||
<Row Justify="RowJustify.Start" Gutter="16">
|
||||
<Row Justify="RowJustify.Start" Gutter="(16, 16)">
|
||||
<Col>
|
||||
<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">
|
||||
<div class="ant-form-item" style="display:flex">
|
||||
<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>
|
||||
</Form>
|
||||
</Card>
|
||||
<Card Title="" Class="hideborder">
|
||||
<br />
|
||||
<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.Abbreviation" Title="缩写" />
|
||||
<PropertyColumn Property="c => c.Enabled" Title="状态">
|
||||
@if (context.Enabled)
|
||||
{
|
||||
<Text>已激活</text>
|
||||
<AntDesign.Text Type="TextElementType.Success"><Icon Type="check" Theme=" IconThemeType.Outline" Width="1.3em" Height="1.3em" /></AntDesign.Text>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Text>未激活</text>
|
||||
<Icon Type="close" Theme="IconThemeType.Outline" Width="1.3em" Height="1.3em" />
|
||||
}
|
||||
</PropertyColumn>
|
||||
<PropertyColumn Property="c => c.DisplayOrder" Title="排序" />
|
||||
<ActionColumn Title="操作" Align="ColumnAlign.Right">
|
||||
<Space>
|
||||
<SpaceItem>
|
||||
<a @onclick="(e)=>HandleEdit(context)">编辑</a>
|
||||
<a @onclick="(e) => HandleEdit(context)">编辑</a>
|
||||
</SpaceItem>
|
||||
@*<SpaceItem>
|
||||
<Popconfirm Placement="@Placement.Left" Title="@("删除这条数据无法恢复,您确定要删除吗?")"
|
||||
@@ -127,6 +89,8 @@
|
||||
@code {
|
||||
[Parameter]
|
||||
public string Locale { get; set; } = string.Empty;
|
||||
[Parameter]
|
||||
public long CountryId { get; set; }
|
||||
|
||||
[SupplyParameterFromQuery]
|
||||
int? Page { get; set; }
|
||||
@@ -137,10 +101,10 @@
|
||||
bool pageLoading = false;
|
||||
bool searchExpand = false;
|
||||
|
||||
Form<CurrencySearchModel> searchForm = new();
|
||||
CurrencySearchModel search = new();
|
||||
Form<StateProvinceSearch> searchForm = new();
|
||||
StateProvinceSearch search = new();
|
||||
|
||||
PagingList<CurrencyModel> PagingList = new() { Size = 20 };
|
||||
PagingList<StateProvince> PagingList = new() { Size = 20 };
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -160,21 +124,7 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
search.CountryId = CountryId;
|
||||
}
|
||||
|
||||
async Task LoadListAsync()
|
||||
@@ -182,8 +132,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/stateprovince/search";
|
||||
var apiResult = await HttpService.GetPagingList<StateProvince>(url, search, Page.GetValueOrDefault(1), PageSize.GetValueOrDefault(20));
|
||||
if (apiResult.Success)
|
||||
{
|
||||
if (apiResult.Data != null)
|
||||
@@ -206,7 +156,7 @@
|
||||
|
||||
void OnSearchReset()
|
||||
{
|
||||
search = new CurrencySearchModel();
|
||||
search = new();
|
||||
searchForm?.Reset();
|
||||
}
|
||||
|
||||
@@ -217,22 +167,22 @@
|
||||
{
|
||||
if (page > 1)
|
||||
{
|
||||
Navigation.NavigateTo($"/currency/list?page={page}");
|
||||
Navigation.NavigateTo($"/stateprovince/list/{CountryId}?page={page}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo($"/currency/list");
|
||||
Navigation.NavigateTo($"/stateprovince/list/{CountryId}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (page > 1)
|
||||
{
|
||||
Navigation.NavigateTo($"/currency/list?page={page}&{queryString}");
|
||||
Navigation.NavigateTo($"/stateprovince/list/{CountryId}?page={page}&{queryString}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo($"/currency/list?{queryString}");
|
||||
Navigation.NavigateTo($"/stateprovince/list/{CountryId}?{queryString}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,17 +201,13 @@
|
||||
|
||||
void HandleAddNew()
|
||||
{
|
||||
Navigation.NavigateTo($"/currency/create");
|
||||
Navigation.NavigateTo($"/stateprovince/{CountryId}/create");
|
||||
}
|
||||
|
||||
|
||||
void HandleEdit(CurrencyModel model)
|
||||
void HandleEdit(StateProvince model)
|
||||
{
|
||||
Navigation.NavigateTo($"/currency/edit/{model.Id}");
|
||||
Navigation.NavigateTo($"/stateprovince/{CountryId}/edit/{model.Id}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user