This commit is contained in:
2026-01-05 12:44:01 +08:00
parent 41a939176e
commit ea541fb6e4
14 changed files with 171 additions and 467 deletions

View File

@@ -111,7 +111,7 @@
async Task LoadStateProvinceAndCities()
{
var url = $"/api/stateprovince/tree/{CountryId}";
var url = $"/api/area/tree/{CountryId}";
var apiResult = await HttpService.Get<ApiResult<List<KeyValueTree>>>(url);
if (apiResult.Success)
{
@@ -164,14 +164,14 @@
{
area = apiResult.Data;
model = apiResult.Data.Adapt<AreaModel>();
if (model.ParentId > 0)
{
cities = $"{model.StateProvinceId},{model.ParentId}";
}
else if (model.StateProvinceId > 0)
{
cities = $"{model.StateProvinceId}";
}
// if (model.ParentId > 0)
// {
// cities = $"{model.StateProvinceId},{model.ParentId}";
// }
// else if (model.StateProvinceId > 0)
// {
// cities = $"{model.StateProvinceId}";
// }
}
}
else
@@ -186,13 +186,7 @@
void OnCitiesChange(CascaderNode[] selectedNodes)
{
Console.WriteLine($"value: {cities} selected: {string.Join(",", selectedNodes.Select(x => x.Value))}");
model.StateProvinceId = long.Parse(selectedNodes.First().Value.ToString() ?? "0");
model.ParentId = long.Parse(selectedNodes.Last().Value.ToString() ?? "0");
if (model.StateProvinceId == model.ParentId)
{
model.ParentId = 0;
}
}
async void OnFormFinishAsync()