Merge pull request '🍒 feat(流水号): 增加流水号插槽、类型提供者接口,方便业务层扩展' (#419) from jasondom/Admin.NET.Pro:v2-1 into v2
Reviewed-on: https://code.adminnet.top/Admin.NET/Admin.NET.Pro/pulls/419
This commit is contained in:
commit
85bbebf7c3
@ -22,7 +22,7 @@ public class TestCodeGenDemo : EntityBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 流水号
|
/// 流水号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BindSerial(SerialTypeEnum.Other)]
|
[BindSerial(nameof(SerialTypeProvider.Test))]
|
||||||
[SugarColumn(ColumnDescription = "流水号", Length = 128)]
|
[SugarColumn(ColumnDescription = "流水号", Length = 128)]
|
||||||
public string? SeqNo { get; set; }
|
public string? SeqNo { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
namespace Admin.NET.Application;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流水号种子数据
|
||||||
|
/// </summary>
|
||||||
|
[SeedData(500)]
|
||||||
|
[IncreSeed]
|
||||||
|
public class SysSerialSeedData : ISqlSugarEntitySeedData<SysSerial>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 种子数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<SysSerial> HasData()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
[
|
||||||
|
new(){ Id=1300000000101, Type=SerialTypeProvider.Test, ResetInterval=ResetIntervalEnum.Day, Formater="T{yyyy}{MM}{SEQ}", Seq=0, Min=1, Max=9999999, Expy=DateTime.Parse("2025-01-01 12:00:00"), TenantId=SqlSugarConst.DefaultTenantId, OrderNo=100 },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
21
Admin.NET/Admin.NET.Application/Serial/SerialSlotProvider.cs
Normal file
21
Admin.NET/Admin.NET.Application/Serial/SerialSlotProvider.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
namespace Admin.NET.Application;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扩展流水号插槽
|
||||||
|
/// </summary>
|
||||||
|
public class SerialSlotProvider : ISerialSlotProvider
|
||||||
|
{
|
||||||
|
public Dictionary<string, Func<long, long, DateTime, UserManager, string>> GetSlotMap()
|
||||||
|
{
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
{ "{Account}", (seq, max, nowDate, userManager) => userManager.Account[..2] }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Admin.NET/Admin.NET.Application/Serial/SerialTypeProvider.cs
Normal file
19
Admin.NET/Admin.NET.Application/Serial/SerialTypeProvider.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
namespace Admin.NET.Application;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 业务流水号类型常量
|
||||||
|
/// </summary>
|
||||||
|
public class SerialTypeProvider : ISerialTypeProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 测试流水号
|
||||||
|
/// </summary>
|
||||||
|
[Description("测试")]
|
||||||
|
public const string Test = nameof(Test);
|
||||||
|
}
|
||||||
@ -10,12 +10,12 @@ namespace Admin.NET.Core;
|
|||||||
/// 绑定序列号特性类
|
/// 绑定序列号特性类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
|
||||||
public class BindSerialAttribute(SerialTypeEnum type, bool isGlobal = false) : Attribute
|
public class BindSerialAttribute(string type, bool isGlobal = false) : Attribute
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序列号类型
|
/// 序列号类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SerialTypeEnum Type { get; set; } = type;
|
public string Type { get; set; } = type;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否全局
|
/// 是否全局
|
||||||
|
|||||||
@ -125,4 +125,14 @@ public class CacheConst
|
|||||||
/// 流水号分布式锁缓存
|
/// 流水号分布式锁缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string KeySerialLock = "sys_serial_lock";
|
public const string KeySerialLock = "sys_serial_lock";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流水号插槽缓存
|
||||||
|
/// </summary>
|
||||||
|
public const string KeySysSerialSlot = "sys_serial_slot";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流水号类型
|
||||||
|
/// </summary>
|
||||||
|
public const string KeySysSerialType = "sys_serial_type";
|
||||||
}
|
}
|
||||||
@ -32,9 +32,10 @@ public class SysSerial : EntityTenantId
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用分类
|
/// 使用分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "使用分类")]
|
[SugarColumn(ColumnDescription = "使用分类", Length = 32)]
|
||||||
|
[MaxLength(32)]
|
||||||
[Required]
|
[Required]
|
||||||
public virtual SerialTypeEnum Type { get; set; }
|
public virtual string Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置间隔
|
/// 重置间隔
|
||||||
|
|||||||
@ -905,5 +905,17 @@ public enum ErrorCodeEnum
|
|||||||
/// 无效的流水号重置类型
|
/// 无效的流水号重置类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ErrorCodeItemMetadata("无效的流水号重置类型")]
|
[ErrorCodeItemMetadata("无效的流水号重置类型")]
|
||||||
S0006
|
S0006,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 无效的流水号类型
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("无效的流水号类型:{0}")]
|
||||||
|
S0007,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 存在相同流水号类型,请检查所有实现了ISerialTypeProvider接口的类字段
|
||||||
|
/// </summary>
|
||||||
|
[ErrorCodeItemMetadata("存在相同流水号类型,请检查所有实现了ISerialTypeProvider接口的类字段")]
|
||||||
|
S0008,
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ public class SerialBaseInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用分类
|
/// 使用分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual SerialTypeEnum? Type { get; set; }
|
public virtual string Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置间隔
|
/// 重置间隔
|
||||||
@ -80,8 +80,7 @@ public class PageSerialInput : BasePageInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用分类
|
/// 使用分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Dict(nameof(SerialTypeEnum))]
|
public string Type { get; set; }
|
||||||
public SerialTypeEnum? Type { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 状态
|
/// 状态
|
||||||
@ -99,8 +98,7 @@ public class AddSerialInput : SerialBaseInput
|
|||||||
/// 使用分类
|
/// 使用分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required(ErrorMessage = "使用分类不能为空")]
|
[Required(ErrorMessage = "使用分类不能为空")]
|
||||||
[Enum]
|
public override string Type { get; set; }
|
||||||
public override SerialTypeEnum? Type { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置间隔
|
/// 重置间隔
|
||||||
@ -160,9 +158,8 @@ public class UpdateSerialInput : SerialBaseInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用分类
|
/// 使用分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Enum]
|
|
||||||
[Required(ErrorMessage = "使用分类不能为空")]
|
[Required(ErrorMessage = "使用分类不能为空")]
|
||||||
public override SerialTypeEnum? Type { get; set; }
|
public override string Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置间隔
|
/// 重置间隔
|
||||||
@ -238,6 +235,5 @@ public class GetNextSeqInput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用分类
|
/// 使用分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Dict(nameof(SerialTypeEnum))]
|
public virtual string Type { get; set; }
|
||||||
public virtual SerialTypeEnum? Type { get; set; }
|
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ public class PageSerialOutput
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用分类
|
/// 使用分类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SerialTypeEnum? Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置间隔
|
/// 重置间隔
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
|
//
|
||||||
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
|
//
|
||||||
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
namespace Admin.NET.Core.Service;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流水号插槽提供者接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ISerialSlotProvider
|
||||||
|
{
|
||||||
|
public Dictionary<string, Func<long, long, DateTime, UserManager, string>> GetSlotMap();
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||||
//
|
//
|
||||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||||
//
|
//
|
||||||
@ -7,14 +7,8 @@
|
|||||||
namespace Admin.NET.Core;
|
namespace Admin.NET.Core;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 系统流水号类型枚举
|
/// 流水号类型提供者接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("系统流水号类型枚举")]
|
public interface ISerialTypeProvider
|
||||||
public enum SerialTypeEnum
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 其他
|
|
||||||
/// </summary>
|
|
||||||
[Description("其他")]
|
|
||||||
Other = 999,
|
|
||||||
}
|
}
|
||||||
@ -4,6 +4,8 @@
|
|||||||
//
|
//
|
||||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
|
||||||
namespace Admin.NET.Core.Service;
|
namespace Admin.NET.Core.Service;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -18,6 +20,11 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
private readonly UserManager _userManager;
|
private readonly UserManager _userManager;
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 因为缓存的是代理,无法序列化,所以只能用字典缓存
|
||||||
|
/// </summary>
|
||||||
|
private readonly ConcurrentDictionary<string, Dictionary<string, Func<long, long, DateTime, UserManager, string>>> _slotTempMap = new();
|
||||||
|
|
||||||
public SysSerialService(SqlSugarRepository<SysSerial> sysSerialRep,
|
public SysSerialService(SqlSugarRepository<SysSerial> sysSerialRep,
|
||||||
SysCacheService sysCacheService, ISqlSugarClient db,
|
SysCacheService sysCacheService, ISqlSugarClient db,
|
||||||
UserManager userManager)
|
UserManager userManager)
|
||||||
@ -67,6 +74,8 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
[ApiDescriptionSettings(Name = "Add"), HttpPost]
|
[ApiDescriptionSettings(Name = "Add"), HttpPost]
|
||||||
public async Task<long> Add(AddSerialInput input)
|
public async Task<long> Add(AddSerialInput input)
|
||||||
{
|
{
|
||||||
|
var typeList = GetTypeList();
|
||||||
|
if (typeList.All(u => u.Value != input.Type)) throw Oops.Oh(ErrorCodeEnum.S0007, input.Type);
|
||||||
if (await _sysSerialRep.IsAnyAsync(u => u.Type == input.Type && u.TenantId == _userManager.TenantId)) throw Oops.Oh(ErrorCodeEnum.D1006);
|
if (await _sysSerialRep.IsAnyAsync(u => u.Type == input.Type && u.TenantId == _userManager.TenantId)) throw Oops.Oh(ErrorCodeEnum.D1006);
|
||||||
|
|
||||||
var entity = input.Adapt<SysSerial>();
|
var entity = input.Adapt<SysSerial>();
|
||||||
@ -84,6 +93,8 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
[ApiDescriptionSettings(Name = "Update"), HttpPost]
|
[ApiDescriptionSettings(Name = "Update"), HttpPost]
|
||||||
public async Task Update(UpdateSerialInput input)
|
public async Task Update(UpdateSerialInput input)
|
||||||
{
|
{
|
||||||
|
var typeList = GetTypeList();
|
||||||
|
if (typeList.All(u => u.Value != input.Type)) throw Oops.Oh(ErrorCodeEnum.S0007, input.Type);
|
||||||
var seq = await _sysSerialRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
var seq = await _sysSerialRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
||||||
if (await _sysSerialRep.IsAnyAsync(u => u.Type == input.Type && u.TenantId == _userManager.TenantId && input.Id != seq.Id)) throw Oops.Oh(ErrorCodeEnum.D1006);
|
if (await _sysSerialRep.IsAnyAsync(u => u.Type == input.Type && u.TenantId == _userManager.TenantId && input.Id != seq.Id)) throw Oops.Oh(ErrorCodeEnum.D1006);
|
||||||
|
|
||||||
@ -116,6 +127,27 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
await _sysSerialRep.AsUpdateable().SetColumns(u => u.Status, input.Status).Where(u => u.Id == input.Id).ExecuteCommandAsync();
|
await _sysSerialRep.AsUpdateable().SetColumns(u => u.Status, input.Status).Where(u => u.Id == input.Id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取流水号类型
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[DisplayName("获取流水号类型"), HttpGet]
|
||||||
|
public List<SelectListItem> GetTypeList()
|
||||||
|
{
|
||||||
|
var typeList = _sysCacheService.Get<List<SelectListItem>>(CacheConst.KeySysSerialType);
|
||||||
|
if (typeList != null) return typeList;
|
||||||
|
|
||||||
|
typeList = App.EffectiveTypes
|
||||||
|
.Where(u => !u.IsInterface && u.IsClass && u.HasImplementedRawGeneric(typeof(ISerialTypeProvider)))
|
||||||
|
.SelectMany(u => u.GetFields())
|
||||||
|
.Select(u => new SelectListItem(u.GetCustomAttribute<DescriptionAttribute>()?.Description ?? u.Name, u.Name))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (typeList.GroupBy(u => u.Value).Any(u => u.Count() > 1)) throw Oops.Oh(ErrorCodeEnum.S0008);
|
||||||
|
_sysCacheService.Set(CacheConst.KeySysSerialType, typeList);
|
||||||
|
return typeList;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取流水号
|
/// 获取流水号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -169,7 +201,7 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
/// <param name="isTran">是否开启事务</param>
|
/// <param name="isTran">是否开启事务</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[NonAction]
|
[NonAction]
|
||||||
public async Task<string> NextSeqNo(SerialTypeEnum? type, bool isGlobal = false, bool isTran = true)
|
public async Task<string> NextSeqNo(string type, bool isGlobal = false, bool isTran = true)
|
||||||
{
|
{
|
||||||
// 获取租户Id, 以及分布式锁缓存键名
|
// 获取租户Id, 以及分布式锁缓存键名
|
||||||
long? tenantId = isGlobal ? SqlSugarConst.DefaultTenantId : _userManager.TenantId;
|
long? tenantId = isGlobal ? SqlSugarConst.DefaultTenantId : _userManager.TenantId;
|
||||||
@ -279,18 +311,45 @@ public class SysSerialService : IDynamicApiController, ITransient
|
|||||||
[NonAction]
|
[NonAction]
|
||||||
private Dictionary<string, Func<string>> GetSlotMap(long seq, long max, DateTime nowDate)
|
private Dictionary<string, Func<string>> GetSlotMap(long seq, long max, DateTime nowDate)
|
||||||
{
|
{
|
||||||
// 使用 "插槽名 - 代理方法" 映射表,这样匹配到的插槽才渲染,减少不必要的运算
|
// 获取插槽逻辑模板
|
||||||
return new Dictionary<string, Func<string>>
|
var slotLogic = _slotTempMap.GetOrAdd(CacheConst.KeySysSerialSlot, _ =>
|
||||||
{
|
{
|
||||||
["{yyyy}"] = () => nowDate.Year.ToString(),
|
// 默认插槽逻辑
|
||||||
["{yy}"] = () => nowDate.Year.ToString()[2..],
|
var logicMap = new Dictionary<string, Func<long, long, DateTime, UserManager, string>>
|
||||||
["{MM}"] = () => nowDate.Month.ToString("D2"),
|
{
|
||||||
["{dd}"] = () => nowDate.Day.ToString("D2"),
|
// 序号格式化
|
||||||
["{HH}"] = () => nowDate.Hour.ToString("D2"),
|
["{SEQ}"] = (s, m, _, _) => s.ToString($"D{m.ToString().Length}"),
|
||||||
["{mm}"] = () => nowDate.Minute.ToString("D2"),
|
// 时间相关(依赖 nowDate)
|
||||||
["{ss}"] = () => nowDate.Second.ToString("D2"),
|
["{yyyy}"] = (_, _, d, _) => d.Year.ToString(),
|
||||||
["{SEQ}"] = () => seq.ToString("D" + max.ToString().Length),
|
["{yy}"] = (_, _, d, _) => d.Year.ToString().Substring(2),
|
||||||
["{TenantId}"] = () => _userManager.TenantId.ToString(),
|
["{MM}"] = (_, _, d, _) => d.Month.ToString("D2"),
|
||||||
};
|
["{dd}"] = (_, _, d, _) => d.Day.ToString("D2"),
|
||||||
|
["{HH}"] = (_, _, d, _) => d.Hour.ToString("D2"),
|
||||||
|
["{mm}"] = (_, _, d, _) => d.Minute.ToString("D2"),
|
||||||
|
["{ss}"] = (_, _, d, _) => d.Second.ToString("D2"),
|
||||||
|
["{TenantId}"] = (_, _, _, u) => u?.TenantId.ToString(),
|
||||||
|
["{UserId}"] = (_, _, _, u) => u?.UserId.ToString(),
|
||||||
|
["{OrgId}"] = (_, _, _, u) => u?.OrgId.ToString(),
|
||||||
|
["{OrgType}"] = (_, _, _, u) => u?.OrgType,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 扩展插槽提供者
|
||||||
|
var providers = App.EffectiveTypes
|
||||||
|
.Where(u => !u.IsInterface && u.IsClass && u.HasImplementedRawGeneric(typeof(ISerialSlotProvider)))
|
||||||
|
.Select(u => (ISerialSlotProvider)Activator.CreateInstance(u))
|
||||||
|
.ToList();
|
||||||
|
foreach (var provider in providers)
|
||||||
|
{
|
||||||
|
var providerLogic = provider.GetSlotMap();
|
||||||
|
foreach (var kv in providerLogic) logicMap[kv.Key] = kv.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return logicMap;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 将逻辑模板绑定到当前参数,生成最终的 Func<string>
|
||||||
|
var result = new Dictionary<string, Func<string>>();
|
||||||
|
foreach (var kv in slotLogic) result.TryAdd(kv.Key, () => kv.Value(seq, max, nowDate, _userManager));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,6 +19,7 @@ import { Configuration } from '../configuration';
|
|||||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
|
||||||
import { AddSerialInput } from '../models';
|
import { AddSerialInput } from '../models';
|
||||||
import { AdminNETResultInt64 } from '../models';
|
import { AdminNETResultInt64 } from '../models';
|
||||||
|
import { AdminNETResultListSelectListItem } from '../models';
|
||||||
import { AdminNETResultListString } from '../models';
|
import { AdminNETResultListString } from '../models';
|
||||||
import { AdminNETResultSqlSugarPagedListPageSerialOutput } from '../models';
|
import { AdminNETResultSqlSugarPagedListPageSerialOutput } from '../models';
|
||||||
import { AdminNETResultString } from '../models';
|
import { AdminNETResultString } from '../models';
|
||||||
@ -466,6 +467,49 @@ export const SysSerialApiAxiosParamCreator = function (configuration?: Configura
|
|||||||
options: localVarRequestOptions,
|
options: localVarRequestOptions,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 获取流水号类型
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiSysSerialTypeListGet: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
const localVarPath = `/api/sysSerial/typeList`;
|
||||||
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
|
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||||
|
let baseOptions;
|
||||||
|
if (configuration) {
|
||||||
|
baseOptions = configuration.baseOptions;
|
||||||
|
}
|
||||||
|
const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
|
||||||
|
const localVarHeaderParameter = {} as any;
|
||||||
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
|
// authentication Bearer required
|
||||||
|
// http bearer authentication required
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = new URLSearchParams(localVarUrlObj.search);
|
||||||
|
for (const key in localVarQueryParameter) {
|
||||||
|
query.set(key, localVarQueryParameter[key]);
|
||||||
|
}
|
||||||
|
for (const key in options.params) {
|
||||||
|
query.set(key, options.params[key]);
|
||||||
|
}
|
||||||
|
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||||
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||||
|
options: localVarRequestOptions,
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 更新本地序列 ✏️
|
* @summary 更新本地序列 ✏️
|
||||||
@ -648,6 +692,19 @@ export const SysSerialApiFp = function(configuration?: Configuration) {
|
|||||||
return axios.request(axiosRequestArgs);
|
return axios.request(axiosRequestArgs);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 获取流水号类型
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysSerialTypeListGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminNETResultListSelectListItem>>> {
|
||||||
|
const localVarAxiosArgs = await SysSerialApiAxiosParamCreator(configuration).apiSysSerialTypeListGet(options);
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 更新本地序列 ✏️
|
* @summary 更新本地序列 ✏️
|
||||||
@ -760,6 +817,15 @@ export const SysSerialApiFactory = function (configuration?: Configuration, base
|
|||||||
async apiSysSerialSlotListGet(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultListString>> {
|
async apiSysSerialSlotListGet(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultListString>> {
|
||||||
return SysSerialApiFp(configuration).apiSysSerialSlotListGet(options).then((request) => request(axios, basePath));
|
return SysSerialApiFp(configuration).apiSysSerialSlotListGet(options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 获取流水号类型
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysSerialTypeListGet(options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultListSelectListItem>> {
|
||||||
|
return SysSerialApiFp(configuration).apiSysSerialTypeListGet(options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 更新本地序列 ✏️
|
* @summary 更新本地序列 ✏️
|
||||||
@ -878,6 +944,16 @@ export class SysSerialApi extends BaseAPI {
|
|||||||
public async apiSysSerialSlotListGet(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultListString>> {
|
public async apiSysSerialSlotListGet(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultListString>> {
|
||||||
return SysSerialApiFp(this.configuration).apiSysSerialSlotListGet(options).then((request) => request(this.axios, this.basePath));
|
return SysSerialApiFp(this.configuration).apiSysSerialSlotListGet(options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 获取流水号类型
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof SysSerialApi
|
||||||
|
*/
|
||||||
|
public async apiSysSerialTypeListGet(options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultListSelectListItem>> {
|
||||||
|
return SysSerialApiFp(this.configuration).apiSysSerialTypeListGet(options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 更新本地序列 ✏️
|
* @summary 更新本地序列 ✏️
|
||||||
|
|||||||
@ -13,7 +13,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ResetIntervalEnum } from './reset-interval-enum';
|
import { ResetIntervalEnum } from './reset-interval-enum';
|
||||||
import { SerialTypeEnum } from './serial-type-enum';
|
|
||||||
import { StatusEnum } from './status-enum';
|
import { StatusEnum } from './status-enum';
|
||||||
/**
|
/**
|
||||||
* 本地序列增加输入参数
|
* 本地序列增加输入参数
|
||||||
@ -46,10 +45,12 @@ export interface AddSerialInput {
|
|||||||
tenantId?: number | null;
|
tenantId?: number | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {SerialTypeEnum}
|
* 使用分类
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
* @memberof AddSerialInput
|
* @memberof AddSerialInput
|
||||||
*/
|
*/
|
||||||
type: SerialTypeEnum;
|
type: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ResetIntervalEnum}
|
* @type {ResetIntervalEnum}
|
||||||
|
|||||||
@ -0,0 +1,71 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* Admin.NET 通用权限开发平台
|
||||||
|
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { SelectListItem } from './select-list-item';
|
||||||
|
/**
|
||||||
|
* 全局返回结果
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface AdminNETResultListSelectListItem
|
||||||
|
*/
|
||||||
|
export interface AdminNETResultListSelectListItem {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态码
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof AdminNETResultListSelectListItem
|
||||||
|
*/
|
||||||
|
code?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型success、warning、error
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof AdminNETResultListSelectListItem
|
||||||
|
*/
|
||||||
|
type?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误信息
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof AdminNETResultListSelectListItem
|
||||||
|
*/
|
||||||
|
message?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据
|
||||||
|
*
|
||||||
|
* @type {Array<SelectListItem>}
|
||||||
|
* @memberof AdminNETResultListSelectListItem
|
||||||
|
*/
|
||||||
|
result?: Array<SelectListItem> | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附加数据
|
||||||
|
*
|
||||||
|
* @type {any}
|
||||||
|
* @memberof AdminNETResultListSelectListItem
|
||||||
|
*/
|
||||||
|
extras?: any | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*
|
||||||
|
* @type {Date}
|
||||||
|
* @memberof AdminNETResultListSelectListItem
|
||||||
|
*/
|
||||||
|
time?: Date;
|
||||||
|
}
|
||||||
@ -12,7 +12,6 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SerialTypeEnum } from './serial-type-enum';
|
|
||||||
/**
|
/**
|
||||||
* 获取下一个输入参数
|
* 获取下一个输入参数
|
||||||
*
|
*
|
||||||
@ -22,8 +21,10 @@ import { SerialTypeEnum } from './serial-type-enum';
|
|||||||
export interface GetNextSeqInput {
|
export interface GetNextSeqInput {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {SerialTypeEnum}
|
* 使用分类
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
* @memberof GetNextSeqInput
|
* @memberof GetNextSeqInput
|
||||||
*/
|
*/
|
||||||
type?: SerialTypeEnum;
|
type?: string | null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,7 @@ export * from './admin-netresult-list-pos-output';
|
|||||||
export * from './admin-netresult-list-report-data-source-output';
|
export * from './admin-netresult-list-report-data-source-output';
|
||||||
export * from './admin-netresult-list-role-output';
|
export * from './admin-netresult-list-role-output';
|
||||||
export * from './admin-netresult-list-role-table-output';
|
export * from './admin-netresult-list-role-table-output';
|
||||||
|
export * from './admin-netresult-list-select-list-item';
|
||||||
export * from './admin-netresult-list-stat-log-output';
|
export * from './admin-netresult-list-stat-log-output';
|
||||||
export * from './admin-netresult-list-string';
|
export * from './admin-netresult-list-string';
|
||||||
export * from './admin-netresult-list-sys-code-gen-template';
|
export * from './admin-netresult-list-sys-code-gen-template';
|
||||||
@ -431,8 +432,9 @@ export * from './schema-serialization-mode';
|
|||||||
export * from './search';
|
export * from './search';
|
||||||
export * from './security-rule-set';
|
export * from './security-rule-set';
|
||||||
export * from './seed-type';
|
export * from './seed-type';
|
||||||
|
export * from './select-list-group';
|
||||||
|
export * from './select-list-item';
|
||||||
export * from './send-subscribe-message-input';
|
export * from './send-subscribe-message-input';
|
||||||
export * from './serial-type-enum';
|
|
||||||
export * from './serialization-format';
|
export * from './serialization-format';
|
||||||
export * from './set-nick-name-input';
|
export * from './set-nick-name-input';
|
||||||
export * from './signature-input';
|
export * from './signature-input';
|
||||||
|
|||||||
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
import { Filter } from './filter';
|
import { Filter } from './filter';
|
||||||
import { Search } from './search';
|
import { Search } from './search';
|
||||||
import { SerialTypeEnum } from './serial-type-enum';
|
|
||||||
import { StatusEnum } from './status-enum';
|
import { StatusEnum } from './status-enum';
|
||||||
/**
|
/**
|
||||||
* 本地序列分页查询输入参数
|
* 本地序列分页查询输入参数
|
||||||
@ -93,10 +92,12 @@ export interface PageSerialInput {
|
|||||||
searchKey?: string | null;
|
searchKey?: string | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {SerialTypeEnum}
|
* 使用分类
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
* @memberof PageSerialInput
|
* @memberof PageSerialInput
|
||||||
*/
|
*/
|
||||||
type?: SerialTypeEnum;
|
type?: string | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {StatusEnum}
|
* @type {StatusEnum}
|
||||||
|
|||||||
@ -13,7 +13,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ResetIntervalEnum } from './reset-interval-enum';
|
import { ResetIntervalEnum } from './reset-interval-enum';
|
||||||
import { SerialTypeEnum } from './serial-type-enum';
|
|
||||||
import { StatusEnum } from './status-enum';
|
import { StatusEnum } from './status-enum';
|
||||||
/**
|
/**
|
||||||
* 本地序列输出参数
|
* 本地序列输出参数
|
||||||
@ -48,10 +47,12 @@ export interface PageSerialOutput {
|
|||||||
expy?: Date | null;
|
expy?: Date | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {SerialTypeEnum}
|
* 使用分类
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
* @memberof PageSerialOutput
|
* @memberof PageSerialOutput
|
||||||
*/
|
*/
|
||||||
type?: SerialTypeEnum;
|
type?: string | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ResetIntervalEnum}
|
* @type {ResetIntervalEnum}
|
||||||
|
|||||||
@ -12,12 +12,23 @@
|
|||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统流水号类型枚举<br /> 其他 Other = 999<br />
|
*
|
||||||
|
*
|
||||||
* @export
|
* @export
|
||||||
* @enum {string}
|
* @interface SelectListGroup
|
||||||
*/
|
*/
|
||||||
export enum SerialTypeEnum {
|
export interface SelectListGroup {
|
||||||
NUMBER_999 = 999
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof SelectListGroup
|
||||||
|
*/
|
||||||
|
disabled?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SelectListGroup
|
||||||
|
*/
|
||||||
|
name?: string | null;
|
||||||
|
}
|
||||||
53
Web/src/api-services/system/models/select-list-item.ts
Normal file
53
Web/src/api-services/system/models/select-list-item.ts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
/**
|
||||||
|
* Admin.NET 通用权限开发平台
|
||||||
|
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||||
|
*
|
||||||
|
* OpenAPI spec version: 1.0.0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by the swagger code generator program.
|
||||||
|
* https://github.com/swagger-api/swagger-codegen.git
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { SelectListGroup } from './select-list-group';
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @interface SelectListItem
|
||||||
|
*/
|
||||||
|
export interface SelectListItem {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof SelectListItem
|
||||||
|
*/
|
||||||
|
disabled?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {SelectListGroup}
|
||||||
|
* @memberof SelectListItem
|
||||||
|
*/
|
||||||
|
group?: SelectListGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof SelectListItem
|
||||||
|
*/
|
||||||
|
selected?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SelectListItem
|
||||||
|
*/
|
||||||
|
text?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SelectListItem
|
||||||
|
*/
|
||||||
|
value?: string | null;
|
||||||
|
}
|
||||||
@ -13,7 +13,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ResetIntervalEnum } from './reset-interval-enum';
|
import { ResetIntervalEnum } from './reset-interval-enum';
|
||||||
import { SerialTypeEnum } from './serial-type-enum';
|
|
||||||
import { StatusEnum } from './status-enum';
|
import { StatusEnum } from './status-enum';
|
||||||
/**
|
/**
|
||||||
* 系统流水号表
|
* 系统流水号表
|
||||||
@ -56,10 +55,12 @@ export interface SysSerial {
|
|||||||
expy: Date;
|
expy: Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {SerialTypeEnum}
|
* 使用分类
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
* @memberof SysSerial
|
* @memberof SysSerial
|
||||||
*/
|
*/
|
||||||
type: SerialTypeEnum;
|
type: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ResetIntervalEnum}
|
* @type {ResetIntervalEnum}
|
||||||
|
|||||||
@ -13,7 +13,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ResetIntervalEnum } from './reset-interval-enum';
|
import { ResetIntervalEnum } from './reset-interval-enum';
|
||||||
import { SerialTypeEnum } from './serial-type-enum';
|
|
||||||
import { StatusEnum } from './status-enum';
|
import { StatusEnum } from './status-enum';
|
||||||
/**
|
/**
|
||||||
* 本地序列更新输入参数
|
* 本地序列更新输入参数
|
||||||
@ -48,10 +47,12 @@ export interface UpdateSerialInput {
|
|||||||
seq: number;
|
seq: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {SerialTypeEnum}
|
* 使用分类
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
* @memberof UpdateSerialInput
|
* @memberof UpdateSerialInput
|
||||||
*/
|
*/
|
||||||
type: SerialTypeEnum;
|
type: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ResetIntervalEnum}
|
* @type {ResetIntervalEnum}
|
||||||
|
|||||||
@ -16,7 +16,9 @@
|
|||||||
</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="type">
|
<el-form-item label="使用分类" prop="type">
|
||||||
<g-sys-dict v-model="state.ruleForm.type" :code="'SerialTypeEnum'" render-as="select" clearable />
|
<el-select v-model="state.ruleForm.type" placeholder="分类">
|
||||||
|
<el-option v-for="item in state.typeData" :key="item.value" :label="item.text" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
@ -98,6 +100,7 @@ const state = reactive({
|
|||||||
loading: false,
|
loading: false,
|
||||||
showDialog: false,
|
showDialog: false,
|
||||||
previewSeqNo: '',
|
previewSeqNo: '',
|
||||||
|
typeData: [] as any[],
|
||||||
slotList: [] as any[],
|
slotList: [] as any[],
|
||||||
ruleForm: {} as UpdateSerialInput,
|
ruleForm: {} as UpdateSerialInput,
|
||||||
});
|
});
|
||||||
@ -119,8 +122,10 @@ onMounted(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = async (row: any) => {
|
const openDialog = async (row: any, typeData: any[]) => {
|
||||||
state.ruleForm = JSON.parse(JSON.stringify(row));
|
state.ruleForm = JSON.parse(JSON.stringify(row));
|
||||||
|
state.ruleForm.formater ??= '';
|
||||||
|
state.typeData = typeData;
|
||||||
state.showDialog = true;
|
state.showDialog = true;
|
||||||
ruleFormRef.value?.resetFields();
|
ruleFormRef.value?.resetFields();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5,7 +5,9 @@
|
|||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col class="mb5" :sm="12" :md="8" :lg="6" :xl="6">
|
<el-col class="mb5" :sm="12" :md="8" :lg="6" :xl="6">
|
||||||
<el-form-item label="分类" prop="type">
|
<el-form-item label="分类" prop="type">
|
||||||
<g-sys-dict v-model="state.queryParams.type" :code="'SerialTypeEnum'" render-as="select" clearable @keyup.enter.native="handleQuery(false)" />
|
<el-select v-model="state.queryParams.type" placeholder="分类" clearable @keyup.enter.native="handleQuery(false)">
|
||||||
|
<el-option v-for="item in state.typeData" :key="item.value" :label="item.text" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col class="mb5" :sm="12" :md="8" :lg="6" :xl="6">
|
<el-col class="mb5" :sm="12" :md="8" :lg="6" :xl="6">
|
||||||
@ -38,7 +40,7 @@
|
|||||||
{{ commonFun.dateFormatYMDHMS(row, $index, row.expy) }}
|
{{ commonFun.dateFormatYMDHMS(row, $index, row.expy) }}
|
||||||
</template>
|
</template>
|
||||||
<template #row_type="{ row, $index }">
|
<template #row_type="{ row, $index }">
|
||||||
<g-sys-dict v-model="row.type" :code="'SerialTypeEnum'" />
|
<el-tag v-for="item in state.typeData" v-show="item.value === row.type">{{ item.text }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #row_resetInterval="{ row, $index }">
|
<template #row_resetInterval="{ row, $index }">
|
||||||
<g-sys-dict v-model="row.resetInterval" :code="'ResetIntervalEnum'" />
|
<g-sys-dict v-model="row.resetInterval" :code="'ResetIntervalEnum'" />
|
||||||
@ -86,6 +88,7 @@ const state = reactive({
|
|||||||
pageSize: 20 as number,
|
pageSize: 20 as number,
|
||||||
defaultSort: { field: 'id', order: 'asc', descStr: 'desc' },
|
defaultSort: { field: 'id', order: 'asc', descStr: 'desc' },
|
||||||
},
|
},
|
||||||
|
typeData: [] as any[],
|
||||||
visible: false,
|
visible: false,
|
||||||
title: '',
|
title: '',
|
||||||
});
|
});
|
||||||
@ -99,14 +102,14 @@ const options = useVxeTable<PageSerialOutput>(
|
|||||||
name: '流水号',
|
name: '流水号',
|
||||||
columns: [
|
columns: [
|
||||||
// { type: 'checkbox', width: 40, fixed: 'left' },
|
// { type: 'checkbox', width: 40, fixed: 'left' },
|
||||||
// { field: 'seq', type: 'seq', title: '序号', width: 60, fixed: 'left' },
|
{ field: 'seq', type: 'seq', title: '序号', width: 60, fixed: 'left' },
|
||||||
{ field: 'seq', title: '序列号', minWidth: 80, showOverflow: 'tooltip' },
|
|
||||||
{ field: 'expy', title: '有效期', minWidth: 150, showOverflow: 'tooltip', slots: { default: 'row_expy' } },
|
|
||||||
{ field: 'type', title: '分类', minWidth: 150, showOverflow: 'tooltip', slots: { default: 'row_type' } },
|
{ field: 'type', title: '分类', minWidth: 150, showOverflow: 'tooltip', slots: { default: 'row_type' } },
|
||||||
{ field: 'resetInterval', title: '重置间隔', minWidth: 120, showOverflow: 'tooltip', slots: { default: 'row_resetInterval' } },
|
{ field: 'resetInterval', title: '重置间隔', minWidth: 120, showOverflow: 'tooltip', slots: { default: 'row_resetInterval' } },
|
||||||
{ field: 'formater', title: '表达式', minWidth: 220, showOverflow: 'tooltip' },
|
{ field: 'formater', title: '表达式', minWidth: 220, showOverflow: 'tooltip' },
|
||||||
|
{ field: 'seq', title: '当前序列号', minWidth: 80, showOverflow: 'tooltip' },
|
||||||
{ field: 'min', title: '最小值', minWidth: 80, showOverflow: 'tooltip' },
|
{ field: 'min', title: '最小值', minWidth: 80, showOverflow: 'tooltip' },
|
||||||
{ field: 'max', title: '最大值', minWidth: 150, showOverflow: 'tooltip' },
|
{ field: 'max', title: '最大值', minWidth: 150, showOverflow: 'tooltip' },
|
||||||
|
{ field: 'expy', title: '有效期', minWidth: 150, showOverflow: 'tooltip', slots: { default: 'row_expy' } },
|
||||||
{ field: 'orderNo', title: '排序', minWidth: 100, sortable: true, showOverflow: 'tooltip' },
|
{ field: 'orderNo', title: '排序', minWidth: 100, sortable: true, showOverflow: 'tooltip' },
|
||||||
{ field: 'status', title: '状态', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_status' } },
|
{ field: 'status', title: '状态', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_status' } },
|
||||||
{ field: 'remark', title: '备注', minWidth: 150, showOverflow: 'tooltip' },
|
{ field: 'remark', title: '备注', minWidth: 150, showOverflow: 'tooltip' },
|
||||||
@ -132,6 +135,7 @@ const options = useVxeTable<PageSerialOutput>(
|
|||||||
// 页面初始化
|
// 页面初始化
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
state.localPageParam = Local.get(localPageParamKey) || state.localPageParam;
|
state.localPageParam = Local.get(localPageParamKey) || state.localPageParam;
|
||||||
|
state.typeData = await getAPI(SysSerialApi).apiSysSerialTypeListGet().then(res => res.data.result ?? []);
|
||||||
handleQuery(true);
|
handleQuery(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -158,13 +162,13 @@ const resetQuery = async () => {
|
|||||||
// 打开新增页面
|
// 打开新增页面
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
state.title = '添加流水号'; // i18n.t('message.list.addPosition');
|
state.title = '添加流水号'; // i18n.t('message.list.addPosition');
|
||||||
editSerialRef.value?.openDialog({ type: 999, resetInterval: 1, min: 1, max: 99999999, status: 1, orderNo: 100 });
|
editSerialRef.value?.openDialog({ resetInterval: 1, min: 1, max: 99999999, status: 1, orderNo: 100 }, state.typeData);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开编辑页面
|
// 打开编辑页面
|
||||||
const handleEdit = async (row: any) => {
|
const handleEdit = async (row: any) => {
|
||||||
state.title = '编辑流水号'; //i18n.t('message.list.editPosition');
|
state.title = '编辑流水号'; //i18n.t('message.list.editPosition');
|
||||||
editSerialRef.value?.openDialog(row);
|
editSerialRef.value?.openDialog(row, state.typeData);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user