mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
提交申请时,可以选择流程模板
This commit is contained in:
parent
dbdfbaab52
commit
5996d6b5f7
@ -31,7 +31,8 @@ namespace OpenAuth.App
|
||||
{
|
||||
UserId = model.UserId,
|
||||
Name = model.Name,
|
||||
Comment = model.Comment
|
||||
Comment = model.Comment,
|
||||
WorkflowName = model.WorkflowName
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,8 @@ namespace OpenAuth.App.ViewModel
|
||||
/// </summary>
|
||||
public System.Guid? ControllerUserId { get; set; }
|
||||
|
||||
public string WorkflowName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可用命令
|
||||
/// </summary>
|
||||
|
@ -60,5 +60,7 @@ namespace OpenAuth.Domain
|
||||
/// </summary>
|
||||
public System.Guid? ControllerUserId { get; set; }
|
||||
|
||||
|
||||
public string WorkflowName { get; set; }
|
||||
}
|
||||
}
|
@ -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("<option value='" + this.Code + "'>" + this.Code + "</option>");
|
||||
});
|
||||
|
||||
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) {
|
||||
|
@ -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',
|
||||
|
@ -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> { ProcessStatus.Initialized, ProcessStatus.Initialized });
|
||||
|
||||
|
@ -16,7 +16,8 @@
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<input value="@Model.Id" id="processId" class="hidden" />
|
||||
<input value="@Model.Id" id="processId" class="hidden"/>
|
||||
<input value="@Model.WorkflowName" id="schemeCode" class="hidden" />
|
||||
<h3 class="panel-title">
|
||||
@Model.Name
|
||||
</h3>
|
||||
|
@ -29,11 +29,17 @@
|
||||
<input type="text" id="Name" name="Name" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Comment" class="control-label x120">申请描述:</label>
|
||||
<textarea type="text" id="Comment" name="Comment" value=""></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Comment" class="control-label x120">申请描述:</label>
|
||||
<textarea type="text" id="Comment" name="Comment" value=""></textarea>
|
||||
</td>
|
||||
<label for="Comment" class="control-label x120">流程模板:</label>
|
||||
<select id="WorkflowName" name="WorkflowName"></select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user