CreateAppealModel.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using Microsoft.AspNetCore.Components;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text.Json;
  6. using System.Threading.Tasks;
  7. using wispro.sp.entity;
  8. using wispro.sp.web.Services;
  9. namespace wispro.sp.web.Models
  10. {
  11. public class CreateAppealModel
  12. {
  13. public PerformanceItem Item { get; set; }
  14. public AppealType AppealType { get; set; }
  15. private List<InputField> inputFields;
  16. public List<InputFieldValue> inputFieldValues { get; set; }
  17. public AppealRecord AppealRecord { get; set; }
  18. public CreateAppealModel() { }
  19. public async Task Init(AppealTypeService _atService,PerformanceItem item,AppealType appealType)
  20. {
  21. Item = item;
  22. AppealType = appealType;
  23. AppealRecord = new AppealRecord();
  24. AppealRecord.TypeId = appealType.Id;
  25. AppealRecord.ItemId = item.Id;
  26. AppealRecord.State = 0;
  27. if (AppealType != null)
  28. {
  29. inputFieldValues = new List<InputFieldValue>();
  30. Console.WriteLine($"CreateAppealModel:{JsonSerializer.Serialize(AppealType)}");
  31. if(_atService == null)
  32. {
  33. Console.WriteLine($"CreateAppealModel:_atService = null");
  34. }
  35. inputFields =await _atService.GetInputFields(AppealType.Id, 0);
  36. foreach (var field in inputFields)
  37. {
  38. var fValue = new InputFieldValue();
  39. fValue.InputField = field;
  40. fValue.InputFieldId = field.Id;
  41. inputFieldValues.Add(fValue);
  42. }
  43. }
  44. }
  45. }
  46. }