using AntDesign.TableModels; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components; using SqlSugar; using System.Linq.Expressions; using VideoAnalysisCore.Common; using VideoAnalysisCore.Model; namespace Learn.VideoAnalysis.Components.Pages { [Authorize] public partial class EvaluationProject : ComponentBase { [Inject] private ConfirmService ComfirmService { get; set; } = default!; [Inject] private Repository criteria { get; set; } = default!; IEnumerable _selectedRows = []; ITable _table; List _dataSource = null; RefAsync _total = 0; bool tableLoading = false; /// /// 分页 查询 筛选 时 /// /// async void OnChange(QueryModel query) { tableLoading = true; List where = default!; if (query.FilterModel != null && ((query.FilterModel?.Count() ?? 0) > 0)) { where = query.ToSqlSugerWhere(); } _dataSource = await criteria.AsQueryable() .Where(where) .ToPageListAsync(query.PageIndex - 1, query.PageSize, _total); tableLoading = false; StateHasChanged(); } /// /// 删除行 /// /// /// async Task Delete(CourseGradingCriteria row) { if (!await Comfirm($"确定要删除这条数据吗? [{row.NamePrompt}]?")) return; await criteria.DeleteByIdAsync(row.Id); _table.ReloadData(); } /// /// 初始化 /// protected override void OnInitialized() { } private async Task Comfirm(string message) { return await ComfirmService.Show(message, "提示", ConfirmButtons.YesNo, ConfirmIcon.Warning) == ConfirmResult.Yes; } } }