From 5996d6b5f794948f74c96a60defdb208a8be24b4 Mon Sep 17 00:00:00 2001 From: yubaolee Date: Fri, 16 Sep 2016 18:05:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=94=B3=E8=AF=B7=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E4=BB=A5=E9=80=89=E6=8B=A9=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/CommonApplyApp.cs | 3 ++- OpenAuth.App/ViewModel/CommonApplyVM.cs | 2 ++ OpenAuth.Domain/CommonApply.cs | 2 ++ OpenAuth.Mvc/BllScripts/commonApply.js | 17 +++++++++++++++++ OpenAuth.Mvc/BllScripts/processDetail.js | 3 ++- .../Controllers/CommonAppliesController.cs | 6 +++--- OpenAuth.Mvc/Views/CommonApplies/Detail.cshtml | 3 ++- OpenAuth.Mvc/Views/CommonApplies/Index.cshtml | 12 +++++++++--- .../Models/Mapping/CommonApplyMap.cs | 4 ++++ 9 files changed, 43 insertions(+), 9 deletions(-) diff --git a/OpenAuth.App/CommonApplyApp.cs b/OpenAuth.App/CommonApplyApp.cs index c28077f0..4b914241 100644 --- a/OpenAuth.App/CommonApplyApp.cs +++ b/OpenAuth.App/CommonApplyApp.cs @@ -31,7 +31,8 @@ namespace OpenAuth.App { UserId = model.UserId, Name = model.Name, - Comment = model.Comment + Comment = model.Comment, + WorkflowName = model.WorkflowName }); } diff --git a/OpenAuth.App/ViewModel/CommonApplyVM.cs b/OpenAuth.App/ViewModel/CommonApplyVM.cs index 965dc1fb..705fef37 100644 --- a/OpenAuth.App/ViewModel/CommonApplyVM.cs +++ b/OpenAuth.App/ViewModel/CommonApplyVM.cs @@ -52,6 +52,8 @@ namespace OpenAuth.App.ViewModel /// public System.Guid? ControllerUserId { get; set; } + public string WorkflowName { get; set; } + /// /// 可用命令 /// diff --git a/OpenAuth.Domain/CommonApply.cs b/OpenAuth.Domain/CommonApply.cs index ece75ae7..7b7e52c2 100644 --- a/OpenAuth.Domain/CommonApply.cs +++ b/OpenAuth.Domain/CommonApply.cs @@ -60,5 +60,7 @@ namespace OpenAuth.Domain /// public System.Guid? ControllerUserId { get; set; } + + public string WorkflowName { get; set; } } } \ No newline at end of file diff --git a/OpenAuth.Mvc/BllScripts/commonApply.js b/OpenAuth.Mvc/BllScripts/commonApply.js index 56e16402..72622952 100644 --- a/OpenAuth.Mvc/BllScripts/commonApply.js +++ b/OpenAuth.Mvc/BllScripts/commonApply.js @@ -72,11 +72,26 @@ function MainGrid() { MainGrid.prototype = new Grid(); var list = new MainGrid(); +var selectScheme = function(val) { + $("#WorkflowName").empty(); + $.getJSON('/workflowschemas/Load', + function (data) { + $.each(data.list, function (i, n) { + $("#WorkflowName").append(""); + }); + + if (val != undefined) { + $('#WorkflowName').val(val); + } + }); +} + //添加(编辑)对话框 var editDlg = function () { var show = function () { BJUI.dialog({ id: 'editDlg', title: '编辑对话框', target: '#editDlg' }); + $("#btnSave").on("click", function () { editDlg.save(); }); @@ -84,6 +99,7 @@ var editDlg = function () { return { add: function () { //弹出添加 show(); + selectScheme(); $.CurrentDialog.find("form")[0].reset(); //reset方法只能通过dom调用 $("#Id").val('00000000-0000-0000-0000-000000000000'); }, @@ -92,6 +108,7 @@ var editDlg = function () { $('#Id').val(ret.Id); $('#Name').val(ret.Name); $('#Comment').val(ret.Comment); + selectScheme(ret.WorkflowName); }, save: function () { //编辑-->保存 $('#editForm').isValid(function (v) { diff --git a/OpenAuth.Mvc/BllScripts/processDetail.js b/OpenAuth.Mvc/BllScripts/processDetail.js index ac8f285b..bb74e7c3 100644 --- a/OpenAuth.Mvc/BllScripts/processDetail.js +++ b/OpenAuth.Mvc/BllScripts/processDetail.js @@ -1,4 +1,4 @@ -var schemecode = 'SimpleWF'; + var wfdesigner = undefined; function wfdesignerRedraw() { @@ -9,6 +9,7 @@ function wfdesignerRedraw() { wfdesigner.destroy(); } var processid = $("#processId").val(); + var schemecode = $("#schemeCode").val(); wfdesigner = new WorkflowDesigner({ name: 'simpledesigner', diff --git a/OpenAuth.Mvc/Controllers/CommonAppliesController.cs b/OpenAuth.Mvc/Controllers/CommonAppliesController.cs index a5b544f1..216ba541 100644 --- a/OpenAuth.Mvc/Controllers/CommonAppliesController.cs +++ b/OpenAuth.Mvc/Controllers/CommonAppliesController.cs @@ -43,7 +43,7 @@ namespace OpenAuth.Mvc.Controllers { apply.UserId = AuthUtil.GetCurrentUser().User.Id; _app.AddOrUpdate(apply); - CreateWorkflowIfNotExists(apply.Id); + CreateWorkflowIfNotExists(apply.Id,apply.WorkflowName); } catch (Exception ex) @@ -110,14 +110,14 @@ namespace OpenAuth.Mvc.Controllers } - private void CreateWorkflowIfNotExists(Guid id) + private void CreateWorkflowIfNotExists(Guid id, string schemecode) { if (WorkflowInit.Runtime.IsProcessExists(id)) return; using (var sync = new WorkflowSync(WorkflowInit.Runtime, id)) { - WorkflowInit.Runtime.CreateInstance("SimpleWF", id); + WorkflowInit.Runtime.CreateInstance(schemecode, id); sync.StatrtWaitingFor(new List { ProcessStatus.Initialized, ProcessStatus.Initialized }); diff --git a/OpenAuth.Mvc/Views/CommonApplies/Detail.cshtml b/OpenAuth.Mvc/Views/CommonApplies/Detail.cshtml index 929aa764..207b3eb2 100644 --- a/OpenAuth.Mvc/Views/CommonApplies/Detail.cshtml +++ b/OpenAuth.Mvc/Views/CommonApplies/Detail.cshtml @@ -16,7 +16,8 @@
- + +

@Model.Name

diff --git a/OpenAuth.Mvc/Views/CommonApplies/Index.cshtml b/OpenAuth.Mvc/Views/CommonApplies/Index.cshtml index b04ed607..543c5612 100644 --- a/OpenAuth.Mvc/Views/CommonApplies/Index.cshtml +++ b/OpenAuth.Mvc/Views/CommonApplies/Index.cshtml @@ -29,11 +29,17 @@ + + + + + + - - - + + + diff --git a/OpenAuth.Repository/Models/Mapping/CommonApplyMap.cs b/OpenAuth.Repository/Models/Mapping/CommonApplyMap.cs index 65884027..b64f34ac 100644 --- a/OpenAuth.Repository/Models/Mapping/CommonApplyMap.cs +++ b/OpenAuth.Repository/Models/Mapping/CommonApplyMap.cs @@ -45,6 +45,10 @@ namespace OpenAuth.Repository.Models.Mapping .HasColumnName("State") .HasMaxLength(1024) .IsRequired(); + Property(t => t.WorkflowName) + .HasColumnName("WorkflowName") + .HasMaxLength(1024) + .IsRequired(); Property(t => t.StateName) .HasColumnName("StateName") .HasMaxLength(1024)