123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- using AntDesign;
- using Microsoft.AspNetCore.Components;
- using Microsoft.AspNetCore.Components.Forms;
- using Microsoft.Extensions.Configuration;
- using Microsoft.JSInterop;
- using ServiceStack;
- using ServiceStack.Messaging;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- using System.Net.Http.Json;
- using System.Text.Json;
- using System.Threading.Tasks;
- using wispro.sp.entity;
- using wispro.sp.web.Models;
- using wispro.sp.web.Services;
- namespace wispro.sp.web.Components
- {
- public partial class CreateAppeal
- {
- private CreateAppealModel _Model;
- private IFeedbackRef feedbackRef;
- private List<Staff> _Staffs;
- [Inject]
- protected AppealTypeService _atService { get; set; }
-
- [Inject] IUserService _UserService { get; set; }
- [Inject]
- protected IHttpService _httpClient{get;set;}
- [Inject]
- protected IConfiguration _configuration { get; set; }
- [Inject]
- protected OrganizationService _orgService { get; set; }
-
- #region 文件上传控件设定
- //List<UploadFileItem> fileList = new List<UploadFileItem>();
- Dictionary<string, object> attrs ;
- void HandleChange(UploadInfo fileinfo)
- {
- try
- {
- _Model.FileList.Where(file => file.State == UploadState.Success && !string.IsNullOrWhiteSpace(file.Response)).ForEach(file =>
- {
- var result = file.GetResponse<List<AttachFile>>();
- file.Url = $"{_configuration.GetValue<string>("APIUrl")}AttachFiles/Download?id={result[0].Id}";
- });
- }
- catch { }
- }
- private async Task<bool> RemoveFile(UploadFileItem fileinfo)
- {
- try
- {
- var result = fileinfo.GetResponse<List<AttachFile>>();
- return await _httpClient.Get<bool>($"{_configuration.GetValue<string>("APIUrl")}AttachFiles/Delete?id={result[0].Id}");
- }
- catch {
- return false;
- }
- }
- #endregion
- private string warningMessage = "";
- protected override async void OnInitialized()
- {
- attrs = new Dictionary<string, object>
- {
- {"Action", $"{_configuration.GetValue<string>("APIUrl")}AttachFiles/PostFile" },
- {"Name", "files" },
- {"Multiple", false }
- };
- _Model = base.Options ?? new CreateAppealModel();
- if (_Model.AppealType.Name == "案件系数复核")
- {
-
- //判断是否案件系数是否A或S是否超过限额
- Customer customer = _Model.Item.Customer;
-
- if (customer == null)
- {
- //获取客户信息
- if(_Model.Item.CustomerId != null)
- {
- customer = await _orgService.GetCustomer(_Model.Item.CustomerId.Value);
- }
-
- }
- if(customer!= null)
- {
- Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(customer));
- _Model.cssObject = await _atService.GetCaseCoefficientStatistics(customer.Id, _Model.Item.CalMonthId);
- if (_Model.cssObject != null && _Model.cssObject.isExceedingLimit())
- {
- warningMessage = $"客戶:{customer.Name}新申请案件S和A案件数已超过阈值,如果需要申请A或S的案件系数,请将审核人设置为钟子敏!";
- }
- }
-
- }
- //if(!string.IsNullOrEmpty(_Model.AppealType.ReviewerExpress))
- //{
- _Staffs =await _UserService.GetReviewers(_Model.AppealRecord.ItemId, _Model.AppealType.Id);
- //}
- //else
- //{
- // _Staffs =await _UserService.GetAll();
- //}
- base.OnInitialized();
- feedbackRef = base.FeedbackRef;
- StateHasChanged();
- }
- string _ErrorMessage;
- private async void OnFinish()
- {
-
- await base.OnFeedbackOkAsync(new ModalClosingEventArgs() { Cancel = true });
- }
- private void OnCancel()
- {
- base.OnFeedbackCancelAsync(new ModalClosingEventArgs() { Cancel = true });
- //_ = feedbackRef.CloseAsync();
- }
-
- }
- }
|