Jelajahi Sumber

😎清理代码

zuohuaijun 1 tahun lalu
induk
melakukan
0af15c1bc9

+ 2 - 2
.gitignore

@@ -34,7 +34,7 @@ node_modules/
 /Web/package-lock.json
 /Web/public/config.js
 /Web/stats.html
+/Web/npminstall-debug.log
 .vs
 .idea
-.DS_Store
-/Web/npminstall-debug.log
+.DS_Store

+ 0 - 6
Admin.NET/Admin.NET.Application/Admin.NET.Application.csproj

@@ -32,10 +32,4 @@
     <ProjectReference Include="..\Plugins\Admin.NET.Plugin.ReZero\Admin.NET.Plugin.ReZero.csproj" />
   </ItemGroup>
 
-  <ItemGroup>
-    <Folder Include="Demo\" />
-    <Folder Include="Entity\" />
-    <Folder Include="Service\" />
-  </ItemGroup>
-
 </Project>

+ 11 - 7
Admin.NET/Admin.NET.Core/Attribute/ImportDictAttribute.cs

@@ -1,4 +1,10 @@
-namespace Admin.NET.Core;
+// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
+//
+// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
+//
+// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
+
+namespace Admin.NET.Core;
 
 /// <summary>
 /// 属性字典配置
@@ -11,10 +17,8 @@ public class ImportDictAttribute : Attribute
     /// </summary>
     public string TypeCode { get; set; }
 
-    ///// <summary>
-    ///// 目标对象类型
-    ///// </summary>
-    //public Type TargetType { get; set; }
-
+    /// <summary>
+    /// 目标对象名称
+    /// </summary>
     public string TargetPropName { get; set; }
-}
+}

+ 10 - 24
Admin.NET/Admin.NET.Core/Extension/ObjectExtension.cs

@@ -338,12 +338,12 @@ public static partial class ObjectExtension
     }
 
     /// <summary>
-    /// 将字符串转为值类型,如果没有得到或者错误返回为空
+    /// 将字符串转为值类型,没有得到或者错误返回为空
     /// </summary>
     /// <typeparam name="T">指定值类型</typeparam>
     /// <param name="str">传入字符串</param>
     /// <returns>可空值</returns>
-    public static Nullable<T> ParseTo<T>(this string str) where T : struct
+    public static T? ParseTo<T>(this string str) where T : struct
     {
         try
         {
@@ -364,9 +364,8 @@ public static partial class ObjectExtension
     }
 
     /// <summary>
-    /// 将字符串转为值类型,如果没有得到或者错误返回为空
+    /// 将字符串转为值类型,没有得到或者错误返回为空
     /// </summary>
-    /// <typeparam name="T">指定值类型</typeparam>
     /// <param name="str">传入字符串</param>
     /// <param name="type">目标类型</param>
     /// <returns>可空值</returns>
@@ -375,21 +374,17 @@ public static partial class ObjectExtension
         try
         {
             if (type.Name == "String")
-            {
                 return str;
-            }
+
             if (!string.IsNullOrWhiteSpace(str))
             {
                 var _type = type;
                 if (type.Name.StartsWith("Nullable"))
-                {
                     _type = type.GetGenericArguments()[0];
-                }
+
                 MethodInfo method = _type.GetMethod("Parse", new Type[] { typeof(string) });
                 if (method != null)
-                {
                     return method.Invoke(null, new string[] { str });
-                }
             }
         }
         catch
@@ -398,9 +393,8 @@ public static partial class ObjectExtension
         return null;
     }
 
-
     /// <summary>
-    /// 将一个的对象属性值赋给另一个制定的对象属性, 只复制相同属性的
+    /// 将一个对象属性值赋给另一个指定对象属性, 只复制相同属性的
     /// </summary>
     /// <param name="src">原数据对象</param>
     /// <param name="target">目标数据对象</param>
@@ -427,14 +421,10 @@ public static partial class ObjectExtension
                 var srcProperty = SourceType.GetProperty(item.Key);
                 if (srcProperty != null)
                 {
-                    var sourceVal = srcProperty
-                        .GetValue(src, null);
+                    var sourceVal = srcProperty.GetValue(src, null);
 
                     var tarProperty = TargetType.GetProperty(item.Value);
-                    if (tarProperty != null)
-                    {
-                        tarProperty.SetValue(target, sourceVal, null);
-                    }
+                    tarProperty?.SetValue(target, sourceVal, null);
                 }
             }
         }
@@ -447,14 +437,10 @@ public static partial class ObjectExtension
                     var srcProperty = SourceType.GetProperty(item.Key);
                     if (srcProperty != null)
                     {
-                        var sourceVal = srcProperty
-                            .GetValue(src, null);
+                        var sourceVal = srcProperty.GetValue(src, null);
 
                         var tarProperty = TargetType.GetProperty(item.Value);
-                        if (tarProperty != null)
-                        {
-                            tarProperty.SetValue(target, sourceVal, null);
-                        }
+                        tarProperty?.SetValue(target, sourceVal, null);
                     }
                 }
             }

+ 10 - 14
Admin.NET/Admin.NET.Core/Service/Common/Dto/ProcDto.cs

@@ -1,24 +1,17 @@
-// 麻省理工学院许可证
+// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
 //
-// 版权所有 (c) 2021-2023 zuohuaijun,大名科技(天津)有限公司  联系电话/微信:18020030720  QQ:515096995
+// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
 //
-// 特此免费授予获得本软件的任何人以处理本软件的权利,但须遵守以下条件:在所有副本或重要部分的软件中必须包括上述版权声明和本许可声明。
-//
-// 软件按“原样”提供,不提供任何形式的明示或暗示的保证,包括但不限于对适销性、适用性和非侵权的保证。
-// 在任何情况下,作者或版权持有人均不对任何索赔、损害或其他责任负责,无论是因合同、侵权或其他方式引起的,与软件或其使用或其他交易有关。
+// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
 
 using Magicodes.ExporterAndImporter.Core.Filters;
 using Magicodes.ExporterAndImporter.Core.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+
 namespace Admin.NET.Core.Service;
 
 /// <summary>
 /// 基础存储过程输入类
-/// </summary> 
+/// </summary>
 public class BaseProcInput
 {
     /// <summary>
@@ -27,9 +20,9 @@ public class BaseProcInput
     public string ProcId { get; set; }
 
     /// <summary>
-    /// 数据库配置ID
+    /// 数据库配置Id
     /// </summary>
-    public string ConfigId { get; set; }
+    public string ConfigId { get; set; } = SqlSugarConst.MainConfigId;
 
     /// <summary>
     /// 存储过程输入参数
@@ -56,6 +49,7 @@ public class ExportProcInput : BaseProcInput
 {
     public Dictionary<string, string> EHeader { get; set; }
 }
+
 /// <summary>
 /// 指定导出类名(有排序)存储过程输入类
 /// </summary>
@@ -70,10 +64,12 @@ public class ExportProcInput2 : BaseProcInput
 public class ProcExporterHeaderFilter : IExporterHeaderFilter
 {
     private Dictionary<string, Tuple<string, int>> _includeHeader;
+
     public ProcExporterHeaderFilter(Dictionary<string, Tuple<string, int>> includeHeader)
     {
         _includeHeader = includeHeader;
     }
+
     public ExporterHeaderInfo Filter(ExporterHeaderInfo exporterHeaderInfo)
     {
         if (_includeHeader != null && _includeHeader.Count > 0)

+ 0 - 118
Admin.NET/Admin.NET.Core/Service/Common/ProcService.cs

@@ -1,118 +0,0 @@
-// 麻省理工学院许可证
-//
-// 版权所有 (c) 2021-2023 zuohuaijun,大名科技(天津)有限公司  联系电话/微信:18020030720  QQ:515096995
-//
-// 特此免费授予获得本软件的任何人以处理本软件的权利,但须遵守以下条件:在所有副本或重要部分的软件中必须包括上述版权声明和本许可声明。
-//
-// 软件按“原样”提供,不提供任何形式的明示或暗示的保证,包括但不限于对适销性、适用性和非侵权的保证。
-// 在任何情况下,作者或版权持有人均不对任何索赔、损害或其他责任负责,无论是因合同、侵权或其他方式引起的,与软件或其使用或其他交易有关。
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Admin.NET.Core.Service;
-
-/// <summary>
-/// 存储过程服务
-/// 适用于导出、图表查询
-/// </summary>
-public class ProcService : IDynamicApiController, ITransient
-{
-
-    /// <summary>
-    /// Post导出存储过程数据,指定导出列,没有指定的字段会被隐藏
-    /// </summary>
-    /// <returns></returns>
-    [HttpGet]
-    [HttpPost]
-    public async Task<IActionResult> PocExport2(ExportProcInput input)
-    {
-        ISqlSugarClient _db = App.GetService<ISqlSugarClient>();
-        var db = _db.AsTenant().GetConnectionScope(input.ConfigId);
-        var rs = await db.Ado.UseStoredProcedure()
-                .GetDataTableAsync(input.ProcId, input.ProcParams);
-
-        var excelExporter = new Magicodes.ExporterAndImporter.Excel.ExcelExporter();
-        Dictionary<string, Tuple<string, int>> headers = new Dictionary<string, Tuple<string, int>>();
-        var i = 1;
-        foreach (var val in input.EHeader)
-        {
-            headers.Add(val.Key.ToUpper(), new Tuple<string, int>(val.Value, i));
-            i++;
-        }
-        var da = await excelExporter.ExportAsByteArray(rs, new ProcExporterHeaderFilter(headers));
-
-        return new FileContentResult(da, "application/octet-stream") { FileDownloadName = input.ProcId + ".xlsx" };
-    }
-
-    /// <summary>
-    /// 根据模板导出存储过程数据
-    /// </summary>
-    /// <returns></returns> 
-    [HttpGet]
-    [HttpPost]
-    public async Task<IActionResult> PocExport(ExportProcByTMPInput input)
-    {
-        ISqlSugarClient _db = App.GetService<ISqlSugarClient>();
-        var db = _db.AsTenant().GetConnectionScope(input.ConfigId);
-        var rs = await db.Ado.UseStoredProcedure()
-                .GetDataTableAsync(input.ProcId, input.ProcParams);
-
-        var excelExporter = new Magicodes.ExporterAndImporter.Excel.ExcelExporter();
-
-        string template = AppDomain.CurrentDomain.BaseDirectory + "/wwwroot/Template/" + input.Template + ".xlsx";
-        var bs = await excelExporter.ExportBytesByTemplate(rs, template);
-        return new FileContentResult(bs, "application/octet-stream") { FileDownloadName = input.ProcId + ".xlsx" };
-    }
-    /// <summary>
-    /// 读取存储过程返回表
-    /// 注意Oracle,达梦参数顺序不能错
-    /// </summary>
-    /// <param name="input"></param>
-    /// <returns></returns> 
-    [HttpPost]
-    public async Task<DataTable> ProcTable(BaseProcInput input)
-    { 
-        ISqlSugarClient _db = App.GetService<ISqlSugarClient>();
-        var db = _db.AsTenant().GetConnectionScope(input.ConfigId);
-        return await db.Ado.UseStoredProcedure()
-                .GetDataTableAsync(input.ProcId, input.ProcParams);
-    }
-
-    /// <summary>
-    /// 读取存储过程返回数据集
-    /// 注意Oracle,达梦参数顺序不能错;Oracle 返回table、table1,其他返回table1、table2
-    /// 适用于报表、复杂详细页面等
-    /// </summary>
-    /// <param name="input"></param>
-    /// <returns></returns>
-    [HttpPost]
-    public async Task<DataSet> CommonDataSet(BaseProcInput input)
-    {
-        ISqlSugarClient _db = App.GetService<ISqlSugarClient>();
-        var db = _db.AsTenant().GetConnectionScope(input.ConfigId);
-        return await db.Ado.UseStoredProcedure()
-            .GetDataSetAllAsync(input.ProcId, input.ProcParams);
-    }
-    /*
-     * 
-    //根据配置表读取对映存储过程
-    public async Task<DataTable> ProcEnitybyConfig(BaseProcInput input)
-    {
-        string key = "ProcConfig";
-        var ds = _sysCacheService.Get<Dictionary<string, string>>(key);
-        if (ds == null || ds.Count == 0 || !ds.ContainsKey(input.ProcId))
-        {
-            var datas = await _db.Queryable<ProcConfig>().ToListAsync();
-            ds = datas.ToDictionary(m => m.ProcId, m => m.ProcName);
-            _sysCacheService.Set(key, ds);
-        }
-        string procName = ds[input.ProcId];
-        return await _db.Ado.UseStoredProcedure()
-            .GetDataTableAsync(procName, input.ProcParams);
-    }
-    */
-}

+ 101 - 0
Admin.NET/Admin.NET.Core/Service/Common/SysProcService.cs

@@ -0,0 +1,101 @@
+// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
+//
+// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
+//
+// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
+
+namespace Admin.NET.Core.Service;
+
+/// <summary>
+/// 系统存储过程服务 🧩
+/// </summary>
+[ApiDescriptionSettings(Order = 102)]
+public class SysProcService : IDynamicApiController, ITransient
+{
+    private readonly ISqlSugarClient _db;
+
+    public SysProcService(ISqlSugarClient db)
+    {
+        _db = db;
+    }
+
+    /// <summary>
+    /// 导出存储过程数据-指定列,没有指定的字段会被隐藏 🔖
+    /// </summary>
+    /// <returns></returns>
+    public async Task<IActionResult> PocExport2(ExportProcInput input)
+    {
+        var db = _db.AsTenant().GetConnectionScope(input.ConfigId);
+        var dt = await db.Ado.UseStoredProcedure().GetDataTableAsync(input.ProcId, input.ProcParams);
+
+        var headers = new Dictionary<string, Tuple<string, int>>();
+        var index = 1;
+        foreach (var val in input.EHeader)
+        {
+            headers.Add(val.Key.ToUpper(), new Tuple<string, int>(val.Value, index));
+            index++;
+        }
+        var excelExporter = new ExcelExporter();
+        var da = await excelExporter.ExportAsByteArray(dt, new ProcExporterHeaderFilter(headers));
+        return new FileContentResult(da, "application/octet-stream") { FileDownloadName = input.ProcId + ".xlsx" };
+    }
+
+    /// <summary>
+    /// 根据模板导出存储过程数据 🔖
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    public async Task<IActionResult> PocExport(ExportProcByTMPInput input)
+    {
+        var db = _db.AsTenant().GetConnectionScope(input.ConfigId);
+        var dt = await db.Ado.UseStoredProcedure().GetDataTableAsync(input.ProcId, input.ProcParams);
+
+        var excelExporter = new ExcelExporter();
+        string template = AppDomain.CurrentDomain.BaseDirectory + "/wwwroot/Template/" + input.Template + ".xlsx";
+        var bs = await excelExporter.ExportBytesByTemplate(dt, template);
+        return new FileContentResult(bs, "application/octet-stream") { FileDownloadName = input.ProcId + ".xlsx" };
+    }
+
+    /// <summary>
+    /// 获取存储过程返回表-Oracle、达梦参数顺序不能错 🔖
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    public async Task<DataTable> ProcTable(BaseProcInput input)
+    {
+        var db = _db.AsTenant().GetConnectionScope(input.ConfigId);
+        return await db.Ado.UseStoredProcedure().GetDataTableAsync(input.ProcId, input.ProcParams);
+    }
+
+    /// <summary>
+    /// 获取存储过程返回数据集-Oracle、达梦参数顺序不能错
+    /// Oracle 返回table、table1,其他返回table1、table2。适用于报表、复杂详细页面等 🔖
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    [HttpPost]
+    public async Task<DataSet> CommonDataSet(BaseProcInput input)
+    {
+        var db = _db.AsTenant().GetConnectionScope(input.ConfigId);
+        return await db.Ado.UseStoredProcedure().GetDataSetAllAsync(input.ProcId, input.ProcParams);
+    }
+
+    ///// <summary>
+    ///// 根据配置表获取对映存储过程
+    ///// </summary>
+    ///// <param name="input"></param>
+    ///// <returns></returns>
+    //public async Task<DataTable> ProcEnitybyConfig(BaseProcInput input)
+    //{
+    //    var key = "ProcConfig";
+    //    var ds = _sysCacheService.Get<Dictionary<string, string>>(key);
+    //    if (ds == null || ds.Count == 0 || !ds.ContainsKey(input.ProcId))
+    //    {
+    //        var datas = await _db.Queryable<ProcConfig>().ToListAsync();
+    //        ds = datas.ToDictionary(m => m.ProcId, m => m.ProcName);
+    //        _sysCacheService.Set(key, ds);
+    //    }
+    //    var procName = ds[input.ProcId];
+    //    return await _db.Ado.UseStoredProcedure().GetDataTableAsync(procName, input.ProcParams);
+    //}
+}

+ 4 - 8
Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs

@@ -147,7 +147,6 @@ public class SysDictTypeService : IDynamicApiController, ITransient
         await _sysDictTypeRep.UpdateAsync(dictType);
     }
 
-
     /// <summary>
     /// 获取所有字典集合 🔖
     /// </summary>
@@ -157,13 +156,10 @@ public class SysDictTypeService : IDynamicApiController, ITransient
     public async Task<dynamic> GetAllDictList()
     {
         var ds = await _sysDictTypeRep.AsQueryable()
-            .InnerJoin<SysDictData>((m, n) => m.Id == n.DictTypeId)
-            .Where((m, n) => m.IsDelete == false && n.IsDelete == false && n.Status == StatusEnum.Enable)
-            .Select((m, n) => new { TypeCode = m.Code,  n.Code, n.Value, n.Remark, n.OrderNo,n.TagType })
+            .InnerJoin<SysDictData>((u, a) => u.Id == a.DictTypeId)
+            .Where((u, a) => u.IsDelete == false && a.IsDelete == false && a.Status == StatusEnum.Enable)
+            .Select((u, a) => new { TypeCode = u.Code, a.Code, a.Value, a.Remark, a.OrderNo, a.TagType })
             .ToListAsync();
-        return ds
-            .OrderBy(s => s.OrderNo).GroupBy(m => m.TypeCode)
-            .ToDictionary(m => m.Key, m => m);
+        return ds.OrderBy(u => u.OrderNo).GroupBy(u => u.TypeCode).ToDictionary(u => u.Key, u => u);
     }
-
 }

+ 52 - 88
Admin.NET/Admin.NET.Core/Util/ChinaDateTimeConverter.cs

@@ -1,100 +1,64 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Newtonsoft.Json.Converters;
+// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
+//
+// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
+//
+// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
+
 using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
 
-namespace Admin.NET.Core
+namespace Admin.NET.Core;
+
+/// <summary>
+/// JSON时间序列化yyyy-MM-dd HH:mm:ss
+/// </summary>
+public class ChinaDateTimeConverter : DateTimeConverterBase
 {
-    /// <summary>
-    /// JSON时间序列化yyyy-MM-dd HH:mm:ss
-    /// </summary>
-    public class ChinaDateTimeConverter : DateTimeConverterBase
+    private static readonly IsoDateTimeConverter dtConverter = new() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
+
+    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
     {
-        private static IsoDateTimeConverter dtConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
-        /// <summary>
-        /// ReadJson
-        /// </summary>
-        /// <param name="reader"></param>
-        /// <param name="objectType"></param>
-        /// <param name="existingValue"></param>
-        /// <param name="serializer"></param>
-        /// <returns></returns>
-        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
-        {
-            return dtConverter.ReadJson(reader, objectType, existingValue, serializer);
-        }
-        /// <summary>
-        /// WriteJson
-        /// </summary>
-        /// <param name="writer"></param>
-        /// <param name="value"></param>
-        /// <param name="serializer"></param>
-        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
-        {
-            dtConverter.WriteJson(writer, value, serializer);
-        }
+        return dtConverter.ReadJson(reader, objectType, existingValue, serializer);
     }
 
-    /// <summary>
-    /// JSON时间序列化yyyy-MM-dd HH:mm
-    /// </summary>
-    public class ChinaDateTimeConverterHH : DateTimeConverterBase
+    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
     {
-        private static IsoDateTimeConverter dtConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm" };
-        /// <summary>
-        /// ReadJson
-        /// </summary>
-        /// <param name="reader"></param>
-        /// <param name="objectType"></param>
-        /// <param name="existingValue"></param>
-        /// <param name="serializer"></param>
-        /// <returns></returns>
-        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
-        {
-            return dtConverter.ReadJson(reader, objectType, existingValue, serializer);
-        }
-        /// <summary>
-        /// WriteJson
-        /// </summary>
-        /// <param name="writer"></param>
-        /// <param name="value"></param>
-        /// <param name="serializer"></param>
-        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
-        {
-            dtConverter.WriteJson(writer, value, serializer);
-        }
+        dtConverter.WriteJson(writer, value, serializer);
     }
+}
+
+/// <summary>
+/// JSON时间序列化yyyy-MM-dd HH:mm
+/// </summary>
+public class ChinaDateTimeConverterHH : DateTimeConverterBase
+{
+    private static readonly IsoDateTimeConverter dtConverter = new() { DateTimeFormat = "yyyy-MM-dd HH:mm" };
 
-    /// <summary>
-    /// JSON时间序列化yyyy-MM-dd
-    /// </summary>
-    public class ChinaDateTimeConverterDate : DateTimeConverterBase
+    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
     {
-        private static IsoDateTimeConverter dtConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd" };
-        /// <summary>
-        /// ReadJson
-        /// </summary>
-        /// <param name="reader"></param>
-        /// <param name="objectType"></param>
-        /// <param name="existingValue"></param>
-        /// <param name="serializer"></param>
-        /// <returns></returns>
-        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
-        {
-            return dtConverter.ReadJson(reader, objectType, existingValue, serializer);
-        }
-        /// <summary>
-        /// WriteJson
-        /// </summary>
-        /// <param name="writer"></param>
-        /// <param name="value"></param>
-        /// <param name="serializer"></param>
-        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
-        {
-            dtConverter.WriteJson(writer, value, serializer);
-        }
+        return dtConverter.ReadJson(reader, objectType, existingValue, serializer);
+    }
+
+    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+    {
+        dtConverter.WriteJson(writer, value, serializer);
     }
 }
+
+/// <summary>
+/// JSON时间序列化yyyy-MM-dd
+/// </summary>
+public class ChinaDateTimeConverterDate : DateTimeConverterBase
+{
+    private static readonly IsoDateTimeConverter dtConverter = new() { DateTimeFormat = "yyyy-MM-dd" };
+
+    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+    {
+        return dtConverter.ReadJson(reader, objectType, existingValue, serializer);
+    }
+
+    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+    {
+        dtConverter.WriteJson(writer, value, serializer);
+    }
+}

+ 55 - 77
Admin.NET/Admin.NET.Core/Util/CommonUtil.cs

@@ -104,12 +104,12 @@ public static class CommonUtil
     /// 导出模板Excel
     /// </summary>
     /// <returns></returns>
-    public static async Task<IActionResult> ExportExcelTemplate<T>() where T : class,new()
-    { 
+    public static async Task<IActionResult> ExportExcelTemplate<T>() where T : class, new()
+    {
         IImporter importer = new ExcelImporter();
-        var res=await importer.GenerateTemplateBytes<T>();  
+        var res = await importer.GenerateTemplateBytes<T>();
 
-        return new FileContentResult(res, "application/octet-stream") { FileDownloadName = typeof(T).Name+".xlsx" };
+        return new FileContentResult(res, "application/octet-stream") { FileDownloadName = typeof(T).Name + ".xlsx" };
     }
 
     /// <summary>
@@ -128,10 +128,10 @@ public static class CommonUtil
     /// 导出数据excel,包括字典转换
     /// </summary>
     /// <returns></returns>
-    public static async Task<IActionResult> ExportExcelData<TSource, TTarget>(ISugarQueryable<TSource> query, Func<TSource, TTarget, TTarget> action = null) 
-        where TSource : class, new() where TTarget : class, new ()
+    public static async Task<IActionResult> ExportExcelData<TSource, TTarget>(ISugarQueryable<TSource> query, Func<TSource, TTarget, TTarget> action = null)
+        where TSource : class, new() where TTarget : class, new()
     {
-        var PropMappings = GetExportPropertMap< TSource, TTarget >(); 
+        var PropMappings = GetExportPropertMap<TSource, TTarget>();
         var data = query.ToList();
         //相同属性复制值,字典值转换
         var result = new List<TTarget>();
@@ -173,9 +173,9 @@ public static class CommonUtil
                 {
                     newData = action(item, newData);
                 }
-            } 
+            }
             result.Add(newData);
-        } 
+        }
         var export = new ExcelExporter();
         var res = await export.ExportAsByteArray(result);
 
@@ -185,13 +185,13 @@ public static class CommonUtil
     /// <summary>
     /// 导入数据Excel
     /// </summary>
-    /// <param name="file"></param> 
+    /// <param name="file"></param>
     /// <returns></returns>
     public static async Task<ICollection<T>> ImportExcelData<T>([Required] IFormFile file) where T : class, new()
-    {  
+    {
         IImporter importer = new ExcelImporter();
         var res = await importer.Import<T>(file.OpenReadStream());
-        string message = string.Empty;
+        var message = string.Empty;
         if (res.HasError)
         {
             if (res.Exception != null)
@@ -203,13 +203,12 @@ public static class CommonUtil
                     message += $"\r\n{item.Key}:{item.Value}(文件第{drErrorInfo.RowIndex}行)";
             }
             message += "字段缺失:" + string.Join(",", res.TemplateErrors.Select(m => m.RequireColumnName).ToList());
-
             throw Oops.Oh("导入异常:" + message);
         }
         return res.Data;
     }
 
-    //例:List<Dm_ApplyDemo> ls = CommonUtil.ParseList<Dm_ApplyDemoInport, Dm_ApplyDemo>(importResult.Data);
+    // 例:List<Dm_ApplyDemo> ls = CommonUtil.ParseList<Dm_ApplyDemoInport, Dm_ApplyDemo>(importResult.Data);
     /// <summary>
     /// 对象转换 含字典转换
     /// </summary>
@@ -218,15 +217,15 @@ public static class CommonUtil
     /// <param name="data"></param>
     /// <param name="action"></param>
     /// <returns></returns>
-    public static List<TTarget> ParseList<TSource, TTarget>(IEnumerable<TSource> data, Func<TSource, TTarget, TTarget> action=null) where TTarget : new()
+    public static List<TTarget> ParseList<TSource, TTarget>(IEnumerable<TSource> data, Func<TSource, TTarget, TTarget> action = null) where TTarget : new()
     {
-        Dictionary<string, Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>> PropMappings = GetImportPropertMap<TSource, TTarget>();
-        //相同属性复制值,字典值转换
+        var propMappings = GetImportPropertMap<TSource, TTarget>();
+        // 相同属性复制值,字典值转换
         var result = new List<TTarget>();
         foreach (var item in data)
         {
             var newData = new TTarget();
-            foreach (var dict in PropMappings)
+            foreach (var dict in propMappings)
             {
                 var targeProp = dict.Value.Item3;
                 if (targeProp != null)
@@ -234,9 +233,7 @@ public static class CommonUtil
                     var propertyInfo = dict.Value.Item2;
                     var sourceVal = propertyInfo.GetValue(item, null);
                     if (sourceVal == null)
-                    {
                         continue;
-                    }
 
                     var map = dict.Value.Item1;
                     if (map != null && map.ContainsKey(sourceVal.ToString()))
@@ -259,40 +256,35 @@ public static class CommonUtil
                 }
             }
             if (action != null)
-            {
                 newData = action(item, newData);
-            }
+
             if (newData != null)
                 result.Add(newData);
         }
         return result;
     }
 
-
     /// <summary>
-    /// 获取导入属性映射       
+    /// 获取导入属性映射
     /// </summary>
     /// <typeparam name="TSource"></typeparam>
     /// <typeparam name="TTarget"></typeparam>
     /// <returns>整理导入对象的 属性名称, 字典数据,原属性信息,目标属性信息 </returns>
     private static Dictionary<string, Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>> GetImportPropertMap<TSource, TTarget>() where TTarget : new()
     {
-        var dictService = App.GetService<SqlSugarRepository<SysDictData>>();
-        //整理导入对象的 属性名称,<字典数据,原属性信息,目标属性信息>
-        Dictionary<string, Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>> PropMappings =
-        new Dictionary<string, Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>>();
+        // 整理导入对象的属性名称,<字典数据,原属性信息,目标属性信息>
+        var propMappings = new Dictionary<string, Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>>();
 
-        var TSourceProps = typeof(TSource).GetProperties().ToList();
-        var TTargetProps = typeof(TTarget).GetProperties().ToDictionary(m => m.Name);
-
-        foreach (var propertyInfo in TSourceProps)
+        var dictService = App.GetService<SqlSugarRepository<SysDictData>>();
+        var tSourceProps = typeof(TSource).GetProperties().ToList();
+        var tTargetProps = typeof(TTarget).GetProperties().ToDictionary(m => m.Name);
+        foreach (var propertyInfo in tSourceProps)
         {
             var attrs = propertyInfo.GetCustomAttribute<ImportDictAttribute>();
             if (attrs != null && !string.IsNullOrWhiteSpace(attrs.TypeCode))
             {
-                var targetProp = TTargetProps[attrs.TargetPropName];
-
-                var MappingValues = dictService.Context.Queryable<SysDictType, SysDictData>((a, b) =>
+                var targetProp = tTargetProps[attrs.TargetPropName];
+                var mappingValues = dictService.Context.Queryable<SysDictType, SysDictData>((a, b) =>
                     new JoinQueryInfos(JoinType.Inner, a.Id == b.DictTypeId))
                     .Where(a => a.Code == attrs.TypeCode)
                     .Where((a, b) => a.Status == StatusEnum.Enable && b.Status == StatusEnum.Enable)
@@ -302,47 +294,39 @@ public static class CommonUtil
                         Value = b.Code
                     }).ToList()
                     .ToDictionary(m => m.Label, m => m.Value.ParseTo(targetProp.PropertyType));
-                PropMappings.Add(propertyInfo.Name, new Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>(
-                    MappingValues, propertyInfo, targetProp
-                    ));
+                propMappings.Add(propertyInfo.Name, new Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>(mappingValues, propertyInfo, targetProp));
             }
             else
             {
-                PropMappings.Add(propertyInfo.Name, new Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>(
-                    null, propertyInfo, TTargetProps.ContainsKey(propertyInfo.Name) ? TTargetProps[propertyInfo.Name] : null
-                    ));
+                propMappings.Add(propertyInfo.Name, new Tuple<Dictionary<string, object>, PropertyInfo, PropertyInfo>(
+                    null, propertyInfo, tTargetProps.ContainsKey(propertyInfo.Name) ? tTargetProps[propertyInfo.Name] : null));
             }
         }
 
-        return PropMappings;
+        return propMappings;
     }
 
-
-
     /// <summary>
-    /// 获取导出属性映射       
+    /// 获取导出属性映射
     /// </summary>
     /// <typeparam name="TSource"></typeparam>
     /// <typeparam name="TTarget"></typeparam>
     /// <returns>整理导入对象的 属性名称, 字典数据,原属性信息,目标属性信息 </returns>
-    private static Dictionary<string, Tuple<Dictionary<object,string>, PropertyInfo, PropertyInfo>> GetExportPropertMap<TSource, TTarget>() where TTarget : new()
+    private static Dictionary<string, Tuple<Dictionary<object, string>, PropertyInfo, PropertyInfo>> GetExportPropertMap<TSource, TTarget>() where TTarget : new()
     {
-        var dictService = App.GetService<SqlSugarRepository<SysDictData>>();
-        //整理导入对象的 属性名称,<字典数据,原属性信息,目标属性信息>
-        Dictionary<string, Tuple<Dictionary<object,string>, PropertyInfo, PropertyInfo>> PropMappings =
-        new Dictionary<string, Tuple<Dictionary<object,string>, PropertyInfo, PropertyInfo>>();
-
-        var TargetProps = typeof(TTarget).GetProperties().ToList();
-        var SourceProps = typeof(TSource).GetProperties().ToDictionary(m => m.Name);
+        // 整理导入对象的属性名称,<字典数据,原属性信息,目标属性信息>
+        var propMappings = new Dictionary<string, Tuple<Dictionary<object, string>, PropertyInfo, PropertyInfo>>();
 
-        foreach (var propertyInfo in TargetProps)
+        var dictService = App.GetService<SqlSugarRepository<SysDictData>>();
+        var targetProps = typeof(TTarget).GetProperties().ToList();
+        var sourceProps = typeof(TSource).GetProperties().ToDictionary(m => m.Name);
+        foreach (var propertyInfo in targetProps)
         {
             var attrs = propertyInfo.GetCustomAttribute<ImportDictAttribute>();
             if (attrs != null && !string.IsNullOrWhiteSpace(attrs.TypeCode))
             {
-                var targetProp = SourceProps[attrs.TargetPropName];
-
-                var MappingValues = dictService.Context.Queryable<SysDictType, SysDictData>((a, b) =>
+                var targetProp = sourceProps[attrs.TargetPropName];
+                var mappingValues = dictService.Context.Queryable<SysDictType, SysDictData>((a, b) =>
                     new JoinQueryInfos(JoinType.Inner, a.Id == b.DictTypeId))
                     .Where(a => a.Code == attrs.TypeCode)
                     .Where((a, b) => a.Status == StatusEnum.Enable && b.Status == StatusEnum.Enable)
@@ -352,43 +336,37 @@ public static class CommonUtil
                         Value = b.Code
                     }).ToList()
                     .ToDictionary(m => m.Value.ParseTo(targetProp.PropertyType), m => m.Label);
-                PropMappings.Add(propertyInfo.Name, new Tuple<Dictionary<object,string>, PropertyInfo, PropertyInfo>(
-                    MappingValues, targetProp, propertyInfo
-                    ));
+                propMappings.Add(propertyInfo.Name, new Tuple<Dictionary<object, string>, PropertyInfo, PropertyInfo>(mappingValues, targetProp, propertyInfo));
             }
             else
             {
-                PropMappings.Add(propertyInfo.Name, new Tuple<Dictionary<object,string>, PropertyInfo, PropertyInfo>(
-                    null, SourceProps.ContainsKey(propertyInfo.Name) ? SourceProps[propertyInfo.Name] : null, propertyInfo
-                    ));
+                propMappings.Add(propertyInfo.Name, new Tuple<Dictionary<object, string>, PropertyInfo, PropertyInfo>(
+                    null, sourceProps.ContainsKey(propertyInfo.Name) ? sourceProps[propertyInfo.Name] : null, propertyInfo));
             }
         }
 
-        return PropMappings;
+        return propMappings;
     }
 
-
     /// <summary>
-    /// 获取属性映射       
+    /// 获取属性映射
     /// </summary>
-    /// <typeparam name="TSource"></typeparam>
     /// <typeparam name="TTarget"></typeparam>
     /// <returns>整理导入对象的 属性名称, 字典数据,原属性信息,目标属性信息 </returns>
-    private static Dictionary<string, Tuple<string, string>> GetExportDicttMap<  TTarget>() where TTarget : new()
+    private static Dictionary<string, Tuple<string, string>> GetExportDicttMap<TTarget>() where TTarget : new()
     {
-        var dictService = App.GetService<SqlSugarRepository<SysDictData>>();
-        //整理导入对象的 属性名称,目标属性名,字典Code
-        Dictionary<string, Tuple<string, string>> PropMappings = new Dictionary<string, Tuple<string, string>>(); 
-        var TTargetProps = typeof(TTarget).GetProperties(); 
-        foreach (var propertyInfo in TTargetProps)
+        // 整理导入对象的属性名称,目标属性名,字典Code
+        var propMappings = new Dictionary<string, Tuple<string, string>>();
+        var tTargetProps = typeof(TTarget).GetProperties();
+        foreach (var propertyInfo in tTargetProps)
         {
             var attrs = propertyInfo.GetCustomAttribute<ImportDictAttribute>();
             if (attrs != null && !string.IsNullOrWhiteSpace(attrs.TypeCode))
-            { 
-                PropMappings.Add(propertyInfo.Name, new Tuple<string, string>(  attrs.TargetPropName,attrs.TypeCode  )); 
-            } 
+            {
+                propMappings.Add(propertyInfo.Name, new Tuple<string, string>(attrs.TargetPropName, attrs.TypeCode));
+            }
         }
 
-        return PropMappings;
+        return propMappings;
     }
 }

+ 1 - 1
Admin.NET/Plugins/Admin.NET.Plugin.ReZero/Admin.NET.Plugin.ReZero.csproj

@@ -24,7 +24,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Rezero.Api" Version="1.0.46" />
+    <PackageReference Include="Rezero.Api" Version="1.0.48" />
   </ItemGroup>  
 
   <ItemGroup>

+ 3 - 3
Web/package.json

@@ -22,13 +22,14 @@
 		"@wangeditor/editor": "^5.1.23",
 		"@wangeditor/editor-for-vue": "^5.1.12",
 		"animate.css": "^4.1.1",
+		"async-validator": "^4.2.5",
 		"axios": "^1.6.8",
 		"countup.js": "^2.8.0",
 		"cropperjs": "^1.6.2",
 		"echarts": "^5.5.0",
 		"echarts-gl": "^2.0.9",
 		"echarts-wordcloud": "^2.1.0",
-		"element-plus": "^2.7.2",
+		"element-plus": "^2.7.3",
 		"js-cookie": "^3.0.5",
 		"js-table2excel": "^1.1.2",
 		"jsplumb": "^2.15.6",
@@ -58,8 +59,7 @@
 		"vue-router": "^4.3.2",
 		"vue-signature-pad": "^3.0.2",
 		"vue3-tree-org": "^4.2.2",
-		"xlsx-js-style": "^1.2.0",
-		"async-validator": "^4.2.5"
+		"xlsx-js-style": "^1.2.0"
 	},
 	"devDependencies": {
 		"@plugin-web-update-notification/vite": "^1.7.1",

+ 28 - 30
Web/src/components/importButton/index.vue

@@ -1,37 +1,36 @@
 <template>
-	<input class="el-upload__input" ref="reffile" name="file" @change="fileChange($event)" :accept="$props.accept" type="file">
-	<el-button  icon="ele-Upload" @click="onClick">
+	<input class="el-upload__input" ref="reffile" name="file" @change="fileChange($event)" :accept="$props.accept" type="file" />
+	<el-button icon="ele-Upload" @click="onClick">
 		<slot></slot>
 	</el-button>
 </template>
 
 <script setup lang="ts" name="ImportButton">
-
 import { reactive, ref, onMounted, watch } from 'vue';
-import {request2} from '/@/utils/request';
+import { request2 } from '/@/utils/request';
 import { ElMessage } from 'element-plus';
 
 // 定义父组件传过来的值
 const props = defineProps({
 	accept: {
-		type: String, 
+		type: String,
 	},
 	param: {
 		type: Object,
 		default: () => {},
 	},
 	url: {
-		type: String, 
-	},  
+		type: String,
+	},
 });
 
 // 定义子组件向父组件传值/事件
 const emit = defineEmits(['success', 'error']);
-const reffile=ref();
-// 定义变量内容 
+const reffile = ref();
 const state = reactive({
 	form: {} as any,
-	});
+});
+
 watch(
 	() => props.param,
 	(value) => {
@@ -49,34 +48,33 @@ watch(
 const onClick = () => {
 	reffile.value.click();
 };
-function fileChange(event) { 
-	if(!event.currentTarget.files 
-	|| event.currentTarget.files.length==0){
+
+function fileChange(event: any) {
+	if (!event.currentTarget.files || event.currentTarget.files.length == 0) {
 		return;
 	}
-	var file=event.currentTarget.files[0];
-	let formData = new FormData()
-  	formData.append('file', file)
-	for (const key in  state.form) {
+	var file = event.currentTarget.files[0];
+	let formData = new FormData();
+	formData.append('file', file);
+	for (const key in state.form) {
 		const element = state.form[key];
-		formData.append(key, element)
+		formData.append(key, element);
 	}
 	request2({
 		url: props.url,
 		method: 'post',
-		data:formData,
+		data: formData,
 		headers: {
-			'Content-Type': 'multipart/form-data'
+			'Content-Type': 'multipart/form-data',
 		},
-	}).then((res)=>{
-		console.log(res);
-		ElMessage.success(res);
-		reffile.value.files=null;
-		emit('success',res)
-	}).catch((res)=>{ 
-		console.log('上传错误',res)
-		alert('上传错误')
-	});
+	})
+		.then((res: any) => {
+			ElMessage.success(res);
+			reffile.value.files = null;
+			emit('success', res);
+		})
+		.catch((res: any) => {
+			alert('上传错误');
+		});
 }
 </script>
- 

+ 11 - 8
Web/src/components/table/TableEditor.vue

@@ -38,11 +38,13 @@
 		</table>
 	</div>
 </template>
+
 <script lang="ts" setup>
 import { reactive } from 'vue';
 import { ElMessage, dayjs } from 'element-plus';
-import AsyncValidator from 'async-validator'; 
+import AsyncValidator from 'async-validator';
 import { isDate, isString } from 'lodash-es';
+
 const props = defineProps({
 	value: {
 		type: Array<any>,
@@ -76,11 +78,13 @@ function renderComponentProp(item: any) {
 
 	return propsData;
 }
+
 function del(record: any, index: number) {
 	vm.value.splice(index, 1);
 	emit('update:value', vm.value);
 	emit('delete', { value: vm.value, record });
 }
+
 async function add() {
 	let msgs: string[] = [];
 
@@ -88,13 +92,12 @@ async function add() {
 		let rule = props.rules[field];
 
 		let val = vm.formData[field];
-		if(val){
-			if(isDate(val) ){
-				val=dayjs(val).format(props.columns.filter(m=>m.field==field)[0]
-				.format|| 'YYYY-MM-DD'); 
-				vm.formData[field]=val;
-			}else if (!isString(val)) {
-				val= val.toString();
+		if (val) {
+			if (isDate(val)) {
+				val = dayjs(val).format(props.columns.filter((m) => m.field == field)[0].format || 'YYYY-MM-DD');
+				vm.formData[field] = val;
+			} else if (!isString(val)) {
+				val = val.toString();
 			}
 		}
 		const validator = new AsyncValidator({

+ 18 - 11
Web/src/stores/userInfo.ts

@@ -26,8 +26,8 @@ export const useUserInfo = defineStore('userInfo', {
 		// },
 	},
 	actions: {
+		// 存储用户信息到浏览器缓存
 		async setUserInfos() {
-			// 存储用户信息到浏览器缓存
 			if (Session.get('userInfo')) {
 				this.userInfos = Session.get('userInfo');
 			} else {
@@ -35,8 +35,9 @@ export const useUserInfo = defineStore('userInfo', {
 				this.userInfos = userInfos;
 			}
 		},
+
+		// 存储常量信息到浏览器缓存
 		async setConstList() {
-			// 存储常量信息到浏览器缓存
 			if (Session.get('constList')) {
 				this.constList = Session.get('constList');
 			} else {
@@ -45,8 +46,9 @@ export const useUserInfo = defineStore('userInfo', {
 				this.constList = constList;
 			}
 		},
+
+		// 存储字典信息到浏览器缓存
 		async setDictList() {
-			// 存储字典信息到浏览器缓存
 			var res = await getAPI(SysDictTypeApi).apiSysDictTypeAllDictListGet();
 			this.dictList = res.data.result;
 			// if (Session.get('dictList')) {
@@ -57,6 +59,7 @@ export const useUserInfo = defineStore('userInfo', {
 			//	this.dictList = dictList;
 			// }
 		},
+
 		// 获取当前用户信息
 		getApiUserInfo() {
 			return new Promise((resolve) => {
@@ -105,6 +108,7 @@ export const useUserInfo = defineStore('userInfo', {
 					});
 			});
 		},
+
 		// 获取常量集合
 		getSysConstList() {
 			return new Promise((resolve) => {
@@ -115,6 +119,7 @@ export const useUserInfo = defineStore('userInfo', {
 					});
 			});
 		},
+
 		// 获取字典集合
 		getAllDictList() {
 			return new Promise((resolve) => {
@@ -130,9 +135,9 @@ export const useUserInfo = defineStore('userInfo', {
 			});
 		},
 
-		//根据字典类型和值取字典项
+		// 根据字典类型和值取字典项
 		getDictItemByVal(typePCode: string, val: string) {
-			if(val){
+			if (val) {
 				const _val = val.toString();
 				const ds = this.getDictDatasByCode(typePCode);
 				for (let index = 0; index < ds.length; index++) {
@@ -145,13 +150,14 @@ export const useUserInfo = defineStore('userInfo', {
 			return {};
 		},
 
-		//根据字典类型和值取描述
+		// 根据字典类型和值取描述
 		getDictLabelByVal(typePCode: string, val: string) {
 			return this.getDictItemByVal(typePCode, val).value;
 		},
-		//根据字典类型和描述取值
+
+		// 根据字典类型和描述取值
 		getDictValByLabel(typePCode: string, label: string) {
-			if(!label) return ''
+			if (!label) return '';
 			const ds = this.getDictDatasByCode(typePCode);
 			for (let index = 0; index < ds.length; index++) {
 				const element = ds[index];
@@ -160,19 +166,20 @@ export const useUserInfo = defineStore('userInfo', {
 				}
 			}
 		},
-		//根据字典类型字典数据
+
+		// 根据字典类型字典数据
 		getDictDatasByCode(dictTypeCode: string) {
 			return this.dictList[dictTypeCode] || [];
 		},
 
-		//根据字典类型字典数据,值转为数字类型
+		// 根据字典类型字典数据,值转为数字类型
 		getDictIntDatasByCode(dictTypeCode: string) {
 			var ds = this.dictListInt[dictTypeCode];
 			if (ds) {
 				return ds;
 			} else {
 				ds = this.dictList[dictTypeCode].map((element: { code: any }) => {
-					var d={...element};
+					var d = { ...element };
 					d.code = element.code - 0;
 					return d;
 				});

+ 1 - 1
Web/src/types/pinia.d.ts

@@ -15,7 +15,7 @@ declare interface UserInfosState {
 	userInfos: UserInfos;
 	constList: T[];
 	dictList: T;
-	dictListInt :T;
+	dictListInt: T;
 }
 
 // 路由缓存列表

+ 2 - 2
Web/src/utils/axios-utils.ts

@@ -26,8 +26,8 @@ export const getToken = () => {
 	return Local.get(accessTokenKey);
 };
 
-// 获取上传文件Header
-export const getHeader  = () => {
+// 获取请求头 token
+export const getHeader = () => {
 	return { authorization: 'Bearer ' + getToken() };
 };
 

+ 18 - 17
Web/src/utils/dict-utils.ts

@@ -1,7 +1,6 @@
 import { useUserInfo } from '/@/stores/userInfo';
 
-
-const stores = useUserInfo(); 
+const stores = useUserInfo();
 
 // 用于在 Table 中把字段的代码转换为名称,示例如下:
 /*
@@ -13,17 +12,18 @@ import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-util
     </template>
 </el-table-column>
 */
-export function getDictDataItem(dicName:string, dicItemCode:any): any{
-    return stores.getDictItemByVal(dicName,dicItemCode)
-}
-export function getDictValByLabel(dicName:string, dicItemCode:any): any{
-    return stores.getDictValByLabel(dicName,dicItemCode)
+
+export function getDictDataItem(dicName: string, dicItemCode: any): any {
+	return stores.getDictItemByVal(dicName, dicItemCode);
 }
 
-export function getDictLabelByVal(dicName:string, dicItemCode:any): any{
-    return stores.getDictLabelByVal(dicName,dicItemCode)
+export function getDictValByLabel(dicName: string, dicItemCode: any): any {
+	return stores.getDictValByLabel(dicName, dicItemCode);
 }
 
+export function getDictLabelByVal(dicName: string, dicItemCode: any): any {
+	return stores.getDictLabelByVal(dicName, dicItemCode);
+}
 
 // select 控件使用,用于获取字典列表,示例如下:
 /*
@@ -33,15 +33,16 @@ import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-util
     <el-option v-for="(item,index) in  dl('字段名名码')"  :key="index" :value="item.code" :label="`[${item.code}] ${item.value}`"></el-option>
 </el-select>
 */
-export function getDictType(dicName:string): any{ 
-    
-    return stores.dictList[dicName];
+
+export function getDictType(dicName: string): any {
+	return stores.dictList[dicName];
 }
 
-export function getDictDataList(dicName:string): any{
-    return stores.getDictDatasByCode(dicName);
+export function getDictDataList(dicName: string): any {
+	return stores.getDictDatasByCode(dicName);
 }
-//获取数字类型的
-export function getDictDataListInt(dicName:string): any{
-    return stores.getDictIntDatasByCode(dicName);
+
+// 获取数字类型的
+export function getDictDataListInt(dicName: string): any {
+	return stores.getDictIntDatasByCode(dicName);
 }

+ 4 - 3
Web/src/utils/request.ts

@@ -1,4 +1,4 @@
-import axios, { AxiosInstance,AxiosRequestConfig } from 'axios';
+import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';
 import { ElMessage } from 'element-plus';
 import { Local, Session } from '/@/utils/storage';
 
@@ -130,7 +130,7 @@ service.interceptors.response.use(
 			ElMessage({
 				dangerouslyUseHTMLString: true,
 				message: message,
-				type:'error'
+				type: 'error',
 			});
 			throw new Error(message);
 		}
@@ -205,13 +205,14 @@ export function decryptJWT(token: string): any {
 export function getJWTDate(timestamp: number): Date {
 	return new Date(timestamp * 1000);
 }
+
 /**
  * Ajax请求,如果成功返回result字段,如果不成功提示错误信息
  * @description Ajax请求
  * @config AxiosRequestConfig 请求参数
  * @returns 返回对象
  */
-export function request2(config: AxiosRequestConfig<any>): any { 
+export function request2(config: AxiosRequestConfig<any>): any {
 	return new Promise((resolve, reject) => {
 		service(config)
 			.then((res) => {