MyCaselist.razor.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. using AntDesign;
  2. using AntDesign.ProLayout;
  3. using AntDesign.TableModels;
  4. using Microsoft.AspNetCore.Authorization;
  5. using Microsoft.AspNetCore.Components;
  6. using Microsoft.AspNetCore.Components.Web;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Threading.Tasks;
  11. using wispro.sp.entity;
  12. using wispro.sp.share;
  13. using wispro.sp.web.Services;
  14. namespace wispro.sp.web.Pages.AppCase
  15. {
  16. [Authorize]
  17. public partial class MyCaselist
  18. {
  19. const string strAgentFeedbackMemo = "AgentFeedbackMemo";
  20. const string strDoItemCoefficient = "DoItemCoefficient";
  21. const string strReturnCasseNo = "ReturnCasseNo";
  22. const string strCaseCoefficient = "CaseCoefficient";
  23. const string strWordCount = "WordCount";
  24. class Reason
  25. {
  26. public string Value { get; set; }
  27. public string Name { get; set; }
  28. }
  29. List<Reason> _Reasons = new List<Reason>()
  30. {
  31. new Reason(){Name="PCT首次英文案",Value="PCT首次英文案"},
  32. new Reason(){Name="我方转格式、复核",Value="我方转格式、复核"},
  33. new Reason(){Name="台湾案转大陆案",Value="台湾案转大陆案"},
  34. new Reason(){Name="大陆案转台湾案",Value="大陆案转台湾案"},
  35. new Reason(){Name="同套大陆+台湾",Value="同套大陆+台湾"},
  36. new Reason(){Name="不请款",Value="不请款"},
  37. new Reason(){Name="撤回后重新递交",Value="撤回后重新递交"},
  38. new Reason(){Name="发文后客户取消申请",Value="发文后客户取消申请"},
  39. new Reason(){Name="发文后客户原因取消申请,系统结案",Value="发文后客户原因取消申请,系统结案"},
  40. new Reason(){Name="改权",Value="改权"},
  41. new Reason(){Name="改权+改说明书",Value="改权+改说明书"},
  42. new Reason(){Name="客户不进行答辩",Value="客户不进行答辩"},
  43. new Reason(){Name="客户提供答辩点,撰写英文报导函",Value="客户提供答辩点,撰写英文报导函"},
  44. new Reason(){Name="客户未提供答辩点,撰写英文报导函",Value="客户未提供答辩点,撰写英文报导函辩"},
  45. new Reason(){Name="内-外",Value="内-外"},
  46. new Reason(){Name="外-内",Value="外-内"},
  47. new Reason(){Name="外-内首次申请",Value="外-内首次申请"},
  48. new Reason(){Name="请款",Value="请款"},
  49. new Reason(){Name="涉外OA不答辩,发报导函结案",Value="涉外OA不答辩,发报导函结案"},
  50. new Reason(){Name="涉外实质改权",Value="涉外实质改权"},
  51. new Reason(){Name="首次中文案",Value="首次中文案"},
  52. new Reason(){Name="我方转格式、复核",Value="我方转格式、复核"},
  53. new Reason(){Name="外所/他人首次转入OA",Value="外所/他人首次转入OA"},
  54. new Reason(){Name="我方代交",Value="我方代交"},
  55. new Reason(){Name="转格式",Value="转格式"},
  56. new Reason(){Name="撰写中客户取消申请",Value="撰写中客户取消申请"},
  57. new Reason(){Name="中-英",Value="中-英"},
  58. new Reason(){Name="英-中",Value="英-中"},
  59. new Reason(){Name="英-德",Value="英-德"}
  60. };
  61. private List<PerformanceItem> _Datas;
  62. private List<StaffStatistics> MyStatistics;
  63. IEnumerable<PerformanceItem> selectedItems= new List<PerformanceItem>();
  64. private CalMonth HandlingCalMonth;
  65. int _pageIndex = 1;
  66. int _pageSize = 10;
  67. int _total;
  68. bool _loading = false;
  69. PerformanceItem EditingItem = null;
  70. bool _visible = false;
  71. bool _isAdd = false;
  72. [Inject] public PerformanceItemServices _ItemService { get; set; }
  73. [Inject] public MessageService _message { get; set; }
  74. [Inject] protected NavigationManager NavigationManager { get; set; }
  75. [Inject] protected IUserService _userService { get; set; }
  76. [Inject] protected CalMonthServices _CalMonthService { get; set; }
  77. private bool isFirstInit = true;
  78. protected async override Task OnInitializedAsync()
  79. {
  80. if (isFirstInit)
  81. {
  82. _loading = true;
  83. var HandlingCalMonth =await _CalMonthService.GetHandlingMonth();
  84. MyStatistics = await _ItemService.CalMyStatistics(HandlingCalMonth.Year,HandlingCalMonth.Month, _userService.CurrentUser.Userid.Value);
  85. var data = await _ItemService.GetMyList(_userService.CurrentUser.Userid.Value, jxType.doing,_pageIndex,_pageSize);
  86. _Datas = data.Results;
  87. _total = data.TotalCount;
  88. _loading = false;
  89. }
  90. isFirstInit = false;
  91. StateHasChanged();
  92. Console.WriteLine($"OnInitializedAsync:[tota:{_total}\tPageIndex:{_pageIndex}\tPageSize:{_pageSize}]");
  93. }
  94. private string GetStatistics(string strType)
  95. {
  96. if (strType != "ALL")
  97. {
  98. var tem= MyStatistics.Where<StaffStatistics>(s => s.jxType == strType).FirstOrDefault();
  99. if(tem != null)
  100. {
  101. return (tem.totalBasePoint.HasValue?tem.totalBasePoint.Value.ToString("0.00"):"");
  102. }
  103. else
  104. {
  105. return "";
  106. }
  107. }
  108. else
  109. {
  110. return MyStatistics.Select(s => s.totalBasePoint.Value).Sum().ToString("0.00");
  111. }
  112. }
  113. private int serialNumber(int pageIndex, int pageSize, int id)
  114. {
  115. int iIndex = 0;
  116. foreach (PerformanceItem sf in _Datas)
  117. {
  118. iIndex++;
  119. if (sf.Id == id)
  120. {
  121. break;
  122. }
  123. }
  124. return (pageIndex - 1) * pageSize + iIndex;
  125. }
  126. private async Task HandleTableChange(QueryModel<PerformanceItem> queryModel)
  127. {
  128. _loading = true;
  129. var data = await _ItemService.GetMyList(_userService.CurrentUser.Userid.Value, jxType.doing, _pageIndex, _pageSize);
  130. _Datas = data.Results;
  131. _total = data.TotalCount;
  132. _loading = false;
  133. StateHasChanged();
  134. }
  135. private void OnsubShensu(PerformanceItem Item)
  136. {
  137. EditingItem = Item;
  138. _visible = true;
  139. //return new EventCallback();
  140. }
  141. bool _ShowJXModal = false;
  142. private void OnJXCal(PerformanceItem Item)
  143. {
  144. EditingItem = Item;
  145. _ShowJXModal = true;
  146. }
  147. #region 申诉窗口事件
  148. private void HandleOk(MouseEventArgs e)
  149. {
  150. Console.WriteLine(e);
  151. _visible = false;
  152. }
  153. private void HandleCancel(MouseEventArgs e)
  154. {
  155. Console.WriteLine(e);
  156. _visible = false;
  157. }
  158. #endregion
  159. #region 绩效计算窗口事件
  160. private async Task HandleOk1(MouseEventArgs e)
  161. {
  162. _ShowJXModal = false;
  163. var respone = await _ItemService.SaveFieldChange(EditingItem.Id, $"{strAgentFeedbackMemo}|{strWordCount}", $"{_calType.AgentMemo}|{_calType.wordCount}");
  164. var HandlingCalMonth = await _CalMonthService.GetHandlingMonth();
  165. MyStatistics = await _ItemService.CalMyStatistics(HandlingCalMonth.Year, HandlingCalMonth.Month, _userService.CurrentUser.Userid.Value);
  166. EditingItem.AgentFeedbackMemo = _calType.AgentMemo;
  167. StateHasChanged();
  168. }
  169. private void HandleCancel1(MouseEventArgs e)
  170. {
  171. Console.WriteLine(e);
  172. _ShowJXModal = false;
  173. }
  174. #endregion
  175. public shensuType[] AvatarMenuItems { get; set; } = new shensuType[]
  176. {
  177. new() { ChangeField = "核稿人", Name = "核稿人申诉"},
  178. new() { ChangeField = "处理人", Name = "处理人申诉"},
  179. new() { ChangeField = "案件系数", Name = "案件系数申诉"},
  180. new() { ChangeField = "处理事项系数", Name = "处理事项系数申诉"},
  181. new() { Name = "严重超期说明"}
  182. };
  183. private shensuType _SelectedItem;
  184. private void OnSelectedItemChangedHandler(shensuType value)
  185. {
  186. _SelectedItem = value;
  187. //StaffGradeIdChanged.InvokeAsync(_SelectedItem.Id);
  188. }
  189. #region 文件上传控件设定
  190. List<UploadFileItem> fileList = new List<UploadFileItem>
  191. {
  192. new UploadFileItem
  193. {
  194. Id = "1",
  195. FileName = "客户往来邮件1.jpg",
  196. Url = "#",
  197. State = UploadState.Success
  198. },
  199. new UploadFileItem
  200. {
  201. Id = "2",
  202. FileName = "与客户微信聊天图片.jpg",
  203. Url = "#",
  204. State = UploadState.Success
  205. },
  206. new UploadFileItem
  207. {
  208. Id = "3",
  209. FileName = "附件.docx",
  210. Url = "#",
  211. State = UploadState.Success
  212. }
  213. };
  214. Dictionary<string, object> attrs = new Dictionary<string, object>
  215. {
  216. {"Action", "#" },
  217. {"Name", "files" },
  218. {"Multiple", true }
  219. };
  220. void HandleChange(UploadInfo fileinfo)
  221. {
  222. //if (fileList.Count > 5)
  223. //{
  224. // fileList.RemoveRange(0, fileList.Count - 2);
  225. //}
  226. //fileList.Where(file => file.State == UploadState.Success && !string.IsNullOrWhiteSpace(file.Response)).ForEach(file => {
  227. // var result = file.GetResponse<ResponseModel>();
  228. // file.Url = result.url;
  229. //});
  230. }
  231. public class ResponseModel
  232. {
  233. public string name { get; set; }
  234. public string status { get; set; }
  235. public string url { get; set; }
  236. public string thumbUrl { get; set; }
  237. }
  238. #endregion
  239. CalType _calType = new CalType();
  240. shenshou _shenshou = new shenshou();
  241. List<Staff> Reviewers = new List<Staff>()
  242. {
  243. new Staff(){Id =1,Name ="钟子敏"},
  244. new Staff(){Id =2,Name ="邢丽霞"},
  245. new Staff(){Id =3,Name ="李丽"},
  246. new Staff(){Id =4,Name ="贾凤涛"},
  247. };
  248. private async Task OnChange(PaginationEventArgs args)
  249. {
  250. if (_pageIndex != args.Page || _pageSize != args.PageSize)
  251. {
  252. _pageIndex = args.Page;
  253. _pageSize = args.PageSize;
  254. _loading = true;
  255. _Datas = null;
  256. var data = await _ItemService.GetMyList(_userService.CurrentUser.Userid.Value, jxType.doing, _pageIndex, _pageSize);
  257. _Datas = data.Results;
  258. _total = data.TotalCount;
  259. _loading = false;
  260. }
  261. }
  262. void SelectChanged(Reason value)
  263. {
  264. if (!_loading && EditingItem != null)
  265. {
  266. var respone = _ItemService.SaveFieldChange(EditingItem.Id, strAgentFeedbackMemo, EditingItem.AgentFeedbackMemo);
  267. EditingItem = null;
  268. }
  269. }
  270. void ClearSelect(int itemId)
  271. {
  272. Console.WriteLine($"ClearSelcet:{itemId}");
  273. var respone = _ItemService.SaveFieldChange(itemId, strAgentFeedbackMemo,"");
  274. EditingItem = null;
  275. }
  276. Dictionary<string, object> OnRow(RowData<PerformanceItem> row)
  277. {
  278. Dictionary<string, object> ret = new Dictionary<string, object>();
  279. ret.Add("onclick", ((Action)delegate
  280. {
  281. EditingItem = row.Data;
  282. }));
  283. return ret;
  284. }
  285. void OnFocus(PerformanceItem item)
  286. {
  287. EditingItem = item;
  288. }
  289. }
  290. }