123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- using System.Threading.Tasks;
- using wispro.sp.web.Models;
- using wispro.sp.web.Services;
- using Microsoft.AspNetCore.Components;
- using wispro.sp.web.Components;
- using System.Collections.Generic;
- using wispro.sp.entity;
- using System.Text.Json;
- using AntDesign;
- using System;
- namespace wispro.sp.web.Pages
- {
- public partial class Welcome
- {
- private readonly EditableLink[] _links =
- {
- new EditableLink {Title = "Operation 1", Href = ""},
- new EditableLink {Title = "Operation 2", Href = ""},
- new EditableLink {Title = "Operation 3", Href = ""},
- new EditableLink {Title = "Operation 4", Href = ""},
- new EditableLink {Title = "Operation 5", Href = ""},
- new EditableLink {Title = "Operation 6", Href = ""}
- };
- private ActivitiesType[] _activities = { };
- private NoticeType[] _projectNotice = { };
- private CurrentUser _CurrentUser;
- private List<AppealRecord> AppealRecords = new List<AppealRecord>();
- [Inject] public IProjectService ProjectService { get; set; }
- [Inject] public IUserService _userService { get; set; }
- [Inject] protected AppealTypeService _atService { get; set; }
- private ModalRef _modalRef;
- [Inject] ModalService _ModalService { get; set; }
- [Inject] MessageService _msgService { get; set; }
- private Models.CurrentUser _user;
-
- protected override async System.Threading.Tasks.Task OnInitializedAsync()
- {
- await base.OnInitializedAsync();
- _CurrentUser =await _userService.GetUser();
- if (_CurrentUser != null)
- {
- //_projectNotice = await ProjectService.GetProjectNoticeAsync();
- //_activities = await ProjectService.GetActivitiesAsync();
- AppealRecords = await _atService.GetUserAppeals(_CurrentUser.Userid);
- if (AppealRecords != null)
- {
- //try
- //{
- // //_user = await _userService.GetUser();
- // //AppealRecords.Sort((a, b) =>
- // //{
- // // var sd = (a.ReviewTime == null) ? a.ReviewTime : a.CreateTime;
- // // var ed = (b.ReviewTime == null) ? b.ReviewTime : b.CreateTime;
- // // if (ed > sd)
- // // {
- // // return 1;
- // // }
- // // else
- // // {
- // // return -1;
- // // }
- // //});
- //}
- //catch { }
- }
- }
- else
- {
- //NavigationManager.
- }
- StateHasChanged();
-
- }
- async Task ShowModel(AppealRecord appealRecord)
- {
-
- var templateOptions = new Models.ReviewerAppealModel();
- await templateOptions.Init(_atService, appealRecord.Id);
- Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(templateOptions));
- var modalConfig = new ModalOptions();
- modalConfig.Title = $"{appealRecord.Type.Name}审核" ;
- modalConfig.Width = 650;
- //modalConfig.Footer = null;
- modalConfig.DestroyOnClose = true;
- _modalRef = await _ModalService
- .CreateModalAsync<Components.ReviewerAppeal, Models.ReviewerAppealModel>(modalConfig, templateOptions);
- _modalRef.OnOpen = () =>
- {
- return Task.CompletedTask;
- };
- _modalRef.OnOk = async () =>
- {
- try
- {
- await _atService.ReviewerAppeal(templateOptions);
- await _modalRef.CloseAsync();
- AppealRecords = await _atService.GetUserAppeals(_CurrentUser.Userid);
- //AppealRecords.Sort((a, b) =>
- //{
- // try
- // {
- // var sd = (a.ReviewTime == null) ? a.ReviewTime : a.CreateTime;
- // var ed = (b.ReviewTime == null) ? b.ReviewTime : b.CreateTime;
- // if (ed > sd)
- // {
- // return 1;
- // }
- // else
- // {
- // return -1;
- // }
- // }
- // catch
- // {
- // return 0;
- // }
- //});
- StateHasChanged();
- var SuccessConfig = new ConfirmOptions()
- {
- Content = @"审核成功!"
- };
- //modalConfig.Footer = null;
- modalConfig.DestroyOnClose = true;
- _ModalService.Success(SuccessConfig);
-
- }
- catch (Exception ex)
- {
- _ModalService.Error(new ConfirmOptions()
- {
- Title = "审核错误",
- Content = ex.Message,
- });
-
- }
-
- };
- _modalRef.OnCancel = () =>
- {
- return Task.CompletedTask;
- };
- _modalRef.OnClose = () =>
- {
- return Task.CompletedTask;
- };
- StateHasChanged();
- }
-
-
- }
- }
|