123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- 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<wispro.sp.entity.workflowDefine.Workflow> workflows = new List<wispro.sp.entity.workflowDefine.Workflow>();
- 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<entity.workflowDefine.InputValueSetting> InitInputValues;
- bool _visible = false;
- bool _initModalVisible = false;
- List<wispro.sp.entity.EnumnDescription<wispro.sp.entity.workflowDefine.FieldType>> FieldTypes
- = entity.EnumHelper.getEnumDescriptionDic<wispro.sp.entity.workflowDefine.FieldType>();
- 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<string, object> OnRow(RowData<wispro.sp.entity.workflowDefine.Workflow> 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<entity.workflowDefine.Workflow, List<entity.workflowDefine.InputValueSetting>> dicFieldSettings
- = new Dictionary<entity.workflowDefine.Workflow, List<entity.workflowDefine.InputValueSetting>>();
- void InitFieldSetting(entity.workflowDefine.Workflow workflow)
- {
- if (dicFieldSettings.ContainsKey(workflow))
- {
- InitInputValues = dicFieldSettings[workflow];
- }
- else
- {
- InitInputValues = new List<entity.workflowDefine.InputValueSetting>();
- 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();
- }
- }
- }
|