using AntDesign; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using System; using System.Collections.Generic; using System.Linq; 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; [Inject] protected AppealTypeService _atService { get; set; } List Reviewers = new List() { new Staff(){Id =1,Name ="钟子敏"}, new Staff(){Id =2,Name ="邢丽霞"}, new Staff(){Id =3,Name ="李丽"}, new Staff(){Id =4,Name ="贾凤涛"}, }; #region 文件上传控件设定 List fileList = new List { new UploadFileItem { Id = "1", FileName = "客户往来邮件1.jpg", Url = "#", State = UploadState.Success }, new UploadFileItem { Id = "2", FileName = "与客户微信聊天图片.jpg", Url = "#", State = UploadState.Success }, new UploadFileItem { Id = "3", FileName = "附件.docx", Url = "#", State = UploadState.Success } }; Dictionary attrs = new Dictionary { {"Action", "http://localhost:39476/api/AttachFiles/PostFile" }, {"Name", "files" }, {"Multiple", false } }; void HandleChange(UploadInfo fileinfo) { //if (fileList.Count > 5) //{ // fileList.RemoveRange(0, fileList.Count - 2); //} //fileList.Where(file => file.State == UploadState.Success && !string.IsNullOrWhiteSpace(file.Response)).ForEach(file => { // var result = file.GetResponse(); // file.Url = result.url; //}); } public class ResponseModel { public string name { get; set; } public string status { get; set; } public string url { get; set; } public string thumbUrl { get; set; } } #endregion protected override async void OnInitialized() { _Model = base.Options ?? new CreateAppealModel(); Console.WriteLine($"Success:{JsonSerializer.Serialize(_Model)}"); base.OnInitialized(); } private void OnFinish() { Console.WriteLine($"Success:{JsonSerializer.Serialize(_Model)}"); _ = base.FeedbackRef.CloseAsync(); } private void OnCancel() { _ = base.FeedbackRef.CloseAsync(); } //private void OnFinishFailed(EditContext editContext) //{ // Console.WriteLine($"Failed:{JsonSerializer.Serialize(Model)}"); //} } }