项目结构调整

This commit is contained in:
艾竹
2023-04-16 20:11:40 +08:00
parent cbfbf96033
commit 81f91f3f35
2124 changed files with 218 additions and 5516 deletions

View File

@@ -0,0 +1,275 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.DiagramDesigner.Models;
using AIStudio.Wpf.DiagramDesigner.Services;
using AIStudio.Wpf.DiagramDesigner.Serializable;
using AIStudio.Wpf.DiagramDesigner.Serializable.ViewModels;
using AIStudio.Wpf.Flowchart.Models;
namespace AIStudio.Wpf.Flowchart.ViewModels
{
public class FlowNode : DiagramItemViewModel
{
protected IUIVisualizerService visualiserService;
public FlowNode(NodeKinds kind) : this(null, kind)
{
}
public FlowNode(IDiagramViewModel root, NodeKinds kind) : base(root)
{
Kind = kind;
Text = Kind.GetDescription();
}
public FlowNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
{
}
public FlowNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
{
}
public override SelectableItemBase GetSerializableObject()
{
return new FlowNodeDesignerItem(this);
}
protected override void Init(IDiagramViewModel root, bool initNew)
{
base.Init(root, initNew);
ShowRotate = false;
ShowText = true;
IsReadOnlyText = true;
visualiserService = ApplicationServicesProvider.Instance.Provider.VisualizerService;
}
protected override void InitNew()
{
base.InitNew();
}
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
{
base.LoadDesignerItemViewModel(designerbase);
if (designerbase is FlowNodeDesignerItem designer)
{
this.StatusColor = designer.Color;
this.Kind = designer.Kind;
this.StateImage = designer.StateImage;
this.Status = designer.Status;
this.Remark = designer.Remark;
if (this is MiddleFlowNode middle)
{
middle.UserIds = designer.UserIds;
middle.RoleIds = designer.RoleIds;
middle.ActType = designer.ActType;
middle.SimulateApprove = designer.SimulateApprove;
}
}
}
public override DiagramNode ToDiagram()
{
var flowchartNode = new FlowchartNode();
flowchartNode.StatusColor = StatusColor;
flowchartNode.Kind = Kind;
if (this is MiddleFlowNode middleflowNode)
{
flowchartNode.UserIds = middleflowNode.UserIds;
flowchartNode.RoleIds = middleflowNode.RoleIds;
flowchartNode.ActType = middleflowNode.ActType;
}
return flowchartNode;
}
private string _color = "#1890ff";
[Browsable(false)]
public string StatusColor
{
get { return _color; }
set
{
SetProperty(ref _color, value);
}
}
[Browsable(false)]
public NodeKinds Kind { get; set; }
[Browsable(false)]
public string StateImage { get; set; }
#region 使
private int _status;
public int Status
{
get
{
return _status;
}
set
{
SetProperty(ref _status, value);
}
}
private string _remark;
public string Remark
{
get
{
return _remark;
}
set
{
SetProperty(ref _remark, value);
}
}
#endregion
#region 使,
public List<string> PreStepId { get; set; }
public string NextStepId { get; set; }
public Dictionary<string, string> SelectNextStep { get; set; } = new Dictionary<string, string>();
#endregion
public virtual Dictionary<string, string> PropertiesSetting
{
get
{
return new Dictionary<string, string>()
{
{ "Name","名称" },
{ "Text","文本" },
};
}
}
}
public class StartFlowNode : FlowNode
{
public StartFlowNode() : this(null)
{
}
public StartFlowNode(IDiagramViewModel root) : base(root, NodeKinds.Start)
{
}
public StartFlowNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
{
}
public StartFlowNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
{
}
}
public class EndFlowNode : FlowNode
{
public EndFlowNode() : this(null)
{
}
public EndFlowNode(IDiagramViewModel root) : base(root, NodeKinds.End)
{
}
public EndFlowNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
{
}
public EndFlowNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
{
}
}
public class DecideFlowNode : FlowNode
{
public DecideFlowNode() : this(null)
{
}
public DecideFlowNode(IDiagramViewModel root) : base(root, NodeKinds.Decide)
{
}
public DecideFlowNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
{
}
public DecideFlowNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
{
}
}
public class COBeginFlowNode : FlowNode
{
public COBeginFlowNode() : this(null)
{
}
public COBeginFlowNode(IDiagramViewModel root) : base(root, NodeKinds.COBegin)
{
}
public COBeginFlowNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
{
}
public COBeginFlowNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
{
}
}
public class COEndFlowNode : FlowNode
{
public COEndFlowNode() : this(null)
{
}
public COEndFlowNode(IDiagramViewModel root) : base(root, NodeKinds.COEnd)
{
}
public COEndFlowNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
{
}
public COEndFlowNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
{
}
}
}

View File

@@ -0,0 +1,120 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.DiagramDesigner.Controls;
using AIStudio.Wpf.DiagramDesigner.Models;
namespace AIStudio.Wpf.Flowchart.ViewModels
{
public class MiddleFlowNode : FlowNode
{
public MiddleFlowNode() : this(null)
{
}
public MiddleFlowNode(IDiagramViewModel root) : base(root, NodeKinds.Middle)
{
}
public MiddleFlowNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
{
}
public MiddleFlowNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
{
}
private List<string> _userIds = new List<string>();
[Browsable(true)]
[StyleName("UserIdsStyle")]
public List<string> UserIds
{
get
{
return _userIds;
}
set
{
SetProperty(ref _userIds, value);
}
}
private List<string> _roleIds = new List<string>();
[Browsable(true)]
[StyleName("RoleIdsStyle")]
public List<string> RoleIds
{
get
{
return _roleIds;
}
set
{
SetProperty(ref _roleIds, value);
}
}
private string _actType;
[Browsable(true)]
[StyleName("ActTypeStyle")]
public string ActType
{
get
{
return _actType;
}
set
{
SetProperty(ref _actType, value);
}
}
#region 使
public bool SimulateApprove
{
get;set;
}
#endregion
protected override void ExecuteEditCommand(object param)
{
if (IsReadOnly == true) return;
if (SimulateApprove)
{
if (Status == 1)
{
MiddleFlowNodeData data = new MiddleFlowNodeData();
if (visualiserService.ShowDialog(data) == true)
{
FlowchartService.Approve(this, data.Status, data.Remark);
}
}
else
{
MessageBox.Show("该节点不能进行审批!!!");
}
}
}
public override Dictionary<string, string> PropertiesSetting
{
get
{
return new Dictionary<string, string>()
{
{ "Name","名称" },
{ "Text","文本" },
{"UserIds", "用户" },
{"RoleIds", "角色" },
{"ActType", "or/and" }
};
}
}
}
}

View File

@@ -0,0 +1,51 @@
using AIStudio.Wpf.DiagramDesigner;
namespace AIStudio.Wpf.Flowchart.ViewModels
{
public class MiddleFlowNodeData : BindableBase
{
private string _title;
public string Title
{
get
{
return _title;
}
set
{
SetProperty(ref _title, value);
}
}
public MiddleFlowNodeData()
{
Title = "审批";
}
private int _status = 100;
public int Status
{
get
{
return _status;
}
set
{
SetProperty(ref _status, value);
}
}
private string _remark;
public string Remark
{
get
{
return _remark;
}
set
{
SetProperty(ref _remark, value);
}
}
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Media;
using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.DiagramDesigner.Helpers;
using AIStudio.Wpf.Flowchart;
using AIStudio.Wpf.Flowchart.Models;
using AIStudio.Wpf.Flowchart.ViewModels;
namespace AIStudio.Wpf.Flowchart.ViewModels
{
public class ToolBoxViewModel
{
private List<ToolBoxData> toolBoxItems = new List<ToolBoxData>();
public ToolBoxViewModel()
{
var screenScale = ScreenHelper.ResetScreenScale();
toolBoxItems.Add(new FlowchartToolBoxData(NodeKinds.Start, typeof(StartFlowNode), 80, 60, new Size(100 / screenScale, 80/ screenScale)));
toolBoxItems.Add(new FlowchartToolBoxData(NodeKinds.End, typeof(EndFlowNode), 80, 60, new Size(100 / screenScale, 80 / screenScale)));
toolBoxItems.Add(new FlowchartToolBoxData(NodeKinds.Middle, typeof(MiddleFlowNode), 80, 60, new Size(100 / screenScale, 80 / screenScale)));
toolBoxItems.Add(new FlowchartToolBoxData(NodeKinds.Decide, typeof(DecideFlowNode), 80, 60, new Size(100 / screenScale, 80 / screenScale)));
toolBoxItems.Add(new FlowchartToolBoxData(NodeKinds.COBegin, typeof(COBeginFlowNode), 80, 60, new Size(100 / screenScale, 80 / screenScale)));
toolBoxItems.Add(new FlowchartToolBoxData(NodeKinds.COEnd, typeof(COEndFlowNode), 80, 60, new Size(100 / screenScale, 80 / screenScale)));
}
public List<ToolBoxData> ToolBoxItems
{
get
{
return toolBoxItems;
}
}
}
}