ProjectReviewer.razor.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using AntDesign;
  2. using Microsoft.AspNetCore.Components;
  3. using Microsoft.AspNetCore.Components.Web;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. using wispro.sp.entity;
  9. using wispro.sp.share;
  10. using wispro.sp.web.Services;
  11. namespace wispro.sp.web.Pages.Project
  12. {
  13. public partial class ProjectReviewer
  14. {
  15. private List<ProjectContents> projectContents;
  16. private ProjectInfo projectInfo;
  17. private List<ProjectInfo> waitingReviewProjects;
  18. private ViewProjectWorkContent editObj;
  19. [Parameter]
  20. public string ProjectNo { get; set; }
  21. [Inject]
  22. IProjectService projectService { get; set; }
  23. [Inject]
  24. CalMonthServices calMonthServices { get; set; }
  25. [Inject] public MessageService _message { get; set; }
  26. [Inject] NavigationManager _NavigationManager { get; set; }
  27. protected async override Task OnInitializedAsync()
  28. {
  29. CalMonth cal =await calMonthServices.GetHandlingMonth();
  30. if (!string.IsNullOrEmpty(ProjectNo))
  31. {
  32. projectContents = await projectService.GetProjectCanReviewWorkContent(ProjectNo, cal);
  33. }
  34. else
  35. {
  36. waitingReviewProjects = await projectService.GetWaitingReviewProjects();
  37. }
  38. await base.OnInitializedAsync();
  39. }
  40. void startEdit(ViewProjectWorkContent pp)
  41. {
  42. editObj = pp;
  43. }
  44. void stopEdit()
  45. {
  46. editObj = null;
  47. }
  48. void ContentChanged(ViewProjectWorkContent pp)
  49. {
  50. pp.modifyState = ModifyState.Modified;
  51. }
  52. void OnInput(ChangeEventArgs e)
  53. {
  54. if (editObj != null)
  55. {
  56. editObj.modifyState = ModifyState.Modified;
  57. }
  58. }
  59. async void Save()
  60. {
  61. var ret = await projectService.ReviewProjectWorkContent(projectContents);
  62. if (ret.Success)
  63. {
  64. _NavigationManager.NavigateTo("/Home");
  65. await _message.Success("保存成功!");
  66. }
  67. else
  68. {
  69. await _message.Error("保存出错!");
  70. }
  71. }
  72. }
  73. }