diff --git a/Admin.NET/Admin.NET.Application/Entity/TestCodeGenDemo.cs b/Admin.NET/Admin.NET.Application/Entity/TestCodeGenDemo.cs index c7b4a6d6..9119bd2f 100644 --- a/Admin.NET/Admin.NET.Application/Entity/TestCodeGenDemo.cs +++ b/Admin.NET/Admin.NET.Application/Entity/TestCodeGenDemo.cs @@ -22,7 +22,7 @@ public class TestCodeGenDemo : EntityBase /// /// 流水号 /// - [BindSerial(SerialTypeEnum.Other)] + [BindSerial(nameof(SerialTypeProvider.Test))] [SugarColumn(ColumnDescription = "流水号", Length = 128)] public string? SeqNo { get; set; } diff --git a/Admin.NET/Admin.NET.Application/SeedData/SysSerialSeedData.cs b/Admin.NET/Admin.NET.Application/SeedData/SysSerialSeedData.cs new file mode 100644 index 00000000..1bd86233 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/SeedData/SysSerialSeedData.cs @@ -0,0 +1,27 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +namespace Admin.NET.Application; + +/// +/// 流水号种子数据 +/// +[SeedData(500)] +[IncreSeed] +public class SysSerialSeedData : ISqlSugarEntitySeedData +{ + /// + /// 种子数据 + /// + /// + public IEnumerable 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 }, + ]; + } +} \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Application/Serial/SerialSlotProvider.cs b/Admin.NET/Admin.NET.Application/Serial/SerialSlotProvider.cs new file mode 100644 index 00000000..b86154b6 --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Serial/SerialSlotProvider.cs @@ -0,0 +1,21 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +namespace Admin.NET.Application; + +/// +/// 扩展流水号插槽 +/// +public class SerialSlotProvider : ISerialSlotProvider +{ + public Dictionary> GetSlotMap() + { + return new() + { + { "{Account}", (seq, max, nowDate, userManager) => userManager.Account[..2] } + }; + } +} \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Application/Serial/SerialTypeProvider.cs b/Admin.NET/Admin.NET.Application/Serial/SerialTypeProvider.cs new file mode 100644 index 00000000..213072ef --- /dev/null +++ b/Admin.NET/Admin.NET.Application/Serial/SerialTypeProvider.cs @@ -0,0 +1,19 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +namespace Admin.NET.Application; + +/// +/// 业务流水号类型常量 +/// +public class SerialTypeProvider : ISerialTypeProvider +{ + /// + /// 测试流水号 + /// + [Description("测试")] + public const string Test = nameof(Test); +} \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Attribute/BindSerialAttribute.cs b/Admin.NET/Admin.NET.Core/Attribute/BindSerialAttribute.cs index c79e6f47..b70cccbd 100644 --- a/Admin.NET/Admin.NET.Core/Attribute/BindSerialAttribute.cs +++ b/Admin.NET/Admin.NET.Core/Attribute/BindSerialAttribute.cs @@ -10,12 +10,12 @@ namespace Admin.NET.Core; /// 绑定序列号特性类 /// [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)] -public class BindSerialAttribute(SerialTypeEnum type, bool isGlobal = false) : Attribute +public class BindSerialAttribute(string type, bool isGlobal = false) : Attribute { /// /// 序列号类型 /// - public SerialTypeEnum Type { get; set; } = type; + public string Type { get; set; } = type; /// /// 是否全局 diff --git a/Admin.NET/Admin.NET.Core/Const/CacheConst.cs b/Admin.NET/Admin.NET.Core/Const/CacheConst.cs index 28300a05..1810ad4c 100644 --- a/Admin.NET/Admin.NET.Core/Const/CacheConst.cs +++ b/Admin.NET/Admin.NET.Core/Const/CacheConst.cs @@ -125,4 +125,14 @@ public class CacheConst /// 流水号分布式锁缓存 /// public const string KeySerialLock = "sys_serial_lock"; + + /// + /// 流水号插槽缓存 + /// + public const string KeySysSerialSlot = "sys_serial_slot"; + + /// + /// 流水号类型 + /// + public const string KeySysSerialType = "sys_serial_type"; } \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Entity/SysSerial.cs b/Admin.NET/Admin.NET.Core/Entity/SysSerial.cs index fd99537c..fe475292 100644 --- a/Admin.NET/Admin.NET.Core/Entity/SysSerial.cs +++ b/Admin.NET/Admin.NET.Core/Entity/SysSerial.cs @@ -32,9 +32,10 @@ public class SysSerial : EntityTenantId /// /// 使用分类 /// - [SugarColumn(ColumnDescription = "使用分类")] + [SugarColumn(ColumnDescription = "使用分类", Length = 32)] + [MaxLength(32)] [Required] - public virtual SerialTypeEnum Type { get; set; } + public virtual string Type { get; set; } /// /// 重置间隔 diff --git a/Admin.NET/Admin.NET.Core/Enum/ErrorCodeEnum.cs b/Admin.NET/Admin.NET.Core/Enum/ErrorCodeEnum.cs index 84b0c2da..66de8ed2 100644 --- a/Admin.NET/Admin.NET.Core/Enum/ErrorCodeEnum.cs +++ b/Admin.NET/Admin.NET.Core/Enum/ErrorCodeEnum.cs @@ -905,5 +905,17 @@ public enum ErrorCodeEnum /// 无效的流水号重置类型 /// [ErrorCodeItemMetadata("无效的流水号重置类型")] - S0006 + S0006, + + /// + /// 无效的流水号类型 + /// + [ErrorCodeItemMetadata("无效的流水号类型:{0}")] + S0007, + + /// + /// 存在相同流水号类型,请检查所有实现了ISerialTypeProvider接口的类字段 + /// + [ErrorCodeItemMetadata("存在相同流水号类型,请检查所有实现了ISerialTypeProvider接口的类字段")] + S0008, } \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Service/Serial/Dto/SerialInput.cs b/Admin.NET/Admin.NET.Core/Service/Serial/Dto/SerialInput.cs index c53932b6..f6d47ec2 100644 --- a/Admin.NET/Admin.NET.Core/Service/Serial/Dto/SerialInput.cs +++ b/Admin.NET/Admin.NET.Core/Service/Serial/Dto/SerialInput.cs @@ -24,7 +24,7 @@ public class SerialBaseInput /// /// 使用分类 /// - public virtual SerialTypeEnum? Type { get; set; } + public virtual string Type { get; set; } /// /// 重置间隔 @@ -80,8 +80,7 @@ public class PageSerialInput : BasePageInput /// /// 使用分类 /// - [Dict(nameof(SerialTypeEnum))] - public SerialTypeEnum? Type { get; set; } + public string Type { get; set; } /// /// 状态 @@ -99,8 +98,7 @@ public class AddSerialInput : SerialBaseInput /// 使用分类 /// [Required(ErrorMessage = "使用分类不能为空")] - [Enum] - public override SerialTypeEnum? Type { get; set; } + public override string Type { get; set; } /// /// 重置间隔 @@ -160,9 +158,8 @@ public class UpdateSerialInput : SerialBaseInput /// /// 使用分类 /// - [Enum] [Required(ErrorMessage = "使用分类不能为空")] - public override SerialTypeEnum? Type { get; set; } + public override string Type { get; set; } /// /// 重置间隔 @@ -238,6 +235,5 @@ public class GetNextSeqInput /// /// 使用分类 /// - [Dict(nameof(SerialTypeEnum))] - public virtual SerialTypeEnum? Type { get; set; } + public virtual string Type { get; set; } } \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Service/Serial/Dto/SerialOutput.cs b/Admin.NET/Admin.NET.Core/Service/Serial/Dto/SerialOutput.cs index f9992863..7b267bb8 100644 --- a/Admin.NET/Admin.NET.Core/Service/Serial/Dto/SerialOutput.cs +++ b/Admin.NET/Admin.NET.Core/Service/Serial/Dto/SerialOutput.cs @@ -29,7 +29,7 @@ public class PageSerialOutput /// /// 使用分类 /// - public SerialTypeEnum? Type { get; set; } + public string Type { get; set; } /// /// 重置间隔 diff --git a/Admin.NET/Admin.NET.Core/Service/Serial/ISerialSlotProvider.cs b/Admin.NET/Admin.NET.Core/Service/Serial/ISerialSlotProvider.cs new file mode 100644 index 00000000..71878129 --- /dev/null +++ b/Admin.NET/Admin.NET.Core/Service/Serial/ISerialSlotProvider.cs @@ -0,0 +1,15 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +namespace Admin.NET.Core.Service; + +/// +/// 流水号插槽提供者接口 +/// +public interface ISerialSlotProvider +{ + public Dictionary> GetSlotMap(); +} \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Enum/SerialTypeEnum.cs b/Admin.NET/Admin.NET.Core/Service/Serial/ISerialTypeProvider.cs similarity index 56% rename from Admin.NET/Admin.NET.Core/Enum/SerialTypeEnum.cs rename to Admin.NET/Admin.NET.Core/Service/Serial/ISerialTypeProvider.cs index a307c199..5e0753ec 100644 --- a/Admin.NET/Admin.NET.Core/Enum/SerialTypeEnum.cs +++ b/Admin.NET/Admin.NET.Core/Service/Serial/ISerialTypeProvider.cs @@ -1,4 +1,4 @@ -// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 // // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 // @@ -7,14 +7,8 @@ namespace Admin.NET.Core; /// -/// 系统流水号类型枚举 +/// 流水号类型提供者接口 /// -[Description("系统流水号类型枚举")] -public enum SerialTypeEnum +public interface ISerialTypeProvider { - /// - /// 其他 - /// - [Description("其他")] - Other = 999, } \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Service/Serial/SysSerialService.cs b/Admin.NET/Admin.NET.Core/Service/Serial/SysSerialService.cs index 131c56ba..3908450f 100644 --- a/Admin.NET/Admin.NET.Core/Service/Serial/SysSerialService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Serial/SysSerialService.cs @@ -4,6 +4,8 @@ // // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! +using Microsoft.AspNetCore.Mvc.Rendering; + namespace Admin.NET.Core.Service; /// @@ -18,6 +20,11 @@ public class SysSerialService : IDynamicApiController, ITransient private readonly UserManager _userManager; private readonly ISqlSugarClient _db; + /// + /// 因为缓存的是代理,无法序列化,所以只能用字典缓存 + /// + private readonly ConcurrentDictionary>> _slotTempMap = new(); + public SysSerialService(SqlSugarRepository sysSerialRep, SysCacheService sysCacheService, ISqlSugarClient db, UserManager userManager) @@ -67,6 +74,8 @@ public class SysSerialService : IDynamicApiController, ITransient [ApiDescriptionSettings(Name = "Add"), HttpPost] public async Task 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); var entity = input.Adapt(); @@ -84,6 +93,8 @@ public class SysSerialService : IDynamicApiController, ITransient [ApiDescriptionSettings(Name = "Update"), HttpPost] 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); 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(); } + /// + /// 获取流水号类型 + /// + /// + [DisplayName("获取流水号类型"), HttpGet] + public List GetTypeList() + { + var typeList = _sysCacheService.Get>(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()?.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; + } + /// /// 获取流水号 /// @@ -169,7 +201,7 @@ public class SysSerialService : IDynamicApiController, ITransient /// 是否开启事务 /// [NonAction] - public async Task NextSeqNo(SerialTypeEnum? type, bool isGlobal = false, bool isTran = true) + public async Task NextSeqNo(string type, bool isGlobal = false, bool isTran = true) { // 获取租户Id, 以及分布式锁缓存键名 long? tenantId = isGlobal ? SqlSugarConst.DefaultTenantId : _userManager.TenantId; @@ -279,18 +311,45 @@ public class SysSerialService : IDynamicApiController, ITransient [NonAction] private Dictionary> GetSlotMap(long seq, long max, DateTime nowDate) { - // 使用 "插槽名 - 代理方法" 映射表,这样匹配到的插槽才渲染,减少不必要的运算 - return new Dictionary> + // 获取插槽逻辑模板 + var slotLogic = _slotTempMap.GetOrAdd(CacheConst.KeySysSerialSlot, _ => { - ["{yyyy}"] = () => nowDate.Year.ToString(), - ["{yy}"] = () => nowDate.Year.ToString()[2..], - ["{MM}"] = () => nowDate.Month.ToString("D2"), - ["{dd}"] = () => nowDate.Day.ToString("D2"), - ["{HH}"] = () => nowDate.Hour.ToString("D2"), - ["{mm}"] = () => nowDate.Minute.ToString("D2"), - ["{ss}"] = () => nowDate.Second.ToString("D2"), - ["{SEQ}"] = () => seq.ToString("D" + max.ToString().Length), - ["{TenantId}"] = () => _userManager.TenantId.ToString(), - }; + // 默认插槽逻辑 + var logicMap = new Dictionary> + { + // 序号格式化 + ["{SEQ}"] = (s, m, _, _) => s.ToString($"D{m.ToString().Length}"), + // 时间相关(依赖 nowDate) + ["{yyyy}"] = (_, _, d, _) => d.Year.ToString(), + ["{yy}"] = (_, _, d, _) => d.Year.ToString().Substring(2), + ["{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 + var result = new Dictionary>(); + foreach (var kv in slotLogic) result.TryAdd(kv.Key, () => kv.Value(seq, max, nowDate, _userManager)); + return result; } } \ No newline at end of file diff --git a/Web/src/api-services/system/apis/sys-serial-api.ts b/Web/src/api-services/system/apis/sys-serial-api.ts index b5d30bd3..1948cbfc 100644 --- a/Web/src/api-services/system/apis/sys-serial-api.ts +++ b/Web/src/api-services/system/apis/sys-serial-api.ts @@ -19,6 +19,7 @@ import { Configuration } from '../configuration'; import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { AddSerialInput } from '../models'; import { AdminNETResultInt64 } from '../models'; +import { AdminNETResultListSelectListItem } from '../models'; import { AdminNETResultListString } from '../models'; import { AdminNETResultSqlSugarPagedListPageSerialOutput } from '../models'; import { AdminNETResultString } from '../models'; @@ -466,6 +467,49 @@ export const SysSerialApiAxiosParamCreator = function (configuration?: Configura options: localVarRequestOptions, }; }, + /** + * + * @summary 获取流水号类型 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSysSerialTypeListGet: async (options: AxiosRequestConfig = {}): Promise => { + 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 更新本地序列 ✏️ @@ -648,6 +692,19 @@ export const SysSerialApiFp = function(configuration?: Configuration) { return axios.request(axiosRequestArgs); }; }, + /** + * + * @summary 获取流水号类型 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysSerialTypeListGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + 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 更新本地序列 ✏️ @@ -760,6 +817,15 @@ export const SysSerialApiFactory = function (configuration?: Configuration, base async apiSysSerialSlotListGet(options?: AxiosRequestConfig): Promise> { return SysSerialApiFp(configuration).apiSysSerialSlotListGet(options).then((request) => request(axios, basePath)); }, + /** + * + * @summary 获取流水号类型 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysSerialTypeListGet(options?: AxiosRequestConfig): Promise> { + return SysSerialApiFp(configuration).apiSysSerialTypeListGet(options).then((request) => request(axios, basePath)); + }, /** * * @summary 更新本地序列 ✏️ @@ -878,6 +944,16 @@ export class SysSerialApi extends BaseAPI { public async apiSysSerialSlotListGet(options?: AxiosRequestConfig) : Promise> { 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> { + return SysSerialApiFp(this.configuration).apiSysSerialTypeListGet(options).then((request) => request(this.axios, this.basePath)); + } /** * * @summary 更新本地序列 ✏️ diff --git a/Web/src/api-services/system/models/add-serial-input.ts b/Web/src/api-services/system/models/add-serial-input.ts index 29cd4c4b..69a30fb2 100644 --- a/Web/src/api-services/system/models/add-serial-input.ts +++ b/Web/src/api-services/system/models/add-serial-input.ts @@ -13,7 +13,6 @@ */ import { ResetIntervalEnum } from './reset-interval-enum'; -import { SerialTypeEnum } from './serial-type-enum'; import { StatusEnum } from './status-enum'; /** * 本地序列增加输入参数 @@ -46,10 +45,12 @@ export interface AddSerialInput { tenantId?: number | null; /** - * @type {SerialTypeEnum} + * 使用分类 + * + * @type {string} * @memberof AddSerialInput */ - type: SerialTypeEnum; + type: string; /** * @type {ResetIntervalEnum} diff --git a/Web/src/api-services/system/models/admin-netresult-list-select-list-item.ts b/Web/src/api-services/system/models/admin-netresult-list-select-list-item.ts new file mode 100644 index 00000000..41878800 --- /dev/null +++ b/Web/src/api-services/system/models/admin-netresult-list-select-list-item.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Admin.NET 通用权限开发平台 + * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。
👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + * + * 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} + * @memberof AdminNETResultListSelectListItem + */ + result?: Array | null; + + /** + * 附加数据 + * + * @type {any} + * @memberof AdminNETResultListSelectListItem + */ + extras?: any | null; + + /** + * 时间 + * + * @type {Date} + * @memberof AdminNETResultListSelectListItem + */ + time?: Date; +} diff --git a/Web/src/api-services/system/models/get-next-seq-input.ts b/Web/src/api-services/system/models/get-next-seq-input.ts index c96503d8..55e69f9f 100644 --- a/Web/src/api-services/system/models/get-next-seq-input.ts +++ b/Web/src/api-services/system/models/get-next-seq-input.ts @@ -12,7 +12,6 @@ * 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 { /** - * @type {SerialTypeEnum} + * 使用分类 + * + * @type {string} * @memberof GetNextSeqInput */ - type?: SerialTypeEnum; + type?: string | null; } diff --git a/Web/src/api-services/system/models/index.ts b/Web/src/api-services/system/models/index.ts index 989fe3aa..273d7aef 100644 --- a/Web/src/api-services/system/models/index.ts +++ b/Web/src/api-services/system/models/index.ts @@ -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-role-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-string'; export * from './admin-netresult-list-sys-code-gen-template'; @@ -431,8 +432,9 @@ export * from './schema-serialization-mode'; export * from './search'; export * from './security-rule-set'; export * from './seed-type'; +export * from './select-list-group'; +export * from './select-list-item'; export * from './send-subscribe-message-input'; -export * from './serial-type-enum'; export * from './serialization-format'; export * from './set-nick-name-input'; export * from './signature-input'; diff --git a/Web/src/api-services/system/models/page-serial-input.ts b/Web/src/api-services/system/models/page-serial-input.ts index b0b509a4..0f1c9bc1 100644 --- a/Web/src/api-services/system/models/page-serial-input.ts +++ b/Web/src/api-services/system/models/page-serial-input.ts @@ -14,7 +14,6 @@ import { Filter } from './filter'; import { Search } from './search'; -import { SerialTypeEnum } from './serial-type-enum'; import { StatusEnum } from './status-enum'; /** * 本地序列分页查询输入参数 @@ -93,10 +92,12 @@ export interface PageSerialInput { searchKey?: string | null; /** - * @type {SerialTypeEnum} + * 使用分类 + * + * @type {string} * @memberof PageSerialInput */ - type?: SerialTypeEnum; + type?: string | null; /** * @type {StatusEnum} diff --git a/Web/src/api-services/system/models/page-serial-output.ts b/Web/src/api-services/system/models/page-serial-output.ts index 8bdd4460..7575a0e9 100644 --- a/Web/src/api-services/system/models/page-serial-output.ts +++ b/Web/src/api-services/system/models/page-serial-output.ts @@ -13,7 +13,6 @@ */ import { ResetIntervalEnum } from './reset-interval-enum'; -import { SerialTypeEnum } from './serial-type-enum'; import { StatusEnum } from './status-enum'; /** * 本地序列输出参数 @@ -48,10 +47,12 @@ export interface PageSerialOutput { expy?: Date | null; /** - * @type {SerialTypeEnum} + * 使用分类 + * + * @type {string} * @memberof PageSerialOutput */ - type?: SerialTypeEnum; + type?: string | null; /** * @type {ResetIntervalEnum} diff --git a/Web/src/api-services/system/models/serial-type-enum.ts b/Web/src/api-services/system/models/select-list-group.ts similarity index 72% rename from Web/src/api-services/system/models/serial-type-enum.ts rename to Web/src/api-services/system/models/select-list-group.ts index 82c0508a..1ec142e9 100644 --- a/Web/src/api-services/system/models/serial-type-enum.ts +++ b/Web/src/api-services/system/models/select-list-group.ts @@ -12,12 +12,23 @@ * Do not edit the class manually. */ -/** - * 系统流水号类型枚举
 其他 Other = 999
+ /** + * + * * @export - * @enum {string} + * @interface SelectListGroup */ -export enum SerialTypeEnum { - NUMBER_999 = 999 -} +export interface SelectListGroup { + /** + * @type {boolean} + * @memberof SelectListGroup + */ + disabled?: boolean; + + /** + * @type {string} + * @memberof SelectListGroup + */ + name?: string | null; +} diff --git a/Web/src/api-services/system/models/select-list-item.ts b/Web/src/api-services/system/models/select-list-item.ts new file mode 100644 index 00000000..3d6cea86 --- /dev/null +++ b/Web/src/api-services/system/models/select-list-item.ts @@ -0,0 +1,53 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Admin.NET 通用权限开发平台 + * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。
👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + * + * 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; +} diff --git a/Web/src/api-services/system/models/sys-serial.ts b/Web/src/api-services/system/models/sys-serial.ts index 78b9c123..fbd7418a 100644 --- a/Web/src/api-services/system/models/sys-serial.ts +++ b/Web/src/api-services/system/models/sys-serial.ts @@ -13,7 +13,6 @@ */ import { ResetIntervalEnum } from './reset-interval-enum'; -import { SerialTypeEnum } from './serial-type-enum'; import { StatusEnum } from './status-enum'; /** * 系统流水号表 @@ -56,10 +55,12 @@ export interface SysSerial { expy: Date; /** - * @type {SerialTypeEnum} + * 使用分类 + * + * @type {string} * @memberof SysSerial */ - type: SerialTypeEnum; + type: string; /** * @type {ResetIntervalEnum} diff --git a/Web/src/api-services/system/models/update-serial-input.ts b/Web/src/api-services/system/models/update-serial-input.ts index 7ee742fb..8be06426 100644 --- a/Web/src/api-services/system/models/update-serial-input.ts +++ b/Web/src/api-services/system/models/update-serial-input.ts @@ -13,7 +13,6 @@ */ import { ResetIntervalEnum } from './reset-interval-enum'; -import { SerialTypeEnum } from './serial-type-enum'; import { StatusEnum } from './status-enum'; /** * 本地序列更新输入参数 @@ -48,10 +47,12 @@ export interface UpdateSerialInput { seq: number; /** - * @type {SerialTypeEnum} + * 使用分类 + * + * @type {string} * @memberof UpdateSerialInput */ - type: SerialTypeEnum; + type: string; /** * @type {ResetIntervalEnum} diff --git a/Web/src/views/system/serial/component/editSerial.vue b/Web/src/views/system/serial/component/editSerial.vue index 93e538cb..b0b847b4 100644 --- a/Web/src/views/system/serial/component/editSerial.vue +++ b/Web/src/views/system/serial/component/editSerial.vue @@ -16,7 +16,9 @@ - + + + @@ -98,6 +100,7 @@ const state = reactive({ loading: false, showDialog: false, previewSeqNo: '', + typeData: [] as any[], slotList: [] as any[], 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.formater ??= ''; + state.typeData = typeData; state.showDialog = true; ruleFormRef.value?.resetFields(); }; diff --git a/Web/src/views/system/serial/index.vue b/Web/src/views/system/serial/index.vue index 5dcc71c3..5e23707c 100644 --- a/Web/src/views/system/serial/index.vue +++ b/Web/src/views/system/serial/index.vue @@ -5,7 +5,9 @@ - + + + @@ -38,7 +40,7 @@ {{ commonFun.dateFormatYMDHMS(row, $index, row.expy) }}