MyCaselist.razor.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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. private List<PerformanceItem> _Datas;
  33. private List<StaffStatistics> MyStatistics;
  34. IEnumerable<PerformanceItem> selectedItems= new List<PerformanceItem>();
  35. private CalMonth HandlingCalMonth;
  36. int _pageIndex = 1;
  37. int _pageSize = 10;
  38. int _total;
  39. bool _loading = false;
  40. PerformanceItem EditingItem = null;
  41. bool _visible = false;
  42. bool _isAdd = false;
  43. List<TabPaneItem> tabList = new List<TabPaneItem>() {
  44. new TabPaneItem(){ Key ="myList", Tab ="本月待确认绩效" },
  45. new TabPaneItem(){ Key ="myAll", Tab ="往期已计算绩效"},
  46. };
  47. [Inject] public PerformanceItemServices _ItemService { get; set; }
  48. [Inject] public MessageService _message { get; set; }
  49. [Inject] protected NavigationManager NavigationManager { get; set; }
  50. [Inject] protected IUserService _userService { get; set; }
  51. [Inject] protected CalMonthServices _CalMonthService { get; set; }
  52. private bool isFirstInit = true;
  53. private Table<PerformanceItem> table;
  54. protected async override Task OnInitializedAsync()
  55. {
  56. if (isFirstInit)
  57. {
  58. _loading = true;
  59. await RefreshMyStatistics();
  60. _Datas = new List<PerformanceItem>();// data.Results;
  61. _total = 0;//data.TotalCount;
  62. _loading = false;
  63. }
  64. isFirstInit = false;
  65. StateHasChanged();
  66. //Console.WriteLine($"OnInitializedAsync:[tota:{_total}\tPageIndex:{_pageIndex}\tPageSize:{_pageSize}]");
  67. }
  68. private async Task RefreshMyStatistics()
  69. {
  70. var HandlingCalMonth = await _CalMonthService.GetHandlingMonth();
  71. if (HandlingCalMonth != null)
  72. {
  73. MyStatistics = await _ItemService.CalMyStatistics(HandlingCalMonth.Year, HandlingCalMonth.Month, _userService.CurrentUser.Userid.Value);
  74. }
  75. }
  76. private string GetStatistics(string strType)
  77. {
  78. try
  79. {
  80. if (strType != "ALL")
  81. {
  82. var tem = MyStatistics.Where<StaffStatistics>(s => s.jxType == strType).FirstOrDefault();
  83. if (tem != null)
  84. {
  85. return (tem.totalBasePoint.HasValue ? tem.totalBasePoint.Value.ToString("0.00") : "");
  86. }
  87. else
  88. {
  89. return "";
  90. }
  91. }
  92. else
  93. {
  94. return MyStatistics.Select(s => s.totalBasePoint.Value).Sum().ToString("0.00");
  95. }
  96. }
  97. catch
  98. {
  99. return "";
  100. }
  101. }
  102. private int serialNumber(int pageIndex, int pageSize, int id)
  103. {
  104. int iIndex = 0;
  105. foreach (PerformanceItem sf in _Datas)
  106. {
  107. iIndex++;
  108. if (sf.Id == id)
  109. {
  110. break;
  111. }
  112. }
  113. return (pageIndex - 1) * pageSize + iIndex;
  114. }
  115. private async Task HandleTableChange(QueryModel<PerformanceItem> queryModel)
  116. {
  117. Console.WriteLine(JsonSerializer.Serialize(queryModel));
  118. if (_CurrentKey == tabList[0].Key)
  119. {
  120. _loading = true;
  121. var data = await _ItemService.Query(_userService.CurrentUser.Userid.Value, jxType.doing, queryModel);
  122. _Datas = data.Results;
  123. _total = data.TotalCount;
  124. _loading = false;
  125. StateHasChanged();
  126. }
  127. else
  128. {
  129. _loading = true;
  130. var data = await _ItemService.Query(_userService.CurrentUser.Userid.Value, jxType.finished, queryModel);
  131. _Datas = data.Results;
  132. _total = data.TotalCount;
  133. _loading = false;
  134. StateHasChanged();
  135. }
  136. }
  137. private void OnsubShensu(PerformanceItem Item)
  138. {
  139. EditingItem = Item;
  140. _visible = true;
  141. //return new EventCallback();
  142. }
  143. bool _ShowJXModal = false;
  144. private void OnJXCal(PerformanceItem Item)
  145. {
  146. EditingItem = Item;
  147. _ShowJXModal = true;
  148. }
  149. #region 申诉窗口事件
  150. private void HandleOk(MouseEventArgs e)
  151. {
  152. Console.WriteLine(e);
  153. _visible = false;
  154. }
  155. private void HandleCancel(MouseEventArgs e)
  156. {
  157. Console.WriteLine(e);
  158. _visible = false;
  159. }
  160. #endregion
  161. #region 绩效计算窗口事件
  162. private async Task HandleOk1(MouseEventArgs e)
  163. {
  164. _ShowJXModal = false;
  165. var respone = await _ItemService.SaveFieldChange(EditingItem.Id, $"{strAgentFeedbackMemo}|{strWordCount}", $"{_calType.AgentMemo}|{_calType.wordCount}");
  166. var HandlingCalMonth = await _CalMonthService.GetHandlingMonth();
  167. MyStatistics = await _ItemService.CalMyStatistics(HandlingCalMonth.Year, HandlingCalMonth.Month, _userService.CurrentUser.Userid.Value);
  168. EditingItem.AgentFeedbackMemo = _calType.AgentMemo;
  169. StateHasChanged();
  170. }
  171. private void HandleCancel1(MouseEventArgs e)
  172. {
  173. Console.WriteLine(e);
  174. _ShowJXModal = false;
  175. }
  176. #endregion
  177. public shensuType[] AvatarMenuItems { get; set; } = new shensuType[]
  178. {
  179. new() { ChangeField = "核稿人", Name = "核稿人申诉"},
  180. new() { ChangeField = "处理人", Name = "处理人申诉"},
  181. new() { ChangeField = "案件系数", Name = "案件系数申诉"},
  182. new() { ChangeField = "处理事项系数", Name = "处理事项系数申诉"},
  183. new() { Name = "严重超期说明"}
  184. };
  185. private shensuType _SelectedItem;
  186. private void OnSelectedItemChangedHandler(shensuType value)
  187. {
  188. _SelectedItem = value;
  189. //StaffGradeIdChanged.InvokeAsync(_SelectedItem.Id);
  190. }
  191. #region 文件上传控件设定
  192. List<UploadFileItem> fileList = new List<UploadFileItem>
  193. {
  194. new UploadFileItem
  195. {
  196. Id = "1",
  197. FileName = "客户往来邮件1.jpg",
  198. Url = "#",
  199. State = UploadState.Success
  200. },
  201. new UploadFileItem
  202. {
  203. Id = "2",
  204. FileName = "与客户微信聊天图片.jpg",
  205. Url = "#",
  206. State = UploadState.Success
  207. },
  208. new UploadFileItem
  209. {
  210. Id = "3",
  211. FileName = "附件.docx",
  212. Url = "#",
  213. State = UploadState.Success
  214. }
  215. };
  216. Dictionary<string, object> attrs = new Dictionary<string, object>
  217. {
  218. {"Action", "#" },
  219. {"Name", "files" },
  220. {"Multiple", true }
  221. };
  222. void HandleChange(UploadInfo fileinfo)
  223. {
  224. //if (fileList.Count > 5)
  225. //{
  226. // fileList.RemoveRange(0, fileList.Count - 2);
  227. //}
  228. //fileList.Where(file => file.State == UploadState.Success && !string.IsNullOrWhiteSpace(file.Response)).ForEach(file => {
  229. // var result = file.GetResponse<ResponseModel>();
  230. // file.Url = result.url;
  231. //});
  232. }
  233. public class ResponseModel
  234. {
  235. public string name { get; set; }
  236. public string status { get; set; }
  237. public string url { get; set; }
  238. public string thumbUrl { get; set; }
  239. }
  240. #endregion
  241. CalType _calType = new CalType();
  242. shenshou _shenshou = new shenshou();
  243. List<Staff> Reviewers = new List<Staff>()
  244. {
  245. new Staff(){Id =1,Name ="钟子敏"},
  246. new Staff(){Id =2,Name ="邢丽霞"},
  247. new Staff(){Id =3,Name ="李丽"},
  248. new Staff(){Id =4,Name ="贾凤涛"},
  249. };
  250. #region 特殊绩效字段选择框变更时处理代码
  251. void SelectChanged(Reason value)
  252. {
  253. if (!_loading && EditingItem != null)
  254. {
  255. var respone = _ItemService.SaveFieldChange(EditingItem.Id, strAgentFeedbackMemo, EditingItem.AgentFeedbackMemo);
  256. EditingItem = null;
  257. RefreshMyStatistics();
  258. table.ReloadData();
  259. }
  260. }
  261. void ClearSelect(int itemId)
  262. {
  263. Console.WriteLine($"ClearSelcet:{itemId}");
  264. var respone = _ItemService.SaveFieldChange(itemId, strAgentFeedbackMemo,"");
  265. EditingItem = null;
  266. RefreshMyStatistics();
  267. table.ReloadData();
  268. }
  269. #endregion
  270. Dictionary<string, object> OnRow(RowData<PerformanceItem> row)
  271. {
  272. Dictionary<string, object> ret = new Dictionary<string, object>();
  273. ret.Add("onclick", ((Action)delegate
  274. {
  275. EditingItem = row.Data;
  276. }));
  277. return ret;
  278. }
  279. void OnFocus(PerformanceItem item)
  280. {
  281. EditingItem = item;
  282. }
  283. string _CurrentKey = "myList";
  284. void OnTabChange(string key)
  285. {
  286. _CurrentKey = key;
  287. table.ReloadData();
  288. StateHasChanged();
  289. }
  290. }
  291. }