Explorar el Código

😎1、枚举转字典时增加排序 2、调整首页控制台样式

zuohuaijun hace 1 año
padre
commit
bfe43240b3

+ 42 - 45
Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs

@@ -29,13 +29,14 @@ public class EnumToDictJob : IJob
         var db = serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>().CopyNew();
 
         var enumTypeList = sysEnumService.GetEnumTypeList();
-        var enumCodeList = enumTypeList.Select(x => x.TypeName);
-        var sysDictTypeCodeList = await db.Queryable<SysDictType>().Where(x => enumCodeList.Contains(x.Code)).Select(x => x.Code).ToListAsync(stoppingToken);
-        // 更新的
-        var uEnumType = enumTypeList.Where(x => sysDictTypeCodeList.Contains(x.TypeName)).ToList();
-        var waitUpdateSysDictType = await db.Queryable<SysDictType>().Where(x => uEnumType.Any(y => y.TypeName == x.Code)).ToListAsync(stoppingToken);
-        var waitUpdateSysDictTypeDict = waitUpdateSysDictType.ToDictionary(x => x.Code, x => x);
-        var waitUpdateSysDictData = await db.Queryable<SysDictData>().Where(x => uEnumType.Any(y => y.TypeName == x.DictType.Code)).ToListAsync(stoppingToken);
+        var enumCodeList = enumTypeList.Select(u => u.TypeName);
+        var sysDictTypeCodeList = await db.Queryable<SysDictType>().Where(u => enumCodeList.Contains(u.Code)).Select(u => u.Code).ToListAsync(stoppingToken);
+
+        // 更新的枚举转换字典
+        var uEnumType = enumTypeList.Where(u => sysDictTypeCodeList.Contains(u.TypeName)).ToList();
+        var waitUpdateSysDictType = await db.Queryable<SysDictType>().Where(u => uEnumType.Any(a => a.TypeName == u.Code)).ToListAsync(stoppingToken);
+        var waitUpdateSysDictTypeDict = waitUpdateSysDictType.ToDictionary(u => u.Code, u => u);
+        var waitUpdateSysDictData = await db.Queryable<SysDictData>().Where(u => uEnumType.Any(a => a.TypeName == u.DictType.Code)).ToListAsync(stoppingToken);
         var uSysDictType = new List<SysDictType>();
         var uSysDictData = new List<SysDictData>();
         if (uEnumType.Count > 0)
@@ -47,73 +48,70 @@ public class EnumToDictJob : IJob
                     var uDictType = value;
                     uDictType.Name = e.TypeDescribe;
                     uDictType.Remark = e.TypeRemark;
-                    var uDictData = waitUpdateSysDictData.Where(x => x.DictTypeId == uDictType.Id).ToList();
+                    var uDictData = waitUpdateSysDictData.Where(u => u.DictTypeId == uDictType.Id).ToList();
                     if (uDictData.Count > 0)
                     {
-                        uDictData.ForEach(d =>
+                        uDictData.ForEach(dictData =>
                         {
-                            var enumData = e.EnumEntities.Where(x => d.Code == x.Name).FirstOrDefault();
+                            var enumData = e.EnumEntities.Where(u => dictData.Code == u.Name).FirstOrDefault();
                             if (enumData != null)
                             {
-                                d.Value = enumData.Value.ToString();
-                                d.Code = enumData.Name;
-                                uSysDictData.Add(d);
+                                dictData.Value = enumData.Value.ToString();
+                                dictData.Code = enumData.Name;
+                                dictData.OrderNo = enumData.Value + 10;
+                                uSysDictData.Add(dictData);
                             }
                         });
                     }
-                    if (!uSysDictType.Any(x => x.Id == uDictType.Id))
-                    {
+                    if (!uSysDictType.Any(u => u.Id == uDictType.Id))
                         uSysDictType.Add(uDictType);
-                    }
                 }
             });
             try
             {
                 db.Ado.BeginTran();
+
                 if (uSysDictType.Count > 0)
-                {
                     await db.Updateable(uSysDictType).ExecuteCommandAsync(stoppingToken);
-                }
+
                 if (uSysDictData.Count > 0)
-                {
                     await db.Updateable(uSysDictData).ExecuteCommandAsync(stoppingToken);
-                }
+
                 db.Ado.CommitTran();
             }
             catch (Exception error)
             {
                 db.Ado.RollbackTran();
-                Log.Error($"{context.Trigger.Description}错误:" + _jsonSerializer.Serialize(error));
-                throw new Exception($"{context.Trigger.Description}错误");
+                Log.Error($"{context.Trigger.Description}更新枚举转换字典入库错误:" + _jsonSerializer.Serialize(error));
+                throw new Exception($"{context.Trigger.Description}更新枚举转换字典入库错误");
             }
         }
-        // 添加的
-        var iEnumType = enumTypeList.Where(x => !sysDictTypeCodeList.Contains(x.TypeName)).ToList();
+
+        // 新增的枚举转换字典
+        var iEnumType = enumTypeList.Where(u => !sysDictTypeCodeList.Contains(u.TypeName)).ToList();
         if (iEnumType.Count > 0)
         {
-            // 需要新增字典类型
-            var iDictType = iEnumType.Select(x => new SysDictType
+            // 新增字典类型
+            var iDictType = iEnumType.Select(u => new SysDictType
             {
                 Id = YitIdHelper.NextId(),
-                Code = x.TypeName,
-                Name = x.TypeDescribe,
-                Remark = x.TypeRemark,
-                Status = StatusEnum.Enable,
-                OrderNo = 100
+                Code = u.TypeName,
+                Name = u.TypeDescribe,
+                Remark = u.TypeRemark,
+                Status = StatusEnum.Enable
             }).ToList();
-            // 需要新增字典数据
+            // 新增字典数据
             var dictData = iEnumType.Join(iDictType, t1 => t1.TypeName, t2 => t2.Code, (t1, t2) => new
             {
-                data = t1.EnumEntities.Select(x => new SysDictData
+                data = t1.EnumEntities.Select(u => new SysDictData
                 {
-                    // 性能优化,使用BulkCopyAsync必须手动获取Id
-                    Id = YitIdHelper.NextId(),
+                    Id = YitIdHelper.NextId(), // 性能优化,使用BulkCopyAsync必须手动获取Id
                     DictTypeId = t2.Id,
-                    Name = x.Describe,
-                    Value = x.Value.ToString(),
-                    Code = x.Name,
+                    Name = u.Describe,
+                    Value = u.Value.ToString(),
+                    Code = u.Name,
                     Remark = t2.Remark,
-                    OrderNo = 100,
+                    OrderNo = u.Value + 10,
                     TagType = "info"
                 }).ToList()
             }).ToList();
@@ -125,21 +123,20 @@ public class EnumToDictJob : IJob
             try
             {
                 db.Ado.BeginTran();
+
                 if (iDictType.Count > 0)
-                {
                     await db.Insertable(iDictType).ExecuteCommandAsync(stoppingToken);
-                }
+
                 if (iDictData.Count > 0)
-                {
                     await db.Insertable(iDictData).ExecuteCommandAsync(stoppingToken);
-                }
+
                 db.Ado.CommitTran();
             }
             catch (Exception error)
             {
                 db.Ado.RollbackTran();
-                Log.Error($"{context.Trigger.Description}错误:" + _jsonSerializer.Serialize(error));
-                throw new Exception($"{context.Trigger.Description}错误");
+                Log.Error($"{context.Trigger.Description}新增枚举转换字典入库错误:" + _jsonSerializer.Serialize(error));
+                throw new Exception($"{context.Trigger.Description}新增枚举转换字典入库错误");
             }
         }
 

+ 4 - 0
Web/src/views/home/widgets/components/about.vue

@@ -1,5 +1,9 @@
 <template>
 	<el-card shadow="hover" header="关于项目" class="item-background">
+		<template #header>
+			<el-icon style="display: inline; vertical-align: middle"> <ele-QuestionFilled /> </el-icon>
+			<span style=""> 关于项目 </span>
+		</template>
 		<p>
 			基于 .NET6 (Furion/SqlSugar) 实现的通用权限开发框架,前端采用
 			Vue3+Element-plus+Vite5,整合众多优秀技术和框架,模块插件式开发。集成多租户、缓存、数据校验、鉴权、事件总线、动态API、通讯、远程请求、任务调度、打印等众多黑科技。代码结构简单清晰,注释详尽,易于上手与二次开发,即便是复杂业务逻辑也能迅速实现,真正实现“开箱即用”。

+ 9 - 3
Web/src/views/home/widgets/components/myapp.vue

@@ -1,5 +1,9 @@
 <template>
 	<el-card shadow="hover" header="快捷入口">
+		<template #header>
+			<el-icon style="display: inline; vertical-align: middle"> <ele-Guide /> </el-icon>
+			<span style=""> 快捷入口 </span>
+		</template>
 		<ul class="myMods">
 			<!-- <li v-for="mod in myMods" :key="mod.path" :style="{ background:mod.meta.color||'#eeeeee'}"> -->
 			<li v-for="mod in myMods" :key="mod.path">
@@ -19,7 +23,7 @@
 			</li>
 		</ul>
 
-		<el-drawer title="添加应用" v-model="modsDrawer" :size="520" destroy-on-close :before-close="beforeClose">
+		<el-drawer title="添加应用" v-model="modsDrawer" size="20%" destroy-on-close :before-close="beforeClose">
 			<div class="setMods mt15">
 				<h4>我的常用 ( {{ myMods.length }} )</h4>
 				<draggable tag="ul" v-model="myMods" animation="200" item-key="path" group="app" class="draggable-box" force-fallback fallback-on-body>
@@ -43,8 +47,10 @@
 				</draggable>
 			</div>
 			<template #footer>
-				<el-button @click="beforeClose">取消</el-button>
-				<el-button type="primary" @click="saveMods">保存</el-button>
+				<div style="margin-bottom: 20px; margin-right: 20px">
+					<el-button @click="beforeClose">取消</el-button>
+					<el-button type="primary" @click="saveMods">保存</el-button>
+				</div>
 			</template>
 		</el-drawer>
 	</el-card>

+ 6 - 2
Web/src/views/home/widgets/components/progressing.vue

@@ -1,7 +1,11 @@
 <template>
-	<el-card shadow="hover" header="进度环">
+	<el-card shadow="hover" header="项目进度">
+		<template #header>
+			<el-icon style="display: inline; vertical-align: middle"> <ele-Odometer /> </el-icon>
+			<span style=""> 项目进度 </span>
+		</template>
 		<div class="progress">
-			<el-progress type="dashboard" :percentage="85.5" :width="160">
+			<el-progress type="dashboard" :percentage="85.5" :width="160" color="var(--el-color-primary)">
 				<template #default="{ percentage }">
 					<div class="percentage-value">{{ percentage }}%</div>
 					<div class="percentage-label">当前进度</div>

+ 6 - 2
Web/src/views/home/widgets/components/timeing.vue

@@ -1,5 +1,9 @@
 <template>
-	<el-card shadow="hover" header="时钟" class="item-background">
+	<el-card shadow="hover" header="当前时钟" class="item-background">
+		<template #header>
+			<el-icon style="display: inline; vertical-align: middle"> <ele-Clock /> </el-icon>
+			<span style=""> 当前时钟 </span>
+		</template>
 		<div class="time">
 			<h2>{{ time }}</h2>
 			<p>{{ day }}</p>
@@ -41,7 +45,7 @@ const showTime = () => {
 
 <style scoped>
 .item-background {
-	background: linear-gradient(to right, #8e54e9, #4776e6);
+	background: var(--el-color-primary);
 	color: #fff;
 }
 .time h2 {

+ 4 - 0
Web/src/views/home/widgets/components/ver.vue

@@ -1,5 +1,9 @@
 <template>
 	<el-card shadow="hover" header="版本信息">
+		<template #header>
+			<el-icon style="display: inline; vertical-align: middle"> <ele-InfoFilled /> </el-icon>
+			<span style=""> 版本信息 </span>
+		</template>
 		<div style="height: 210px; text-align: center">
 			<img :src="verSvg" style="height: 140px" />
 			<h2 style="margin-top: 15px">Admin.Net</h2>

+ 5 - 1
Web/src/views/home/widgets/components/welcome.vue

@@ -1,5 +1,9 @@
 <template>
 	<el-card shadow="hover" header="欢迎">
+		<template #header>
+			<el-icon style="display: inline; vertical-align: middle"> <ele-Promotion /> </el-icon>
+			<span style=""> 欢迎 </span>
+		</template>
 		<div class="welcome">
 			<div class="logo">
 				<!-- <img src="/@/assets/logo.png" style="height: 150px;"/> -->
@@ -26,7 +30,7 @@
 				</div>
 			</div>
 			<div class="actions">
-				<el-button type="primary" icon="ele-Check" size="large" @click="godoc">文档</el-button>
+				<el-button type="primary" icon="ele-Check" size="large" @click="godoc">文档教程</el-button>
 			</div>
 		</div>
 	</el-card>

+ 2 - 1
Web/src/views/home/widgets/index.vue

@@ -223,7 +223,7 @@ const close = () => {
 	flex: 1;
 	overflow: auto;
 	overflow-x: hidden;
-	padding: 15px;
+	padding: 10px;
 }
 .widgets-aside {
 	width: 360px;
@@ -231,6 +231,7 @@ const close = () => {
 	box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
 	position: relative;
 	overflow: auto;
+	padding-top: 20px;
 }
 .widgets-aside-title {
 	font-size: 14px;