|
@@ -189,7 +189,7 @@ namespace wispro.sp.web.Components
|
|
//shapeTrees.Add(endNode);
|
|
//shapeTrees.Add(endNode);
|
|
|
|
|
|
#region 将步骤对象生成形状Node并添加到列表中
|
|
#region 将步骤对象生成形状Node并添加到列表中
|
|
- if (Steps == null || Steps.Count == 0 || Steps.FirstOrDefault(s => s.Id == workflow.EndStepId) == null)
|
|
|
|
|
|
+ if (Steps == null || Steps.Count == 0 || (Steps.FirstOrDefault(s => s.Id == workflow.EndStepId) == null ))
|
|
{
|
|
{
|
|
InitShape.Childrens = new List<shapeNode>();
|
|
InitShape.Childrens = new List<shapeNode>();
|
|
InitShape.Childrens.Add(endNode);
|
|
InitShape.Childrens.Add(endNode);
|
|
@@ -206,7 +206,7 @@ namespace wispro.sp.web.Components
|
|
{
|
|
{
|
|
var temNode = new shapeNode() { NodeObject = step, InCount = 0, OutCount = 0, Type = 1,FillColor = StepShapeColor };
|
|
var temNode = new shapeNode() { NodeObject = step, InCount = 0, OutCount = 0, Type = 1,FillColor = StepShapeColor };
|
|
|
|
|
|
- if (workflow.EndStepId == step.Id)
|
|
|
|
|
|
+ if (workflow.EndStepId == step.Id && workflow.EndStepId>0)
|
|
{
|
|
{
|
|
temNode.Childrens = new List<shapeNode>();
|
|
temNode.Childrens = new List<shapeNode>();
|
|
temNode.Childrens.Add(endNode);
|
|
temNode.Childrens.Add(endNode);
|
|
@@ -263,12 +263,13 @@ namespace wispro.sp.web.Components
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- endNode.Level = endNode.Parents[0].Level + 1;
|
|
|
|
|
|
+ if (endNode.Parents != null && endNode.Parents[0].NodeObject is entity.workflowDefine.Step)
|
|
|
|
+ {
|
|
|
|
+ endNode.Level = endNode.Parents[0].Level + 1;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
GetShapeLevelNodes(LevelNodes, shapeTrees);
|
|
GetShapeLevelNodes(LevelNodes, shapeTrees);
|
|
|
|
|
|
#region 添加跨层连接的中间层的虚拟节点
|
|
#region 添加跨层连接的中间层的虚拟节点
|
|
@@ -469,7 +470,6 @@ namespace wispro.sp.web.Components
|
|
double y3 = 0.0;
|
|
double y3 = 0.0;
|
|
GetArrorEndPoint(ret, out x3, out y3);
|
|
GetArrorEndPoint(ret, out x3, out y3);
|
|
|
|
|
|
- Console.WriteLine($"x1:{ret.x1};y1:{ret.y1}\r\nx2:{ret.x2};y2:{ret.y2}\r\nx3:{x3};y3:{y3}\r\n");
|
|
|
|
ret.x2 = x3;
|
|
ret.x2 = x3;
|
|
ret.y2 = y3;
|
|
ret.y2 = y3;
|
|
|
|
|
|
@@ -509,7 +509,6 @@ namespace wispro.sp.web.Components
|
|
{
|
|
{
|
|
double k = (ret.y1 - ret.y2) / (ret.x1 - ret.x2);
|
|
double k = (ret.y1 - ret.y2) / (ret.x1 - ret.x2);
|
|
double b = ret.y2 - k * ret.x2;
|
|
double b = ret.y2 - k * ret.x2;
|
|
- Console.WriteLine($"k={k};b={b}");
|
|
|
|
|
|
|
|
double a = k * k + 1;
|
|
double a = k * k + 1;
|
|
double B = 2 * k * (b - ret.y2) - 2 * ret.x2;
|
|
double B = 2 * k * (b - ret.y2) - 2 * ret.x2;
|
|
@@ -535,7 +534,11 @@ namespace wispro.sp.web.Components
|
|
|
|
|
|
public dynamic GetEndStepLine()
|
|
public dynamic GetEndStepLine()
|
|
{
|
|
{
|
|
- var startNode = endNode.Parents[0];
|
|
|
|
|
|
+ var startNode = InitShape;
|
|
|
|
+ if (endNode.Parents != null)
|
|
|
|
+ {
|
|
|
|
+ startNode = endNode.Parents[0];
|
|
|
|
+ }
|
|
dynamic ret = new ExpandoObject();
|
|
dynamic ret = new ExpandoObject();
|
|
ret.x1 = startNode.x;
|
|
ret.x1 = startNode.x;
|
|
ret.y1 = startNode.y + startNode.height / 2;
|
|
ret.y1 = startNode.y + startNode.height / 2;
|
|
@@ -575,34 +578,25 @@ namespace wispro.sp.web.Components
|
|
|
|
|
|
protected override void OnInitialized()
|
|
protected override void OnInitialized()
|
|
{
|
|
{
|
|
- initShapeTree();
|
|
|
|
|
|
+ Refresh();
|
|
}
|
|
}
|
|
|
|
|
|
public void Refresh()
|
|
public void Refresh()
|
|
{
|
|
{
|
|
- System.Text.Json.JsonSerializer.Serialize(Actions);
|
|
|
|
|
|
+ //System.Text.Json.JsonSerializer.Serialize(Actions);
|
|
initShapeTree();
|
|
initShapeTree();
|
|
StateHasChanged();
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
|
|
- void ClickStep(entity.workflowDefine.Step step)
|
|
|
|
- {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- void ClickTrasfer(entity.workflowDefine.TrasferCondition trasferCondition)
|
|
|
|
- {
|
|
|
|
- if (OnClickTransfer.HasDelegate)
|
|
|
|
- {
|
|
|
|
- OnClickTransfer.InvokeAsync(trasferCondition);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
void InitAction()
|
|
void InitAction()
|
|
{
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #region 单击/双击事件
|
|
[Parameter]
|
|
[Parameter]
|
|
public EventCallback<entity.workflowDefine.Step> OnClickStep { get; set; }
|
|
public EventCallback<entity.workflowDefine.Step> OnClickStep { get; set; }
|
|
|
|
|
|
@@ -612,9 +606,23 @@ namespace wispro.sp.web.Components
|
|
[Parameter]
|
|
[Parameter]
|
|
public EventCallback<entity.workflowDefine.TrasferCondition> OnClickTransfer { get; set; }
|
|
public EventCallback<entity.workflowDefine.TrasferCondition> OnClickTransfer { get; set; }
|
|
|
|
|
|
|
|
+ [Parameter]
|
|
|
|
+ public EventCallback<entity.workflowDefine.Step> OnDoubleClickStep { get; set; }
|
|
|
|
+
|
|
|
|
+ [Parameter]
|
|
|
|
+ public EventCallback<entity.workflowDefine.Action> OnDoubleClickAction { get; set; }
|
|
|
|
+
|
|
|
|
+ [Parameter]
|
|
|
|
+ public EventCallback<entity.workflowDefine.TrasferCondition> OnDoubleClickTransfer { get; set; }
|
|
|
|
+
|
|
|
|
+ private shapeNode SelectedShape;
|
|
|
|
+
|
|
void ClickNode(shapeNode node)
|
|
void ClickNode(shapeNode node)
|
|
{
|
|
{
|
|
- if(node.NodeObject is entity.workflowDefine.Step)
|
|
|
|
|
|
+ SelectedShape = node;
|
|
|
|
+ StateHasChanged();
|
|
|
|
+
|
|
|
|
+ if (node.NodeObject is entity.workflowDefine.Step)
|
|
{
|
|
{
|
|
if (OnClickStep.HasDelegate)
|
|
if (OnClickStep.HasDelegate)
|
|
{
|
|
{
|
|
@@ -629,10 +637,55 @@ namespace wispro.sp.web.Components
|
|
OnClickAction.InvokeAsync((entity.workflowDefine.Action)node.NodeObject);
|
|
OnClickAction.InvokeAsync((entity.workflowDefine.Action)node.NodeObject);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void DoubleClickNode(shapeNode node)
|
|
|
|
+ {
|
|
|
|
+ SelectedShape = node;
|
|
|
|
+ StateHasChanged();
|
|
|
|
+ if (node.NodeObject is entity.workflowDefine.Step)
|
|
|
|
+ {
|
|
|
|
+ if (OnDoubleClickStep.HasDelegate)
|
|
|
|
+ {
|
|
|
|
+ OnDoubleClickStep.InvokeAsync((entity.workflowDefine.Step)node.NodeObject);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (node.NodeObject is entity.workflowDefine.Action)
|
|
|
|
+ {
|
|
|
|
+ if (OnDoubleClickAction.HasDelegate)
|
|
|
|
+ {
|
|
|
|
+ OnDoubleClickAction.InvokeAsync((entity.workflowDefine.Action)node.NodeObject);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ void ClickTrasfer(entity.workflowDefine.TrasferCondition trasferCondition)
|
|
|
|
+ {
|
|
|
|
+ SelectedShape = null;
|
|
|
|
+
|
|
|
|
+ if (OnClickTransfer.HasDelegate)
|
|
|
|
+ {
|
|
|
|
+ OnClickTransfer.InvokeAsync(trasferCondition);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void DoubleClickTrasfer(entity.workflowDefine.TrasferCondition trasferCondition)
|
|
|
|
+ {
|
|
|
|
+ SelectedShape = null;
|
|
|
|
+
|
|
|
|
+ if (OnDoubleClickTransfer.HasDelegate)
|
|
|
|
+ {
|
|
|
|
+ OnDoubleClickTransfer.InvokeAsync(trasferCondition);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
|
|
+ public string GetSvgString()
|
|
|
|
+ {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|