后端:审批流:增加匹配功能
后端:审批流:增加命中表 后端:审批流:增加表单记录 后端:审批流:增加流程记录 前端:审批流:增加表单对应实体名
This commit is contained in:
parent
ca8eb7ee63
commit
6631768d7f
@ -0,0 +1,53 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using Admin.NET.Core;
|
||||||
|
|
||||||
|
namespace Admin.NET.Plugin.ApprovalFlow;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 审批流流程记录
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("ApprovalFlowRecord", "审批流流程记录")]
|
||||||
|
public class ApprovalFlowRecord : EntityBaseData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 表单名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormName", ColumnDescription = "表单名称", Length = 255)]
|
||||||
|
public string? FormName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单状态
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormStatus", ColumnDescription = "表单状态", Length = 32)]
|
||||||
|
public string? FormStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单触发
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormJson", ColumnDescription = "表单触发", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||||
|
public string? FormJson { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单结果
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormResult", ColumnDescription = "表单结果", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||||
|
public string? FormResult { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程结构
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FlowJson", ColumnDescription = "流程结构", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||||
|
public string? FlowJson { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程结果
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FlowResult", ColumnDescription = "流程结果", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||||
|
public string? FlowResult { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using Admin.NET.Core;
|
||||||
|
|
||||||
|
namespace Admin.NET.Plugin.ApprovalFlow;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 审批流表单
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("ApprovalForm", "审批流表单")]
|
||||||
|
public class ApprovalForm : EntityBaseData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 编号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "Code", ColumnDescription = "编号", Length = 32)]
|
||||||
|
public string? Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "Name", ColumnDescription = "名称", Length = 32)]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormName", ColumnDescription = "表单名称", Length = 32)]
|
||||||
|
public string? FormName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单属性
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormType", ColumnDescription = "表单属性", Length = 32)]
|
||||||
|
public string? FormType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单状态
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormStatus", ColumnDescription = "表单状态")]
|
||||||
|
public int? FormStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单结果
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormResult", ColumnDescription = "表单结果", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||||
|
public string? FormResult { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "Status", ColumnDescription = "状态")]
|
||||||
|
public int? Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 255)]
|
||||||
|
public string? Remark { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using Admin.NET.Core;
|
||||||
|
|
||||||
|
namespace Admin.NET.Plugin.ApprovalFlow;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 审批流表单记录
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("ApprovalFormRecord", "审批流表单记录")]
|
||||||
|
public class ApprovalFormRecord : EntityBaseData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 流程Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FlowId", ColumnDescription = "流程Id")]
|
||||||
|
public long? FlowId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormName", ColumnDescription = "表单名称", Length = 32)]
|
||||||
|
public string? FormName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单类型
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormType", ColumnDescription = "表单类型", Length = 32)]
|
||||||
|
public string? FormType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单状态
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormStatus", ColumnDescription = "表单状态", Length = 11)]
|
||||||
|
public string? FormStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改前
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormBefore", ColumnDescription = "修改前", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||||
|
public string? FormBefore { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改后
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormAfter", ColumnDescription = "修改后", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||||
|
public string? FormAfter { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表单结果
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "FormResult", ColumnDescription = "表单结果", ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||||
|
public string? FormResult { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -15,5 +15,6 @@ global using Microsoft.Extensions.DependencyInjection;
|
|||||||
global using SqlSugar;
|
global using SqlSugar;
|
||||||
global using System;
|
global using System;
|
||||||
global using System.Collections.Generic;
|
global using System.Collections.Generic;
|
||||||
|
global using System.ComponentModel;
|
||||||
global using System.ComponentModel.DataAnnotations;
|
global using System.ComponentModel.DataAnnotations;
|
||||||
global using System.Threading.Tasks;
|
global using System.Threading.Tasks;
|
||||||
@ -4,6 +4,7 @@
|
|||||||
//
|
//
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using Admin.NET.Plugin.ApprovalFlow.Service;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ public class ApprovalFlowMiddleware
|
|||||||
|
|
||||||
public async Task Invoke(HttpContext context)
|
public async Task Invoke(HttpContext context)
|
||||||
{
|
{
|
||||||
//await App.GetRequiredService<SysApprovalService>().MatchApproval(context);
|
await App.GetRequiredService<SysApprovalService>().MatchApproval(context);
|
||||||
|
|
||||||
await _next.Invoke(context);
|
await _next.Invoke(context);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
//
|
//
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using System.Text.Json;
|
||||||
|
using Admin.NET.Plugin.ApprovalFlow.Const;
|
||||||
|
using Admin.NET.Plugin.ApprovalFlow.Entity;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
namespace Admin.NET.Plugin.ApprovalFlow.Service;
|
namespace Admin.NET.Plugin.ApprovalFlow.Service;
|
||||||
@ -122,27 +125,32 @@ public class ApprovalFlowService : IDynamicApiController, ITransient
|
|||||||
return prefix + DateTime.Now.ToString("yyMMdd") + string.Format("{0:d2}", count + 1);
|
return prefix + DateTime.Now.ToString("yyMMdd") + string.Format("{0:d2}", count + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[HttpGet]
|
||||||
/// 匹配审批流程
|
[ApiDescriptionSettings(Name = "FlowList")]
|
||||||
/// </summary>
|
[DisplayName("获取审批流结构")]
|
||||||
/// <param name="context"></param>
|
public async Task<dynamic> FlowList([FromQuery] string code)
|
||||||
/// <returns></returns>
|
|
||||||
[NonAction]
|
|
||||||
public async Task MatchApproval(HttpContext context)
|
|
||||||
{
|
{
|
||||||
var request = context.Request;
|
var result = await _approvalFlowRep.AsQueryable().Where(u => u.Code == code).Select<ApprovalFlowOutput>().FirstAsync();
|
||||||
var response = context.Response;
|
var FlowJson = result.FlowJson != null ? JsonSerializer.Deserialize<ApprovalFlowItem>(result.FlowJson) : new ApprovalFlowItem();
|
||||||
|
var FormJson = result.FormJson != null ? JsonSerializer.Deserialize<ApprovalFormItem>(result.FormJson) : new ApprovalFormItem();
|
||||||
|
return new {
|
||||||
|
FlowJson,
|
||||||
|
FormJson
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var path = request.Path.ToString().Split("/");
|
[HttpGet]
|
||||||
|
[ApiDescriptionSettings(Name = "FormRoutes")]
|
||||||
var method = request.Method;
|
[DisplayName("获取审批流规则")]
|
||||||
var qs = request.QueryString;
|
public async Task<List<string>> FormRoutes()
|
||||||
var h = request.Headers;
|
{
|
||||||
var b = request.Body;
|
var results = await _approvalFlowRep.AsQueryable().Select<ApprovalFlowOutput>().ToListAsync();
|
||||||
|
var list = new List<string>();
|
||||||
var requestHeaders = request.Headers;
|
foreach (var item in results)
|
||||||
var responseHeaders = response.Headers;
|
{
|
||||||
|
var FormJson = item.FormJson != null ? JsonSerializer.Deserialize<ApprovalFormItem>(item.FormJson) : new ApprovalFormItem();
|
||||||
await Task.CompletedTask;
|
if (item.FormJson != null) list.Add(FormJson.Route);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Admin.NET.Plugin.ApprovalFlow.Service;
|
||||||
|
|
||||||
|
public class ApprovalFlowItem
|
||||||
|
{
|
||||||
|
[JsonPropertyName("nodes")]
|
||||||
|
public List<ApprovalFlowNodeItem> Nodes { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("edges")]
|
||||||
|
public List<ApprovalFlowEdgeItem> Edges { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ApprovalFlowNodeItem
|
||||||
|
{
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("type")]
|
||||||
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("x")]
|
||||||
|
public float X { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("y")]
|
||||||
|
public float Y { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("properties")]
|
||||||
|
public FlowProperties Properties { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("text")]
|
||||||
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
public FlowTextItem Text { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ApprovalFlowEdgeItem
|
||||||
|
{
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("type")]
|
||||||
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("sourceNodeId")]
|
||||||
|
public string SourceNodeId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("targetNodeId")]
|
||||||
|
public string TargetNodeId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("startPoint")]
|
||||||
|
public FlowEdgePointItem StartPoint { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("endPoint")]
|
||||||
|
public FlowEdgePointItem EndPoint { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("properties")]
|
||||||
|
public FlowProperties Properties { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("text")]
|
||||||
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
|
public FlowTextItem Text { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("pointsList")]
|
||||||
|
public List<FlowEdgePointItem> PointsList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FlowProperties
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FlowTextItem
|
||||||
|
{
|
||||||
|
[JsonPropertyName("x")]
|
||||||
|
public float X { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("y")]
|
||||||
|
public float Y { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("value")]
|
||||||
|
public string Value { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FlowEdgePointItem
|
||||||
|
{
|
||||||
|
[JsonPropertyName("x")]
|
||||||
|
public float X { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("y")]
|
||||||
|
public float Y { get; set; }
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Admin.NET.Plugin.ApprovalFlow.Service;
|
||||||
|
|
||||||
|
public class ApprovalFormItem
|
||||||
|
{
|
||||||
|
[JsonPropertyName("configId")]
|
||||||
|
public string ConfigId { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("tableName")]
|
||||||
|
public string TableName { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("entityName")]
|
||||||
|
public string EntityName { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("typeName")]
|
||||||
|
public string TypeName { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("route")]
|
||||||
|
public string Route => EntityName[..1].ToLower() + EntityName[1..] + "/" + TypeName;
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
||||||
|
namespace Admin.NET.Plugin.ApprovalFlow.Service;
|
||||||
|
|
||||||
|
public class SysApprovalService : ITransient
|
||||||
|
{
|
||||||
|
private readonly SqlSugarRepository<ApprovalFlowRecord> _approvalFlowRep;
|
||||||
|
private readonly SqlSugarRepository<ApprovalFormRecord> _approvalFormRep;
|
||||||
|
|
||||||
|
public SysApprovalService(SqlSugarRepository<ApprovalFlowRecord> approvalFlowRep, SqlSugarRepository<ApprovalFormRecord> approvalFormRep)
|
||||||
|
{
|
||||||
|
_approvalFlowRep = approvalFlowRep;
|
||||||
|
_approvalFormRep = approvalFormRep;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 匹配审批流程
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[NonAction]
|
||||||
|
public async Task MatchApproval(HttpContext context)
|
||||||
|
{
|
||||||
|
var request = context.Request;
|
||||||
|
var response = context.Response;
|
||||||
|
|
||||||
|
var path = request.Path.ToString().Split("/");
|
||||||
|
|
||||||
|
var method = request.Method;
|
||||||
|
var qs = request.QueryString;
|
||||||
|
var h = request.Headers;
|
||||||
|
var b = request.Body;
|
||||||
|
|
||||||
|
var requestHeaders = request.Headers;
|
||||||
|
var responseHeaders = response.Headers;
|
||||||
|
|
||||||
|
var serviceName = path[1];
|
||||||
|
if (serviceName.StartsWith("api"))
|
||||||
|
{
|
||||||
|
if (path.Length > 3)
|
||||||
|
{
|
||||||
|
var funcName = path[2];
|
||||||
|
var typeName = path[3];
|
||||||
|
|
||||||
|
var list = await App.GetService<ApprovalFlowService>().FormRoutes();
|
||||||
|
if (list.Any(u => u.Contains(funcName) && u.Contains(typeName)))
|
||||||
|
{
|
||||||
|
var approvalFlow = new ApprovalFlowRecord
|
||||||
|
{
|
||||||
|
FormName = funcName,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 判断是否需要审批
|
||||||
|
await _approvalFlowRep.InsertAsync(approvalFlow);
|
||||||
|
|
||||||
|
var approvalForm = new ApprovalFormRecord
|
||||||
|
{
|
||||||
|
FlowId = approvalFlow.Id,
|
||||||
|
FormName = funcName,
|
||||||
|
FormType = typeName,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 判断是否需要审批
|
||||||
|
await _approvalFormRep.InsertAsync(approvalForm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,7 +18,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="表定位器" prop="tableName" :rules="[{ required: true, message: '表定位器不能为空', trigger: 'blur' }]">
|
<el-form-item label="表定位器" prop="tableName" :rules="[{ required: true, message: '表定位器不能为空', trigger: 'blur' }]">
|
||||||
<el-select v-model="state.ruleForm.tableName" value-key="value" filterable clearable class="w100">
|
<el-select v-model="state.ruleForm.tableName" @change="tableChanged" value-key="value" filterable clearable class="w100">
|
||||||
<el-option v-for="item in state.tableData" :key="item.name" :label="item.name + ' [ ' + item.description + ' ]'" :value="item.name" />
|
<el-option v-for="item in state.tableData" :key="item.name" :label="item.name + ' [ ' + item.description + ' ]'" :value="item.name" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -50,7 +50,7 @@ import { getAPI } from '/@/utils/axios-utils';
|
|||||||
import { ApprovalFlowApi } from '/@/api-services/_approvalFlow/api';
|
import { ApprovalFlowApi } from '/@/api-services/_approvalFlow/api';
|
||||||
import { ApprovalFlowOutput, UpdateApprovalFlowInput } from '/@/api-services/_approvalFlow/models';
|
import { ApprovalFlowOutput, UpdateApprovalFlowInput } from '/@/api-services/_approvalFlow/models';
|
||||||
import { SysDatabaseApi, SysCodeGenApi } from '/@/api-services/api';
|
import { SysDatabaseApi, SysCodeGenApi } from '/@/api-services/api';
|
||||||
import { DbTableInfo } from '/@/api-services/models';
|
import { DatabaseOutput, TableOutput } from '/@/api-services/models';
|
||||||
|
|
||||||
var props = defineProps({
|
var props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
@ -67,8 +67,9 @@ const state = reactive({
|
|||||||
isShowDialog: false,
|
isShowDialog: false,
|
||||||
ruleSource: {} as UpdateApprovalFlowInput,
|
ruleSource: {} as UpdateApprovalFlowInput,
|
||||||
ruleForm: {} as any,
|
ruleForm: {} as any,
|
||||||
dbData: [] as any,
|
dbData: [] as Array<DatabaseOutput>,
|
||||||
tableData: [] as Array<DbTableInfo>,
|
tableData: [] as Array<TableOutput>,
|
||||||
|
tableName: "",
|
||||||
typeData: [
|
typeData: [
|
||||||
{
|
{
|
||||||
name: 'Add',
|
name: 'Add',
|
||||||
@ -131,11 +132,16 @@ const submit = async () => {
|
|||||||
// db改变
|
// db改变
|
||||||
const dbChanged = async () => {
|
const dbChanged = async () => {
|
||||||
if (state.ruleForm.configId === '') return;
|
if (state.ruleForm.configId === '') return;
|
||||||
|
|
||||||
var res = await getAPI(SysDatabaseApi).apiSysDatabaseTableListConfigIdGet(state.ruleForm.configId);
|
var res = await getAPI(SysDatabaseApi).apiSysDatabaseTableListConfigIdGet(state.ruleForm.configId);
|
||||||
state.tableData = res.data.result ?? [];
|
state.tableData = res.data.result ?? [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// table改变
|
||||||
|
const tableChanged = (tableName: any) => {
|
||||||
|
var table = state.tableData.find((x) => x.tableName === tableName);
|
||||||
|
state.ruleForm.entityName = table?.entityName ?? '';
|
||||||
|
};
|
||||||
|
|
||||||
defineExpose({ openDialog });
|
defineExpose({ openDialog });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user