chore
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
@page "/area/create/{countryId:long}/{stateProvinceId:long}"
|
||||
@page "/area/create/{countryId:long}"
|
||||
@page "/area/create/{countryId:long}/{stateProvinceId:long}"
|
||||
@page "/area/edit/{countryId:long}/{stateProvinceId:long}/{id:long}"
|
||||
@page "/{locale}/area/create/{countryId:long}"
|
||||
@page "/{locale}/area/create/{countryId:long}/{stateProvinceId:long}"
|
||||
@page "/{locale}/area/create/{countryId:long}/{stateProvinceId:long}/{id:long}"
|
||||
|
||||
@@ -24,15 +26,28 @@
|
||||
<FormItem Label="国家">
|
||||
<Input @bind-Value="@country.Name" Placeholder="国家名称" Disabled />
|
||||
</FormItem>
|
||||
<FormItem Label="州/省">
|
||||
<Select TItemValue="long" TItem="int" Style="width:250px;" @bind-Value="@context.StateProvinceId">
|
||||
<SelectOption Value="0" Label="请选择运行平台"></SelectOption>
|
||||
<SelectOption Value="1" Label="Windows桌面"></SelectOption>
|
||||
<SelectOption Value="2" Label="安卓系统"></SelectOption>
|
||||
<SelectOption Value="3" Label="iOS系统"></SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem Label="城市">
|
||||
<Select TItemValue="long" TItem="int" Style="width:250px;" @bind-Value="@context.ParentId">
|
||||
<SelectOption Value="0" Label="请选择运行平台"></SelectOption>
|
||||
<SelectOption Value="1" Label="Windows桌面"></SelectOption>
|
||||
<SelectOption Value="2" Label="安卓系统"></SelectOption>
|
||||
<SelectOption Value="3" Label="iOS系统"></SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
<FormItem Label="名称" Required>
|
||||
<Input @bind-Value="@context.Name" Placeholder="名称" />
|
||||
</FormItem>
|
||||
<FormItem Label="首字母">
|
||||
<Input @bind-Value="@context.Initial" Placeholder="首字母" />
|
||||
</FormItem>
|
||||
<FormItem Label="缩写">
|
||||
<Input @bind-Value="@context.Abbreviation" Placeholder="缩写" />
|
||||
</FormItem>
|
||||
<FormItem Label="显示排序">
|
||||
<Input @bind-Value="@context.DisplayOrder" Placeholder="显示排序" />
|
||||
</FormItem>
|
||||
@@ -60,8 +75,8 @@
|
||||
public long Id { get; set; }
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
StateProvinceModel model { get; set; } = new();
|
||||
Form<StateProvinceModel> editform = null!;
|
||||
AreaModel model { get; set; } = new();
|
||||
Form<AreaModel> editform = null!;
|
||||
List<KeyValue> languageList = new();
|
||||
Country country = new();
|
||||
List<KeyValue> stateProvinceList = new();
|
||||
@@ -125,6 +140,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
async Task LoadStateProvince(long id)
|
||||
{
|
||||
var url = $"/api/stateprovince/select/{CountryId}";
|
||||
var apiResult = await HttpService.Get<ApiResult<List<KeyValue>>>(url);
|
||||
if (apiResult.Success)
|
||||
{
|
||||
if (apiResult.Data != null)
|
||||
{
|
||||
stateProvinceList = apiResult.Data;
|
||||
StateHasChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo($"/country/list");
|
||||
}
|
||||
stateProvinceList.Insert(0, new KeyValue() { Key = "0", Value = "请选择州/省" });
|
||||
}
|
||||
}
|
||||
|
||||
async Task LoadLanguage()
|
||||
{
|
||||
var url = $"/api/language/enabled";
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page "/area/list/{countryId:long}"
|
||||
@page "/area/list/{countryId:long}/{stateProvinceId:long}"
|
||||
@page "/{locale}/area/list/{countryId:long}"
|
||||
@page "/{locale}/area/list/{countryId:long}/{stateProvinceId:long}"
|
||||
@inject ILogger<CountryList> Logger
|
||||
@attribute [Authorize]
|
||||
|
||||
@@ -92,6 +94,8 @@
|
||||
public string Locale { get; set; } = string.Empty;
|
||||
[Parameter]
|
||||
public long CountryId { get; set; }
|
||||
[Parameter]
|
||||
public long StateProvinceId { get; set; }
|
||||
|
||||
[SupplyParameterFromQuery]
|
||||
int? Page { get; set; }
|
||||
@@ -202,7 +206,15 @@
|
||||
|
||||
void HandleAddNew()
|
||||
{
|
||||
Navigation.NavigateTo($"/area/create/{CountryId}");
|
||||
if (StateProvinceId > 0)
|
||||
{
|
||||
Navigation.NavigateTo($"/area/create/{CountryId}/{StateProvinceId}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.NavigateTo($"/area/create/{CountryId}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@
|
||||
|
||||
void GotoArea(StateProvince model)
|
||||
{
|
||||
Navigation.NavigateTo($"/area/list/{CountryId}");
|
||||
Navigation.NavigateTo($"/area/list/{CountryId}/{model.Id}");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,6 +54,22 @@ namespace Atomx.Admin.Controllers
|
||||
_localizer = localizer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select/{id}")]
|
||||
public IActionResult Select(long id)
|
||||
{
|
||||
var list = new List<KeyValue>();
|
||||
var query = from p in _dbContext.Areas
|
||||
where p.ParentId == id && p.Enabled
|
||||
select p;
|
||||
list = query.OrderByDescending(p => p.DisplayOrder).Select(p => new KeyValue() { Key = p.Id.ToString(), Value = p.Name }).ToList();
|
||||
|
||||
return new JsonResult(new ApiResult<List<KeyValue>>().IsSuccess(list));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据查询
|
||||
/// </summary>
|
||||
@@ -62,7 +78,6 @@ namespace Atomx.Admin.Controllers
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("search")]
|
||||
[Authorize(Policy = Permissions.User.View)]
|
||||
public IActionResult AddressList(AreaSearch search, int page, int size = 20)
|
||||
{
|
||||
if (page < 1)
|
||||
|
||||
Reference in New Issue
Block a user