MyCaselist.razor.cs 13 KB

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