routine update

This commit is contained in:
yubaolee@163.com
2018-03-23 15:00:35 +08:00
parent 2c5a114d64
commit ce9f67c396
4 changed files with 42 additions and 37 deletions

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Infrastructure;
using Newtonsoft.Json.Linq;
using OpenAuth.Repository.Domain;
namespace OpenAuth.App.Flow
@@ -19,8 +21,8 @@ namespace OpenAuth.App.Flow
{
_runtimeModel = new FlowRuntimeModel();
dynamic schemeContentJson = instance.SchemeContent.ToJson();//获取工作流模板内容的json对象;
_runtimeModel.schemeContentJson = schemeContentJson;//模板流程json对象
_runtimeModel.frmData = instance.FrmData;
_runtimeModel.schemeContentJson = schemeContentJson;//模板流程json对象
_runtimeModel.nodes = GetNodeDictionary(schemeContentJson);//节点集合
_runtimeModel.lines = GetLineDictionary(schemeContentJson);//线条集合
_runtimeModel.currentNodeId = (instance.ActivityId == "" ? _runtimeModel.startNodeId : instance.ActivityId);
@@ -51,15 +53,16 @@ namespace OpenAuth.App.Flow
private Dictionary<string, FlowNode> GetNodeDictionary(dynamic schemeContentJson)
{
Dictionary<string, FlowNode> nodeDictionary = new Dictionary<string, FlowNode>();
foreach (var item in schemeContentJson.Flow.nodes)
foreach (JObject item in schemeContentJson.nodes)
{
if (!nodeDictionary.ContainsKey(item.id.Value))
var node = item.ToObject<FlowNode>();
if (!nodeDictionary.ContainsKey(node.id))
{
nodeDictionary.Add(item.id.Value, item);
nodeDictionary.Add(node.id, node);
}
if (item.type == FlowNode.START)
if (node.type == FlowNode.START)
{
this._runtimeModel.startNodeId = item.id.Value;
this._runtimeModel.startNodeId = node.id;
}
}
return nodeDictionary;
@@ -72,16 +75,17 @@ namespace OpenAuth.App.Flow
private Dictionary<string, List<FlowLine>> GetLineDictionary(dynamic schemeContentJson)
{
Dictionary<string, List<FlowLine>> lineDictionary = new Dictionary<string, List<FlowLine>>();
foreach (var item in schemeContentJson.Flow.lines)
foreach (JObject item in schemeContentJson.lines)
{
if (!lineDictionary.ContainsKey(item.from.Value))
var line = item.ToObject<FlowLine>();
if (!lineDictionary.ContainsKey(line.from))
{
List<FlowLine> d = new List<FlowLine> { item };
lineDictionary.Add(item.from.Value, d);
List<FlowLine> d = new List<FlowLine> { line };
lineDictionary.Add(line.from, d);
}
else
{
lineDictionary[item.from.Value].Add(item);
lineDictionary[line.from].Add(line);
}
}
return lineDictionary;
@@ -94,16 +98,17 @@ namespace OpenAuth.App.Flow
private Dictionary<string, List<FlowLine>> GetToLineDictionary(dynamic schemeContentJson)
{
Dictionary<string, List<FlowLine>> lineDictionary = new Dictionary<string, List<FlowLine>>();
foreach (var item in schemeContentJson.Flow.lines)
foreach (JObject item in schemeContentJson.lines)
{
if (!lineDictionary.ContainsKey(item.to.Value))
var line = item.ToObject<FlowLine>();
if (!lineDictionary.ContainsKey(line.to))
{
List<FlowLine> d = new List<FlowLine> { item };
lineDictionary.Add(item.to.Value, d);
List<FlowLine> d = new List<FlowLine> { line };
lineDictionary.Add(line.to, d);
}
else
{
lineDictionary[item.to.Value].Add(item);
lineDictionary[line.to].Add(line);
}
}
return lineDictionary;

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Infrastructure;
using Newtonsoft.Json.Linq;
using OpenAuth.App.Flow;
using OpenAuth.App.Request;
using OpenAuth.App.Response;
@@ -98,21 +99,24 @@ namespace OpenAuth.App
/// <summary>
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʵ<EFBFBD><CAB5>
/// </summary>
/// <param name="processId"><3E><><EFBFBD><EFBFBD>GUID</param>
/// <param name="schemeInfoId">ģ<><C4A3><EFBFBD><EFBFBD>ϢID</param>
/// <param name="wfLevel"></param>
/// <param name="code"><3E><><EFBFBD>̱<EFBFBD><CCB1><EFBFBD></param>
/// <param name="customName"><3E>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
/// <param name="description"><3E><>ע</param>
/// <param name="frmData"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ</param>
/// <returns></returns>
public bool CreateInstance(FlowInstance flowInstance)
public bool CreateInstance(JObject obj)
{
var flowInstance = obj.ToObject<FlowInstance>();
//<2F><>ȡ<EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
var frmdata = new JObject();
foreach (var property in obj.Properties().Where(U => U.Name.Contains("data_")))
{
frmdata[property.Name] = property.Value;
}
flowInstance.FrmData = JsonHelper.Instance.Serialize(frmdata);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
var wfruntime = new FlowRuntime(flowInstance);
var user = AuthUtil.GetCurrentUser();
#region ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD>ıǰ<EFBFBD>ڵ<EFBFBD>״̬
flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
flowInstance.ActivityType = wfruntime.GetNextNodeType();//-1<>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>,0<><30>ǩ<EFBFBD><C7A9>ʼ,1<><31>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>,2һ<32><D2BB><EFBFBD>ڵ<EFBFBD>,4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;

View File

@@ -1,7 +1,9 @@
using System;
using System.Linq;
using System.Web.Http;
using System.Web.Mvc;
using Infrastructure;
using Newtonsoft.Json.Linq;
using OpenAuth.App;
using OpenAuth.App.Request;
using OpenAuth.Mvc.Models;
@@ -43,7 +45,8 @@ namespace OpenAuth.Mvc.Controllers
//添加或修改
[System.Web.Mvc.HttpPost]
public string Add(FlowInstance obj)
[ValidateInput(false)]
public string Add(JObject obj)
{
try
{

View File

@@ -7,7 +7,6 @@
$ = layui.jquery;
var table = layui.table;
var openauth = layui.openauth;
var frmdata = {};
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var id = $.getUrlParam("id"); //ID
var update = (id !=null && id != '');
@@ -97,12 +96,6 @@
$("#FrmContentData").val(data.Result.ContentData);
$("#FrmContentParse").val(data.Result.ContentParse);
$("#frmPreview").html(data.Result.Content);
frmdata = $.arrayToObj(JSON.parse(data.Result.ContentData));
$.extend(frmdata, vm.data);
vm = new Vue({
el: "#formEdit",
data:frmdata
});
}
});
@@ -163,9 +156,9 @@
$.extend(data.field,
{
SchemeContent: JSON.stringify(content),
FrmData: JSON.stringify(frmdata)
SchemeContent: JSON.stringify(content)
});
$.post(url,
data.field,
function (result) {