123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- using AntDesign;
- using AntDesign.TableModels;
- using Microsoft.AspNetCore.Components;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using wispro.sp.entity;
- using wispro.sp.web.Models;
- using wispro.sp.web.Services;
- namespace wispro.sp.web.Components
- {
- public partial class SSTable
- {
- protected AntDesign.Table<AppealRecord> table;
- AntDesign.Column<AppealRecord> column;
- int _total;
- int _pageIndex=1;
- int _pageSize=10;
- bool _loading;
-
- [Parameter]
- public List<AppealRecord> Datas { get; set; }
- //[Inject] protected UserService _userService { get; set; }
- [Inject] protected AppealTypeService _atService { get; set; }
- [Parameter]
- public bool ShowAction { get; set; } = true;
- [Parameter]
- public int? UserId { get; set; }
- AppealRecord CurrentAppealRecord;
- bool _ShowDetail;
- List<InputFieldValue> _FieldValues;
- List<InputFieldValue> _ReviewValues;
- List<AttachFile> attachFiles;
- async Task ShowDetail(AppealRecord appealRecord)
- {
-
- CurrentAppealRecord = appealRecord;
- _FieldValues = await _atService.GetInputFieldValues(appealRecord.Id, 0);
- attachFiles = await _atService.GetAppealRecordAttachFiles(CurrentAppealRecord.Id);
- if (appealRecord.State > 0)
- {
- _ReviewValues = await _atService.GetInputFieldValues(appealRecord.Id, 1);
- }
- _ShowDetail = true;
- StateHasChanged();
- }
- void CloseDetail()
- {
- _ShowDetail = false;
- }
- Dictionary<string, object> OnRow(RowData<AppealRecord> row) => new()
- {
- ["id"] = row.Data.Id,
- ["onclick"] = ((Action)delegate
- {
- _ = ShowDetail(row.Data);
- })
- };
- //CurrentUser currentUser;
- [Parameter]
- public EventCallback<AppealRecord> OnReview { get; set; }
- [Parameter]
- public EventCallback<AppealRecord> OnChangeReviewer { get; set; }
- protected override void OnParametersSet()
- {
- _total = Datas.Count;
- base.OnParametersSet();
- }
- public int serialNumber(int pageIndex, int pageSize, AppealRecord appealRecord)
- {
- //int iIndex = 0;
- //foreach (AppealRecord sf in Datas)
- //{
- // iIndex++;
- // if (sf == appealRecord)
- // {
- // break;
- // }
- //}
- var queryModel = table.GetQueryModel();
- if (table.SortDirections.Count() > 0)
- {
- //Console.WriteLine(table.SortDirections[0].Name);
- //Console.WriteLine(table.SortDirections[0].Value);
- }
- return Datas.IndexOf(appealRecord) + 1;
- //return iIndex;
- }
- private void HandlePageChange(PaginationEventArgs args)
- {
- if (_pageIndex != args.Page)
- {
- _pageIndex = args.Page;
- }
- if (_pageSize != args.PageSize)
- {
- _pageSize = args.PageSize;
- }
- }
- private async void _OnReview(AppealRecord appealRecord)
- {
- if (OnReview.HasDelegate)
- {
- await OnReview.InvokeAsync(appealRecord);
- }
- }
-
- private async void _OnChangeReviewer(AppealRecord appealRecord)
- {
- if (OnChangeReviewer.HasDelegate)
- {
- await OnChangeReviewer.InvokeAsync(appealRecord);
- }
- }
- }
- }
|