using AntDesign; using AntDesign.TableModels; using Microsoft.AspNetCore.Components; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using wispro.sp.web.Services; namespace wispro.sp.web.Pages.Workflow { public partial class WorkflowDefine { private List workflows = new List(); ITable table; double ChartWidth = 1000; double rectWidth = 120; double rectHeight = 60; int rectFontSize = 26; int _pageIndex = 1; int _pageSize = 10; int _total = 0; bool _loading = false; bool isAdd = false; entity.workflowDefine.Workflow EditingObj = null; List InitInputValues; bool _visible = false; bool _initModalVisible = false; List> FieldTypes = entity.EnumHelper.getEnumDescriptionDic(); entity.workflowDefine.FieldType fieldType = entity.workflowDefine.FieldType.ActionInputValue; [Inject] protected IUserService UserService { get; set; } [Inject] protected WorkflowService workflowService { get; set; } [Inject] protected MessageService _msgService { get; set; } protected override async System.Threading.Tasks.Task OnInitializedAsync() { await base.OnInitializedAsync(); } private void AddNew() { isAdd = true; EditingObj = new entity.workflowDefine.Workflow(); _visible = true; } async void HandleOk() { if (EditingObj.Id ==0) { int maxId = 0; foreach(var wf in workflows) { if(wf.Id > maxId) { maxId = wf.Id; } } EditingObj.Id = maxId + 1; EditingObj.CreateTime = DateTime.Now; EditingObj.CreateUser = new entity.Staff() { Name = (await UserService.GetUser()).Name }; workflows.Add(EditingObj); _total = workflows.Count; } _visible = false; StateHasChanged(); } void HandleCancel() { _visible = false; } public int serialNumber(int pageIndex, int pageSize, int Id) { int iIndex = 0; foreach (wispro.sp.entity.workflowDefine.Workflow sf in workflows) { iIndex++; if (sf.Id == Id) { break; } } return (pageIndex - 1) * pageSize + iIndex; } wispro.sp.entity.workflowDefine.Workflow SelectedWorkflow; Dictionary OnRow(RowData row) => new() { ["id"] = row.Data.Id, ["onclick"] = ((Action)delegate { SelectedWorkflow = row.Data; Console.WriteLine($"row {row.Data.Name} was clicked"); }) }; void Delete(entity.workflowDefine.Workflow workflow) { workflows.Remove(workflow); _total = workflows.Count; } void Detail(int Id) { } IDictionary> dicFieldSettings = new Dictionary>(); void InitFieldSetting(entity.workflowDefine.Workflow workflow) { if (dicFieldSettings.ContainsKey(workflow)) { InitInputValues = dicFieldSettings[workflow]; } else { InitInputValues = new List(); dicFieldSettings.Add(workflow,InitInputValues); } _initModalVisible = true; } async void InitOk() { _initModalVisible = false; } void InitCancel() { _initModalVisible = false; } void ClickStep(bool isEnd) { var msg = "您点击了开始步骤!"; if (isEnd) { msg = "您点击了结束步骤!"; } _msgService.Info(msg); } void ChangeRectSize() { Random rd = new Random(); var s = 0.5 + rd.NextDouble(); rectWidth = s * rectWidth; rectHeight = s * rectHeight; rectFontSize =(int)(s * rectFontSize); StateHasChanged(); } } }