|
@@ -30,10 +30,10 @@ namespace aipmgr.Pages
|
|
|
private List<SelectedItem>? _organizationItems { get; set; }
|
|
|
|
|
|
[NotNull]
|
|
|
- private List<SelectedItem>? _collectorItems { get; set; }
|
|
|
+ private List<SelectedItem>? _gathererItems { get; set; }
|
|
|
|
|
|
[NotNull]
|
|
|
- private List<SelectedItem>? _gatherCategoryItems { get; set; }
|
|
|
+ private List<SelectedItem>? _categoryItems { get; set; }
|
|
|
|
|
|
[NotNull]
|
|
|
private Modal? _createOrEditModal { get; set; }
|
|
@@ -47,8 +47,8 @@ namespace aipmgr.Pages
|
|
|
{
|
|
|
await base.OnInitializedAsync();
|
|
|
_organizationItems = new List<SelectedItem>();
|
|
|
- _collectorItems = new List<SelectedItem>();
|
|
|
- _gatherCategoryItems = new List<SelectedItem>();
|
|
|
+ _gathererItems = new List<SelectedItem>();
|
|
|
+ _categoryItems = new List<SelectedItem>();
|
|
|
_currentGatherData = new GatherDataModel();
|
|
|
var organizations = await AdminManager.Shared.GetOrganizationsAsync();
|
|
|
_organizationItems = organizations.Select(x => new SelectedItem
|
|
@@ -63,23 +63,47 @@ namespace aipmgr.Pages
|
|
|
try
|
|
|
{
|
|
|
await LoadingManager.OpenAsync();
|
|
|
- _currentGatherData.OrganizationId = long.Parse(item.Value);
|
|
|
_currentGatherData.OrganizationName = item.Text;
|
|
|
if (_currentGatherData.OrganizationId == 0)
|
|
|
{
|
|
|
- _currentGatherData.GatherCategoryId = 0;
|
|
|
- _currentGatherData.GatherCategoryName = null;
|
|
|
- _currentGatherData.CollectorId = 0;
|
|
|
- _currentGatherData.CollectorName = null;
|
|
|
+ _categoryItems.Clear();
|
|
|
+ _currentGatherData.CategoryId = 0;
|
|
|
+ _currentGatherData.CategoryName = null;
|
|
|
+ _currentGatherData.GathererId = 0;
|
|
|
+ _currentGatherData.GathererName = null;
|
|
|
}
|
|
|
- if (_currentGatherData.OrganizationId > 0)
|
|
|
+ else if (_currentGatherData.OrganizationId > 0)
|
|
|
{
|
|
|
- var categories = await AdminManager.Shared.GetGatherCategoriesByOrganizationIdAsync(_currentGatherData.OrganizationId);
|
|
|
- _gatherCategoryItems = categories.Select(x => new SelectedItem
|
|
|
+ _categoryItems.Clear();
|
|
|
+ var imageCategories = await AdminManager.Shared.GetImageCategoriesByLevelAsync(CategoryLevel.MainCategory);
|
|
|
+ if (imageCategories != null)
|
|
|
{
|
|
|
- Value = x.Id.ToString(),
|
|
|
- Text = x.Name
|
|
|
- }).ToList();
|
|
|
+ foreach (var imageCategory in imageCategories)
|
|
|
+ {
|
|
|
+ var selectItem = new SelectedItem
|
|
|
+ {
|
|
|
+ Value = imageCategory.Id.ToString(),
|
|
|
+ Text = imageCategory.Name,
|
|
|
+ GroupName = "图像大类",
|
|
|
+ };
|
|
|
+ _categoryItems.Add(selectItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var gatherCategories = await AdminManager.Shared.GetGatherCategoriesByOrganizationIdAsync(_currentGatherData.OrganizationId);
|
|
|
+ if (gatherCategories != null)
|
|
|
+ {
|
|
|
+ foreach (var gatherCategory in gatherCategories)
|
|
|
+ {
|
|
|
+ var selectItem = new SelectedItem
|
|
|
+ {
|
|
|
+ Value = gatherCategory.Id.ToString(),
|
|
|
+ Text = gatherCategory.Name,
|
|
|
+ GroupName = "采集大类",
|
|
|
+ };
|
|
|
+ _categoryItems.Add(selectItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _categoryItems.Insert(0, new SelectedItem("0", "请选择..."));
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -98,19 +122,36 @@ namespace aipmgr.Pages
|
|
|
try
|
|
|
{
|
|
|
await LoadingManager.OpenAsync();
|
|
|
- if (_currentGatherData.GatherCategoryId == 0)
|
|
|
+ _currentGatherData.CategoryName = item.Text;
|
|
|
+ if (_currentGatherData.CategoryId == 0)
|
|
|
{
|
|
|
- _currentGatherData.CollectorId = 0;
|
|
|
- _currentGatherData.CollectorName = null;
|
|
|
+ _gathererItems.Clear();
|
|
|
+ _currentGatherData.GathererId = 0;
|
|
|
+ _currentGatherData.GathererName = null;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var collectors = await AdminManager.Shared.GetCollectorsByGatherCategoryIdAsync(_currentGatherData.OrganizationId, _currentGatherData.GatherCategoryId);
|
|
|
- _collectorItems = collectors.Select(x => new SelectedItem
|
|
|
+ if (item.GroupName == "图像大类")
|
|
|
+ {
|
|
|
+ var imageCategory = await AdminManager.Shared.GetImageCategoryAsync(_currentGatherData.CategoryId);
|
|
|
+ _gathererItems = imageCategory.Gatherers.Select(x => new SelectedItem
|
|
|
+ {
|
|
|
+ Value = x.Id.ToString(),
|
|
|
+ Text = x.Name
|
|
|
+ }).ToList();
|
|
|
+ _currentGatherData.CategoryType = CategoryType.ImageCategory;
|
|
|
+ }
|
|
|
+ else if (item.GroupName == "采集大类")
|
|
|
{
|
|
|
- Value = x.Id.ToString(),
|
|
|
- Text = x.Name
|
|
|
- }).ToList();
|
|
|
+ var gatherCategory = await AdminManager.Shared.GetGatherCategoryByIdAsync(_currentGatherData.CategoryId);
|
|
|
+ _gathererItems = gatherCategory.Gatherers.Select(x => new SelectedItem
|
|
|
+ {
|
|
|
+ Value = x.Id.ToString(),
|
|
|
+ Text = x.Name
|
|
|
+ }).ToList();
|
|
|
+ _currentGatherData.CategoryType = CategoryType.GatherCategory;
|
|
|
+ }
|
|
|
+ _gathererItems.Insert(0, new SelectedItem("0", "请选择..."));
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
@@ -124,13 +165,12 @@ namespace aipmgr.Pages
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private async Task OnCollectorChanged(SelectedItem item)
|
|
|
+ private async Task OnGatherChanged(SelectedItem item)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
await LoadingManager.OpenAsync();
|
|
|
- _currentGatherData.CollectorId = long.Parse(item.Value);
|
|
|
- _currentGatherData.CollectorName = item.Text;
|
|
|
+ _currentGatherData.GathererName = item.Text;
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -153,11 +193,10 @@ namespace aipmgr.Pages
|
|
|
Value = x.Id.ToString(),
|
|
|
Text = x.Name
|
|
|
}).ToList();
|
|
|
-
|
|
|
var searchModel = new SearchGatherDataModel
|
|
|
{
|
|
|
- Name = SearchModel.GatherCategoryName,
|
|
|
- CollectorName = SearchModel.CollectorName,
|
|
|
+ Name = SearchModel.CategoryName,
|
|
|
+ GathererName = SearchModel.GathererName,
|
|
|
OrganizationId = SearchModel.OrganizationId,
|
|
|
ModelType = SearchModel.ModelType,
|
|
|
Source = SearchModel.Source,
|
|
@@ -175,10 +214,11 @@ namespace aipmgr.Pages
|
|
|
foreach (var item in files)
|
|
|
{
|
|
|
var vo = MapHelper.Map<GatherDataModel, GatherData>(item);
|
|
|
- vo.CollectorName = item.Collector.Name;
|
|
|
- vo.CollectorId = item.Collector.Id;
|
|
|
- vo.GatherCategoryName = item.GatherCategory.Name;
|
|
|
- vo.GatherCategoryId = item.GatherCategory.Id;
|
|
|
+ vo.GathererName = item.Gatherer.Name;
|
|
|
+ vo.GathererId = item.Gatherer.Id;
|
|
|
+ vo.CategoryName = item.Category.Name;
|
|
|
+ vo.CategoryId = item.Category.Id;
|
|
|
+ vo.CategoryType = item.Category.Type;
|
|
|
vo.OrganizationId = item.Organization.Id;
|
|
|
vo.OrganizationName = item.Organization.Name;
|
|
|
vo.GatherTime.StartTime = item.StartTime.ToLocalTime();
|
|
@@ -208,8 +248,8 @@ namespace aipmgr.Pages
|
|
|
item.OrganizationId = long.Parse(_organizationItems.First().Value);
|
|
|
item.OrganizationName = _organizationItems.First().Text;
|
|
|
}
|
|
|
- item.GatherCategoryName = null;
|
|
|
- item.CollectorName = null;
|
|
|
+ item.CategoryName = null;
|
|
|
+ item.GathererName = null;
|
|
|
item.ModelType = null;
|
|
|
item.Source = null;
|
|
|
item.SettlementTime = null;
|
|
@@ -275,17 +315,17 @@ namespace aipmgr.Pages
|
|
|
_currentGatherData.GatherTime.StartTime = GatherTimeRange.Start;
|
|
|
_currentGatherData.GatherTime.EndTime = GatherTimeRange.End;
|
|
|
}
|
|
|
- if (string.IsNullOrEmpty(_currentGatherData.OrganizationName))
|
|
|
+ if (_currentGatherData.OrganizationId == 0)
|
|
|
{
|
|
|
await _messageBaseRef.ShowMessageBaseAsync("请选择组织!");
|
|
|
return;
|
|
|
}
|
|
|
- if (_currentGatherData.GatherCategoryId <= 0)
|
|
|
+ if (_currentGatherData.CategoryId == 0)
|
|
|
{
|
|
|
await _messageBaseRef.ShowMessageBaseAsync("请选择采集大类!");
|
|
|
return;
|
|
|
}
|
|
|
- if (_currentGatherData.CollectorId == null || _currentGatherData.GatherCategoryId <= 0)
|
|
|
+ if (_currentGatherData.GathererId == 0)
|
|
|
{
|
|
|
await _messageBaseRef.ShowMessageBaseAsync("请选择采集人员!");
|
|
|
return;
|
|
@@ -323,26 +363,43 @@ namespace aipmgr.Pages
|
|
|
if (_changedType == ItemChangedType.Update)
|
|
|
{
|
|
|
var gatherData = await AdminManager.Shared.GetGatherDataByIdAsync(_currentGatherData.Id);
|
|
|
- await AdminManager.Shared.UpdateGatherDataAsync(gatherData.Id, _currentGatherData.GatherCategoryId, new EntityBase
|
|
|
+ await AdminManager.Shared.UpdateGatherDataAsync(gatherData.Id,
|
|
|
+ new CategoryItem
|
|
|
+ {
|
|
|
+ Id = _currentGatherData.CategoryId,
|
|
|
+ Name = _currentGatherData.CategoryName,
|
|
|
+ Type = _currentGatherData.CategoryType,
|
|
|
+ },
|
|
|
+ new EntityBase
|
|
|
{
|
|
|
Id = _currentGatherData.OrganizationId,
|
|
|
Name = _currentGatherData.OrganizationName,
|
|
|
- }, new EntityBase
|
|
|
+ },
|
|
|
+ new EntityBase
|
|
|
{
|
|
|
- Id = _currentGatherData.CollectorId.Value,
|
|
|
- Name = _currentGatherData.CollectorName,
|
|
|
- }, _currentGatherData.ModelType, _currentGatherData.Source, _currentGatherData.CollectionQuantity.Value, _currentGatherData.GatherTime.StartTime.Value, _currentGatherData.GatherTime.EndTime.Value, _currentGatherData.SettlementTime.Value);
|
|
|
+ Id = _currentGatherData.GathererId,
|
|
|
+ Name = _currentGatherData.GathererName,
|
|
|
+ },
|
|
|
+ _currentGatherData.ModelType, _currentGatherData.Source, _currentGatherData.CollectionQuantity.Value, _currentGatherData.GatherTime.StartTime.Value, _currentGatherData.GatherTime.EndTime.Value, _currentGatherData.SettlementTime.Value);
|
|
|
}
|
|
|
else if (_changedType == ItemChangedType.Add)
|
|
|
{
|
|
|
- await AdminManager.Shared.CreateGatherDataAsync(_currentGatherData.GatherCategoryId, new EntityBase
|
|
|
+ await AdminManager.Shared.CreateGatherDataAsync(
|
|
|
+ new CategoryItem
|
|
|
+ {
|
|
|
+ Id = _currentGatherData.CategoryId,
|
|
|
+ Name = _currentGatherData.CategoryName,
|
|
|
+ Type = _currentGatherData.CategoryType,
|
|
|
+ },
|
|
|
+ new EntityBase
|
|
|
{
|
|
|
Id = _currentGatherData.OrganizationId,
|
|
|
Name = _currentGatherData.OrganizationName,
|
|
|
- }, new EntityBase
|
|
|
+ },
|
|
|
+ new EntityBase
|
|
|
{
|
|
|
- Id = _currentGatherData.CollectorId.Value,
|
|
|
- Name = _currentGatherData.CollectorName,
|
|
|
+ Id = _currentGatherData.GathererId,
|
|
|
+ Name = _currentGatherData.GathererName,
|
|
|
}, _currentGatherData.ModelType, _currentGatherData.Source, _currentGatherData.CollectionQuantity.Value, _currentGatherData.GatherTime.StartTime.Value, _currentGatherData.GatherTime.EndTime.Value, _currentGatherData.SettlementTime.Value);
|
|
|
}
|
|
|
StateHasChanged();
|