😎1、适配深色模式下颜色匹配 2、优化文本简称相关代码 3、其他页面显示优化 4、增加繁体自动翻译目标

This commit is contained in:
zuohuaijun 2025-08-13 01:13:35 +08:00
parent 91e55cad61
commit afa8993a7d
18 changed files with 94 additions and 143 deletions

View File

@ -4,7 +4,7 @@
// SqlSugar PostgreSQL
// https://www.connectionstrings.com/
"DbConnection": {
"EnableConsoleSql": true, // SQL
"EnableConsoleSql": false, // SQL
"ConnectionConfigs": [
{
//"ConfigId": "1300000000001", // -

View File

@ -22,12 +22,12 @@
<ItemGroup>
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="4.0.0" />
<PackageReference Include="AlipaySDKNet.Standard" Version="4.9.712" />
<PackageReference Include="AlipaySDKNet.Standard" Version="4.9.751" />
<PackageReference Include="AngleSharp" Version="1.3.0" />
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" Aliases="BouncyCastleV2" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.1.0" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.1.3" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.108" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.108" />
<PackageReference Include="Furion.Pure" Version="4.9.7.108" />

View File

@ -16,14 +16,14 @@ public partial class SysTextAbbr : EntityBaseId
/// <summary>
/// 文字
/// </summary>
[MaxLength(1)]
[SugarColumn(ColumnDescription = "文字", Length = 1)]
[MaxLength(1)]
public virtual string Word { get; set; }
/// <summary>
/// 文字全称
/// </summary>
[MaxLength(8)]
[SugarColumn(ColumnDescription = "文字全称", Length = 8)]
[MaxLength(8)]
public virtual string FullName { get; set; }
}

View File

@ -22,13 +22,13 @@ public class SysCommonService : IDynamicApiController, ITransient
private readonly SysCacheService _sysCacheService;
private readonly IHttpRemoteService _httpRemoteService;
public SysCommonService(IApiDescriptionGroupCollectionProvider apiProvider,
public SysCommonService(SqlSugarRepository<SysTextAbbr> sysTextAbbrRep,
IApiDescriptionGroupCollectionProvider apiProvider,
SysCacheService sysCacheService,
SqlSugarRepository<SysTextAbbr> sysTextAbbrRep,
IHttpRemoteService httpRemoteService)
{
_apiProvider = apiProvider;
_sysTextAbbrRep = sysTextAbbrRep;
_apiProvider = apiProvider;
_sysCacheService = sysCacheService;
_httpRemoteService = httpRemoteService;
}

View File

@ -4,10 +4,9 @@
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using System.Text.Json;
using Minio.DataModel;
using NewLife.IO;
using NewLife.Reflection;
using System.Text.Json;
namespace Admin.NET.Core;
@ -515,6 +514,7 @@ public static class SqlSugarExtension
#endregion
#region
/// <summary>
/// 包含缩写特性的类型属性缓存表
/// </summary>
@ -529,25 +529,23 @@ public static class SqlSugarExtension
/// 初始化文本简称数据
/// </summary>
/// <param name="dbProvider"></param>
public static async Task InitTextAbbDataAsync(this SqlSugarScopeProvider dbProvider)
public static void InitTextAbbData(this SqlSugarScopeProvider dbProvider)
{
// 表数据为空,则导入数据
if (await dbProvider.Queryable<SysTextAbbr>().CountAsync() == 0)
if (dbProvider.Queryable<SysTextAbbr>().Any()) return;
var totalWatch = Stopwatch.StartNew();
var path = AppDomain.CurrentDomain.BaseDirectory + "pinyin.csv";
using var reader = new StreamReader(path);
using var csv = new CsvFile(reader.BaseStream);
var lines = csv.ReadAll().Select(u => new SysTextAbbr
{
var totalWatch = Stopwatch.StartNew(); // 开始总计时
var message = "尝试初始化简称表数据,";
var path = AppDomain.CurrentDomain.BaseDirectory + "pinyin.csv";
using var reader = new StreamReader(path);
await using var csv = new CsvFile(reader.BaseStream);
var lines = csv.ReadAll().Select(u => new SysTextAbbr
{
Word = u[0],
FullName = u[1]
}).ToList();
var count = await dbProvider.Storageable(lines).WhereColumns(u => new { u.Word, u.FullName }).ExecuteCommandAsync();
message += $"成功导入 {count} 条,总耗时:{totalWatch.ElapsedMilliseconds} ms";
Console.WriteLine(message);
}
Word = u[0],
FullName = u[1]
}).ToList();
var count = dbProvider.Storageable(lines).WhereColumns(u => new { u.Word, u.FullName }).ExecuteCommand();
Console.WriteLine($"初始化简称数据 {count} 条,总耗时:{totalWatch.ElapsedMilliseconds} ms");
totalWatch.Stop();
}
/// <summary>
@ -557,45 +555,43 @@ public static class SqlSugarExtension
public static void SetTextAbbrProperty(this DataFilterModel entityInfo)
{
// 仅处理新增/更新操作
if (entityInfo.OperationType is DataFilterType.InsertByObject or DataFilterType.UpdateByObject)
if (entityInfo.OperationType != DataFilterType.InsertByObject && entityInfo.OperationType != DataFilterType.UpdateByObject) return;
var entityValue = entityInfo.EntityValue;
var entityType = entityValue.GetType();
// 仅在目标属性值为空时触发自动生成
if (entityValue.GetValue(entityInfo.PropertyName) != null) return;
// 获取或创建类型属性缓存(原子化操作避免竞争条件)
var propDict = _textAbbrPropCache.GetOrAdd(entityType, type =>
{
var entityValue = entityInfo.EntityValue;
var entityType = entityValue.GetType();
// 反射获取带[BindTextAbbr]特性的属性,预存属性元数据
var props = type.GetProperties()
.Where(p => p.IsDefined(typeof(BindTextAbbrAttribute)))
.Select(p => (p, p.GetCustomAttribute<BindTextAbbrAttribute>()!))
.ToDictionary(t => t.p.Name, t => (t.p, t.Item2));
// 仅在目标属性值为空时触发自动生成
if (entityValue.GetValue(entityInfo.PropertyName) == null)
{
// 获取或创建类型属性缓存(原子化操作避免竞争条件)
var propDict = _textAbbrPropCache.GetOrAdd(entityType, type =>
{
// 反射获取带[BindTextAbbr]特性的属性,预存属性元数据
var props = type.GetProperties()
.Where(p => p.IsDefined(typeof(BindTextAbbrAttribute)))
.Select(p => (p, p.GetCustomAttribute<BindTextAbbrAttribute>()!))
.ToDictionary(t => t.p.Name, t => (t.p, t.Item2));
return props.Any() ? props : null;
});
return props.Any() ? props : null;
});
// 无绑定属性或当前属性不匹配时提前结束
if (propDict == null || !propDict.TryGetValue(entityInfo.PropertyName, out var propData)) return;
// 无绑定属性或当前属性不匹配时提前结束
if (propDict == null || !propDict.TryGetValue(entityInfo.PropertyName, out var propData)) return;
// 解构预存的属性和特性信息
var (_, attribute) = propData;
var value = entityValue.GetValue(attribute.PropertyName)?.ToString();
// 解构预存的属性和特性信息
var (_, attribute) = propData;
var value = entityValue.GetValue(attribute.PropertyName)?.ToString();
// 源文本非空时生成缩写
if (string.IsNullOrWhiteSpace(value)) return;
// 源文本非空时生成缩写
if (!string.IsNullOrWhiteSpace(value))
{
// 使用线程安全的延迟初始化服务实例获取文本缩写
var abbrValue = _lazySysCommonService.Value
.GetNameAbbr(new() { Text = value, All = attribute.SaveFullAbbr })
.GetAwaiter()
.GetResult();
entityInfo.SetValue(abbrValue);
}
}
}
// 使用线程安全的延迟初始化服务实例获取文本缩写
var abbrValue = _lazySysCommonService.Value
.GetNameAbbr(new() { Text = value, All = attribute.SaveFullAbbr })
.GetAwaiter()
.GetResult();
entityInfo.SetValue(abbrValue);
}
#endregion
#endregion
}

View File

@ -369,7 +369,7 @@ public static class SqlSugarSetup
if (config.SeedSettings.EnableInitSeed) InitSeedData(dbProvider, config.SeedSettings.EnableIncreSeed);
// 初始化文本简称表数据
_ = dbProvider.InitTextAbbDataAsync();
dbProvider.InitTextAbbData();
}
/// <summary>

View File

@ -37,7 +37,7 @@
"cropperjs": "^1.6.2",
"crypto-js": "^4.2.0",
"echarts": "^6.0.0",
"element-plus": "^2.10.6",
"element-plus": "^2.10.7",
"exceljs": "^4.4.0",
"flag-icons": "^7.5.0",
"franc": "^6.2.0",
@ -71,7 +71,7 @@
"vue-clipboard3": "^2.0.0",
"vue-demi": "0.14.10",
"vue-draggable-plus": "^0.6.0",
"vue-element-plus-x": "^1.3.5",
"vue-element-plus-x": "^1.3.7",
"vue-grid-layout": "3.0.0-beta1",
"vue-i18n": "^11.1.11",
"vue-json-pretty": "^2.5.0",

View File

@ -99,22 +99,6 @@ export interface AddUserInput {
*/
tenantId?: number | null;
/**
*
*
* @type {string}
* @memberof AddUserInput
*/
pinyin?: string | null;
/**
*
*
* @type {string}
* @memberof AddUserInput
*/
allPinyin?: string | null;
/**
*
*

View File

@ -114,22 +114,6 @@ export interface SysUser {
*/
realName?: string | null;
/**
*
*
* @type {string}
* @memberof SysUser
*/
pinyin?: string | null;
/**
*
*
* @type {string}
* @memberof SysUser
*/
allPinyin?: string | null;
/**
*
*

View File

@ -99,22 +99,6 @@ export interface UpdateUserInput {
*/
tenantId?: number | null;
/**
*
*
* @type {string}
* @memberof UpdateUserInput
*/
pinyin?: string | null;
/**
*
*
* @type {string}
* @memberof UpdateUserInput
*/
allPinyin?: string | null;
/**
*
*

View File

@ -114,22 +114,6 @@ export interface UserOutput {
*/
realName?: string | null;
/**
*
*
* @type {string}
* @memberof UserOutput
*/
pinyin?: string | null;
/**
*
*
* @type {string}
* @memberof UserOutput
*/
allPinyin?: string | null;
/**
*
*

View File

@ -501,6 +501,24 @@ $--el-table-text-color: #fb6d49;
flex-direction: column !important;
}
.el-tag {
border-style: unset !important;
// background-color: var(--el-bg-color) !important;
}
.default-theme.splitpanes .splitpanes__pane {
background-color: var(--el-bg-color) !important;
}
.default-theme.splitpanes .splitpanes__splitter {
background-color: var(--el-bg-color) !important;
}
.default-theme.splitpanes--vertical > .splitpanes__splitter,
.default-theme .splitpanes--vertical > .splitpanes__splitter {
border-left: 1px solid var(--el-bg-color) !important;
}
// hack列表页
.layout-parent {
height: 0;

View File

@ -3,9 +3,8 @@ import useClipboard from 'vue-clipboard3';
import { ElMessage } from 'element-plus';
import { formatDate } from '/@/utils/formatTime';
import { useI18n } from 'vue-i18n';
import {debounce} from "lodash-es";
import {getAPI} from "/@/utils/axios-utils";
import {SysCommonApi} from "/@/api-services/system";
import { getAPI } from '/@/utils/axios-utils';
import { SysCommonApi } from '/@/api-services/system';
export default function () {
const { t } = useI18n();
@ -90,10 +89,12 @@ export default function () {
const getNameAbbr = (text: string, callback?: (abbr: any) => void) => {
if (!text) return ElMessage.error('获取简称文本不能为空');
try {
return getAPI(SysCommonApi).apiSysCommonNameAbbrPost({ text: text }).then(res => {
if (callback) callback(res.data.result);
return res.data.result;
})
return getAPI(SysCommonApi)
.apiSysCommonNameAbbrPost({ text: text })
.then((res) => {
if (callback) callback(res.data.result);
return res.data.result;
});
} catch (e) {
ElMessage.error('获取失败');
}

View File

@ -56,10 +56,10 @@
</el-tooltip>
</el-button-group>
<el-button icon="ele-Coin" @click="openJobCluster" plain> 集群控制 </el-button>
<el-button icon="ele-Grid" @click="openJobDashboard" plain> 任务看板 </el-button>
<el-button type="primary" icon="ele-Grid" @click="openJobDashboard" plain> 任务看板 </el-button>
<el-button-group style="padding-left: 12px">
<el-button type="primary" icon="ele-Expand" @click="handleExpand"> 全部展开 </el-button>
<el-button type="primary" icon="ele-Fold" @click="handleFold"> 全部折叠 </el-button>
<el-button icon="ele-Expand" @click="handleExpand"> 全部展开 </el-button>
<el-button icon="ele-Fold" @click="handleFold"> 全部折叠 </el-button>
</el-button-group>
</template>
<template #toolbar_tools> </template>

View File

@ -45,8 +45,8 @@
<template #toolbar_buttons>
<el-button type="primary" icon="ele-Plus" @click="handleAdd" v-auth="'sysOrg/add'"> {{ $t('message.list.add') }} </el-button>
<el-button-group style="padding-left: 12px">
<el-button type="primary" icon="ele-Expand" @click="handleExpand"> {{ $t('message.list.allExpand') }} </el-button>
<el-button type="primary" icon="ele-Fold" @click="handleFold"> {{ $t('message.list.allFold') }} </el-button>
<el-button icon="ele-Expand" @click="handleExpand"> {{ $t('message.list.allExpand') }} </el-button>
<el-button icon="ele-Fold" @click="handleFold"> {{ $t('message.list.allFold') }} </el-button>
</el-button-group>
</template>
<template #toolbar_tools> </template>

View File

@ -38,8 +38,8 @@
<template #toolbar_buttons>
<el-button type="primary" icon="ele-Plus" @click="handleAdd" v-auth="'sysRegion/add'"> 新增 </el-button>
<el-button-group style="padding: 0 12px 0 12px">
<el-button type="primary" icon="ele-Expand" @click="handleExpand"> 全部展开 </el-button>
<el-button type="primary" icon="ele-Fold" @click="handleFold"> 全部折叠 </el-button>
<el-button icon="ele-Expand" @click="handleExpand"> 全部展开 </el-button>
<el-button icon="ele-Fold" @click="handleFold"> 全部折叠 </el-button>
</el-button-group>
<el-dropdown v-auth="'sysRegion/add'" @command="handleCommand">
<el-button type="danger" icon="ele-Lightning"> 从云端同步 </el-button>

View File

@ -682,7 +682,7 @@ onMounted(async () => {
<style lang="scss" scoped>
.device-info-container {
padding: 5px;
background: #f5f7fa;
background: var(--el-bg-color);
min-height: 100vh;
}

View File

@ -67,7 +67,7 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
// 源语言
originLang: 'zh-cn',
// 目标语言列表
targetLangList: ['en'],
targetLangList: ['zh-hk', 'zh-tw', 'en'],
// 翻译文件配置生成路径
globalPath: './lang',
// 指定只翻译某些目录路径白名单默认为src