完善国家管理和数据多语言
This commit is contained in:
@@ -21,12 +21,12 @@
|
||||
<Form @ref="editform" Model="@model" LabelColSpan="5" WrapperColSpan="14" OnFinish="OnFormFinishAsync">
|
||||
@if (Id > 0 && languageList.Count() > 0)
|
||||
{
|
||||
<Tabs ActiveKey="@context.LanguageId" OnTabClick="OnLanguageTabChange">
|
||||
<TabPane Key="0">
|
||||
<Tabs ActiveKey="@model.LanguageId" OnTabClick="OnLanguageTabChange">
|
||||
@* <TabPane Key="0">
|
||||
<TabTemplate>
|
||||
<span>标准</span>
|
||||
</TabTemplate>
|
||||
</TabPane>
|
||||
</TabPane> *@
|
||||
@foreach (var item in languageList)
|
||||
{
|
||||
<TabPane Key="@item.Key.ToString()">
|
||||
@@ -38,28 +38,28 @@
|
||||
</Tabs>
|
||||
}
|
||||
<FormItem Label="名称" Required>
|
||||
<Input @bind-Value="@context.Name" Placeholder="国家" />
|
||||
<Input @bind-Value="@model.Name" Placeholder="国家" />
|
||||
</FormItem>
|
||||
<FormItem Label="首字母">
|
||||
<Input @bind-Value="@context.Initial" Placeholder="首字母" />
|
||||
<Input @bind-Value="@model.Initial" Placeholder="首字母" />
|
||||
</FormItem>
|
||||
<FormItem Label="两个字母ISO代码">
|
||||
<Input @bind-Value="@context.TwoLetterISOCode" Placeholder="两个字母ISO代码" />
|
||||
<Input @bind-Value="@model.TwoLetterISOCode" Placeholder="两个字母ISO代码" />
|
||||
</FormItem>
|
||||
<FormItem Label="三字母ISO代码">
|
||||
<Input @bind-Value="@context.ThreeLetterISOCode" Placeholder="三字母ISO代码" />
|
||||
<Input @bind-Value="@model.ThreeLetterISOCode" Placeholder="三字母ISO代码" />
|
||||
</FormItem>
|
||||
<FormItem Label="数字ISO代码">
|
||||
<Input @bind-Value="@context.NumericISOCode" Placeholder="数字ISO代码" />
|
||||
<Input @bind-Value="@model.NumericISOCode" Placeholder="数字ISO代码" />
|
||||
</FormItem>
|
||||
<FormItem Label="允许发货">
|
||||
<Checkbox Checked="@context.AllowShipping">允许发货</Checkbox>
|
||||
<Checkbox Checked="@model.AllowShipping">允许发货</Checkbox>
|
||||
</FormItem>
|
||||
<FormItem Label="显示排序">
|
||||
<Input @bind-Value="@context.DisplayOrder" Placeholder="显示排序" />
|
||||
<Input @bind-Value="@model.DisplayOrder" Placeholder="显示排序" />
|
||||
</FormItem>
|
||||
<FormItem Label="状态">
|
||||
<Checkbox Checked="@context.Enabled">启用</Checkbox>
|
||||
<Checkbox T="bool" Label="启用" @bind-value="model.Enabled" Size="InputSize.Small" Class="ps-0" />
|
||||
</FormItem>
|
||||
<FormItem WrapperCol="new ColLayoutParam { Span = 24, Offset = 5 }">
|
||||
<Button Type="@ButtonType.Primary" HtmlType="submit" Loading="saving">
|
||||
@@ -71,6 +71,7 @@
|
||||
</Spin>
|
||||
</ChildContent>
|
||||
</PageContainer>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string Locale { get; set; } = string.Empty;
|
||||
@@ -110,7 +111,17 @@
|
||||
var apiResult = await HttpService.Get<ApiResult<List<KeyValue>>>(url);
|
||||
if (apiResult.Success)
|
||||
{
|
||||
languageList = apiResult.Data ?? new List<KeyValue>();
|
||||
if(apiResult.Data == null)
|
||||
{
|
||||
languageList = new List<KeyValue>();
|
||||
}
|
||||
else
|
||||
{
|
||||
languageList = apiResult.Data;
|
||||
languageList.Insert(0, new KeyValue() { Key = "0", Value = "标准" });
|
||||
}
|
||||
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
@@ -145,6 +156,7 @@
|
||||
{
|
||||
if (editform.Validate())
|
||||
{
|
||||
Console.WriteLine(model.ToJson());
|
||||
saving = true;
|
||||
var url = $"api/country/save";
|
||||
var result = new ApiResult<string>();
|
||||
|
||||
Reference in New Issue
Block a user