diff --git a/Dockerfile b/Dockerfile index 1c40a6c2..026634c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0.5 AS base +FROM mcr.microsoft.com/dotnet/aspnet:9.0.7 AS base WORKDIR /app EXPOSE 8080 RUN apt update diff --git a/build/code.quality.props b/build/code.quality.props index 4c66fb95..5bc76084 100644 --- a/build/code.quality.props +++ b/build/code.quality.props @@ -23,7 +23,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/backend/NetAdmin/NetAdmin.Domain/Dto/Dependency/QueryReq.cs b/src/backend/NetAdmin/NetAdmin.Domain/Dto/Dependency/QueryReq.cs index 12b5c7b9..44f9e4aa 100644 --- a/src/backend/NetAdmin/NetAdmin.Domain/Dto/Dependency/QueryReq.cs +++ b/src/backend/NetAdmin/NetAdmin.Domain/Dto/Dependency/QueryReq.cs @@ -52,21 +52,25 @@ public record QueryReq : DataAbstraction } var expParameter = Expression.Parameter(typeof(TEntity), "a"); - var bindings = new List(); + var bindings = new List<(PropertyInfo, MemberInitExpression)>(); // ReSharper disable once LoopCanBeConvertedToQuery foreach (var field in RequiredFields) { - var prop = typeof(TEntity).GetProperty(field); + var prop = typeof(TEntity).GetRecursiveProperty(field); if (prop == null || prop.GetCustomAttribute() != null) { continue; } - var propExp = Expression.Property(expParameter, prop); - var binding = Expression.Bind(prop, propExp); - bindings.Add(binding); + var parentPath = field[..field.LastIndexOf('.').Is(-1, field.Length)]; + var parentProperty = typeof(TEntity).GetRecursiveProperty(parentPath); + var propExp = Expression.Property(Expression.Parameter(prop.DeclaringType!, parentPath), prop); + + bindings.Add((parentProperty, Expression.MemberInit(Expression.New(prop.DeclaringType), Expression.Bind(prop, propExp)))); } - var expBody = Expression.MemberInit(Expression.New(typeof(TEntity)), bindings); + var expBody = Expression.MemberInit( // + Expression.New(typeof(TEntity)) + , bindings.SelectMany(x => x.Item1.PropertyType == x.Item2.Type ? [Expression.Bind(x.Item1, x.Item2)] : x.Item2.Bindings.ToArray())); return Expression.Lambda>(expBody, expParameter); } } \ No newline at end of file diff --git a/src/backend/NetAdmin/NetAdmin.Domain/Dto/Sys/UserInvite/QueryUserInviteReq.cs b/src/backend/NetAdmin/NetAdmin.Domain/Dto/Sys/UserInvite/QueryUserInviteReq.cs index e0a8243c..cd4c7caa 100644 --- a/src/backend/NetAdmin/NetAdmin.Domain/Dto/Sys/UserInvite/QueryUserInviteReq.cs +++ b/src/backend/NetAdmin/NetAdmin.Domain/Dto/Sys/UserInvite/QueryUserInviteReq.cs @@ -8,4 +8,9 @@ public sealed record QueryUserInviteReq : Sys_UserInvite /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public override long Id { get; init; } + + /// + /// 是否平面查询 + /// + public bool IsPlainQuery { get; init; } } \ No newline at end of file diff --git a/src/backend/NetAdmin/NetAdmin.Infrastructure/Enums/TypeExtensions.cs b/src/backend/NetAdmin/NetAdmin.Infrastructure/Enums/TypeExtensions.cs new file mode 100644 index 00000000..0e721031 --- /dev/null +++ b/src/backend/NetAdmin/NetAdmin.Infrastructure/Enums/TypeExtensions.cs @@ -0,0 +1,32 @@ +namespace NetAdmin.Infrastructure.Enums; + +/// +/// 类型扩展方法 +/// +public static class TypeExtensions +{ + /// + /// 递归获取类型的属性 + /// + /// 要查找的类型 + /// 属性路径,如"a.b.c" + /// 找到的属性信息,如果路径中任何属性不存在则返回null + public static PropertyInfo GetRecursiveProperty(this Type type, string propertyPath) + { + var properties = propertyPath.Split('.'); + PropertyInfo propertyInfo = null; + var currentType = type; + + foreach (var propertyName in properties) { + propertyInfo = currentType.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase); + + if (propertyInfo == null) { + return null; + } + + currentType = propertyInfo.PropertyType; + } + + return propertyInfo; + } +} \ No newline at end of file diff --git a/src/backend/NetAdmin/NetAdmin.Infrastructure/NetAdmin.Infrastructure.csproj b/src/backend/NetAdmin/NetAdmin.Infrastructure/NetAdmin.Infrastructure.csproj index e9859ceb..ab22b90a 100644 --- a/src/backend/NetAdmin/NetAdmin.Infrastructure/NetAdmin.Infrastructure.csproj +++ b/src/backend/NetAdmin/NetAdmin.Infrastructure/NetAdmin.Infrastructure.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/CodeTemplateService.cs b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/CodeTemplateService.cs index 6b839bf9..72bb1313 100644 --- a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/CodeTemplateService.cs +++ b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/CodeTemplateService.cs @@ -40,8 +40,11 @@ public sealed class CodeTemplateService(BasicRepository .ConfigureAwait(false); return ret.Select(x => new KeyValuePair, int>( req.RequiredFields.ToImmutableDictionary( - y => y, y => typeof(Sys_CodeTemplate).GetProperty(y)!.GetValue(x.Key)?.ToString()), x.Value)) - .Where(x => x.Key.Any(y => !y.Value.NullOrEmpty())) + y => y + , y => y.Contains('.') + ? typeof(Sys_CodeTemplate).GetRecursiveProperty(y)!.GetValue( + x.Key.GetType().GetRecursiveProperty(y[..y.LastIndexOf('.')]).GetValue(x.Key))!.ToString() + : typeof(Sys_CodeTemplate).GetProperty(y)!.GetValue(x.Key)!.ToString()), x.Value)) .OrderByDescending(x => x.Value); } diff --git a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/ConstantService.cs b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/ConstantService.cs index 1a84c2e7..ce817aba 100644 --- a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/ConstantService.cs +++ b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/ConstantService.cs @@ -31,15 +31,13 @@ public sealed class ConstantService : ServiceBase, IConstantSe static string[] GetDicValue(Enum y) { var ret = new[] { Convert.ToInt64(y, CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture), y.ResDesc() }; - if (y is CountryCodes z) { - return [..ret, z.GetCallingCode().ToInvString()]; - } var decorationAttribute = y.Attr() ?? new EnumDecorationAttribute(); - return [ + ret = [ ..ret, decorationAttribute.Indicate.ToLowerInvariant(), decorationAttribute.Pulse.ToString().ToLowerInvariant() , decorationAttribute.Sort.ToInvString() ]; + return y is CountryCodes z ? [..ret, z.GetCallingCode().ToInvString()] : ret; } static string[] GetHttpStatusCodeDicValue(string name) diff --git a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/DevService.cs b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/DevService.cs index c2244619..bbe982f9 100644 --- a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/DevService.cs +++ b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/DevService.cs @@ -302,78 +302,6 @@ public sealed class DevService(IApiService apiService) : ServiceBase await WriteCsCodeAsync(Path.Combine(dir, $"{req.EntityName}Cache.cs"), templateContent).ConfigureAwait(false); } - private static Task GenerateDomainCreateReqFileAsync(GenerateCsCodeReq req, string project, string prefix) - { - var sb = new StringBuilder(); - _ = sb.AppendLine(CultureInfo.InvariantCulture, $"using {project}.DbMaps.{prefix};"); - if (!req.Interfaces.NullOrEmpty()) { - _ = sb.AppendLine("using NetAdmin.Domain.DbMaps.Dependency.Fields;"); - } - - _ = sb.AppendLine(); - _ = sb.AppendLine(CultureInfo.InvariantCulture, $"namespace {project}.Dto.{prefix}.{req.EntityName};"); - _ = sb.AppendLine(); - _ = sb.AppendLine(CultureInfo.InvariantCulture, $""" - /// - /// 请求:创建{req.Summary} - /// - """); - _ = sb.AppendLine(CultureInfo.InvariantCulture, $"public record Create{req.EntityName}Req : {prefix}_{req.EntityName}"); - _ = sb.Append('{'); - if (req.Interfaces?.Contains(nameof(IFieldEnabled)) == true) { - _ = sb.AppendLine(""" - - /// - public override bool Enabled { get; init; } = true; - """); - } - - if (req.BaseClass != nameof(SimpleEntity) && req.FieldList.Single(x => x.IsPrimary).Type == "string") { - _ = sb.AppendLine(""" - - /// - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [Required] - public override string Id { get; init; } - """); - } - - if (req.Interfaces?.Contains(nameof(IFieldSort)) == true) { - _ = sb.AppendLine(""" - - /// - [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public override long Sort { get; init; } - """); - } - - if (req.Interfaces?.Contains(nameof(IFieldSummary)) == true) { - _ = sb.AppendLine(""" - - /// - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public override string Summary { get; init; } - """); - } - - foreach (var field in req.FieldList) { - var condition = field.IsStruct ? "Never" : "WhenWritingNull"; - var nul = field.IsStruct && field.IsNullable ? "?" : string.Empty; - _ = sb.AppendLine(CultureInfo.InvariantCulture, $$""" - - /// - [JsonIgnore(Condition = JsonIgnoreCondition.{{condition}})] - public override {{field.Type}}{{nul}} {{field.Name}} { get; init; } - """); - } - - _ = sb.Append('}'); - - var outPath = Path.Combine(Path.GetDirectoryName(req.Project)!, "Dto", prefix, req.EntityName); - _ = Directory.CreateDirectory(outPath); - return WriteCsCodeAsync(Path.Combine(outPath, $"Create{req.EntityName}Req.cs"), sb.ToString()); - } - private static Task GenerateDomainEditReqFileAsync(GenerateCsCodeReq req, string project, string prefix) { var sb = new StringBuilder(); @@ -1074,4 +1002,85 @@ public sealed class DevService(IApiService apiService) : ServiceBase content = string.Join('\n', usings) + sb; return File.WriteAllTextAsync(path, usings.Count == 0 ? content.Trim() : content); } + + private Task GenerateDomainCreateReqFileAsync(GenerateCsCodeReq req, string project, string prefix) + { + var sb = new StringBuilder(); + _ = sb.AppendLine(CultureInfo.InvariantCulture, $"using {project}.DbMaps.{prefix};"); + if (!req.Interfaces.NullOrEmpty()) { + _ = sb.AppendLine("using NetAdmin.Domain.DbMaps.Dependency.Fields;"); + } + + _ = sb.AppendLine(); + _ = sb.AppendLine(CultureInfo.InvariantCulture, $"namespace {project}.Dto.{prefix}.{req.EntityName};"); + _ = sb.AppendLine(); + _ = sb.AppendLine(CultureInfo.InvariantCulture, $""" + /// + /// 请求:创建{req.Summary} + /// + """); + _ = sb.AppendLine(CultureInfo.InvariantCulture, $"public record Create{req.EntityName}Req : {prefix}_{req.EntityName}"); + _ = sb.Append('{'); + if (req.Interfaces?.Contains(nameof(IFieldEnabled)) == true) { + _ = sb.AppendLine(""" + + /// + public override bool Enabled { get; init; } = true; + """); + } + + if (req.BaseClass != nameof(SimpleEntity) && req.FieldList.Single(x => x.IsPrimary).Type == "string") { + _ = sb.AppendLine(""" + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [Required] + public override string Id { get; init; } + """); + } + + if (req.Interfaces?.Contains(nameof(IFieldSort)) == true) { + _ = sb.AppendLine(""" + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Sort { get; init; } + """); + } + + if (req.Interfaces?.Contains(nameof(IFieldSummary)) == true) { + _ = sb.AppendLine(""" + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public override string Summary { get; init; } + """); + } + + foreach (var field in req.FieldList) { + var condition = field.IsStruct ? "Never" : "WhenWritingNull"; + var nul = field.IsStruct && field.IsNullable ? "?" : null; + var isEnum = S().GetEnums().FirstOrDefault(x => x.Key == field.Type); + string enumConstraint = null; + if (!isEnum.Key.NullOrEmpty()) { + enumConstraint = $""" + + [EnumDataType(typeof({field.Type}))] + """; + } + + _ = sb.AppendLine(CultureInfo.InvariantCulture, $$""" + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.{{condition}})]{{enumConstraint}} + public override {{field.Type}}{{nul}} {{field.Name}} { get; init; } + """); + } + + _ = sb.Append('}'); + + var outPath = Path.Combine(Path.GetDirectoryName(req.Project)!, "Dto", prefix, req.EntityName); + _ = Directory.CreateDirectory(outPath); + return WriteCsCodeAsync(Path.Combine(outPath, $"Create{req.EntityName}Req.cs"), sb.ToString()); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/UserInviteService.cs b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/UserInviteService.cs index d93425eb..5871d46d 100644 --- a/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/UserInviteService.cs +++ b/src/backend/NetAdmin/NetAdmin.SysComponent.Application/Services/Sys/UserInviteService.cs @@ -104,7 +104,11 @@ public sealed class UserInviteService(BasicRepository rpo) public async Task> QueryAsync(QueryReq req) { req.ThrowIfInvalid(); - var ret = await QueryInternal(req).Include(a => a.Owner).Include(a => a.User).WithNoLockNoWait().ToTreeListAsync().ConfigureAwait(false); + var query = QueryInternal(req).Include(a => a.Owner).Include(a => a.User).WithNoLockNoWait(); + var ret = req.Filter?.IsPlainQuery == true + ? await query.ToListAsync().ConfigureAwait(false) + : await query.ToTreeListAsync().ConfigureAwait(false); + return ret.Adapt>(); } @@ -117,7 +121,9 @@ public sealed class UserInviteService(BasicRepository rpo) private ISelect QueryInternal(QueryReq req) { - var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter).WhereDynamic(req.Filter); + var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter) + .WhereIf( // + req.Filter?.Id > 0, a => a.Id == req.Filter.Id); // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault switch (req.Order) { diff --git a/src/backend/NetAdmin/NetAdmin.Tests/NetAdmin.Tests.csproj b/src/backend/NetAdmin/NetAdmin.Tests/NetAdmin.Tests.csproj index ce96c62a..fc52e374 100644 --- a/src/backend/NetAdmin/NetAdmin.Tests/NetAdmin.Tests.csproj +++ b/src/backend/NetAdmin/NetAdmin.Tests/NetAdmin.Tests.csproj @@ -3,7 +3,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/frontend/admin/src/assets/icon/business.vue b/src/frontend/admin/src/assets/icon/business.vue index ead3d5a5..b6158f8b 100644 --- a/src/frontend/admin/src/assets/icon/business.vue +++ b/src/frontend/admin/src/assets/icon/business.vue @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/src/frontend/admin/src/assets/icon/index.js b/src/frontend/admin/src/assets/icon/index.js index 5f36e0d5..1e6660df 100644 --- a/src/frontend/admin/src/assets/icon/index.js +++ b/src/frontend/admin/src/assets/icon/index.js @@ -76,4 +76,4 @@ export { default as 'device-log' } from './device-log' export { default as 'nick-name' } from './nick-name' export { default as telegram } from './telegram' export { default as country } from './country' -export {default as template} from './template.vue' \ No newline at end of file +export { default as template } from './template.vue' \ No newline at end of file diff --git a/src/frontend/admin/src/assets/icon/template.vue b/src/frontend/admin/src/assets/icon/template.vue index 75f787d1..b4bbcf0b 100644 --- a/src/frontend/admin/src/assets/icon/template.vue +++ b/src/frontend/admin/src/assets/icon/template.vue @@ -1 +1,6 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/frontend/admin/src/components/na-col-user/index.vue b/src/frontend/admin/src/components/na-col-user/index.vue index 94600c4a..5280057e 100644 --- a/src/frontend/admin/src/components/na-col-user/index.vue +++ b/src/frontend/admin/src/components/na-col-user/index.vue @@ -1,17 +1,19 @@ @@ -25,7 +27,7 @@ export default { created() {}, data() { return { - dialog: { save: false }, + dialog: {}, } }, emits: ['click'], @@ -34,9 +36,7 @@ export default { if (!this.clickOpenDialog) { return } - this.dialog.save = true - await this.$nextTick() - await this.$refs.saveDialog.open({ mode: 'view', row: { id: id } }) + this.dialog.save = { mode: 'view', row: { id: id } } }, //获取头像 getAvatar(row, prop) { diff --git a/src/frontend/admin/src/components/na-table-page/detail.vue b/src/frontend/admin/src/components/na-table-page/detail.vue index 40623135..6b3b3f0e 100644 --- a/src/frontend/admin/src/components/na-table-page/detail.vue +++ b/src/frontend/admin/src/components/na-table-page/detail.vue @@ -11,10 +11,13 @@ @@ -83,7 +97,7 @@ @@ -186,7 +186,6 @@ const scContextmenuItem = defineAsyncComponent(() => import('@/components/sc-con const scContextmenu = defineAsyncComponent(() => import('@/components/sc-context-menu')) const fieldFilter = defineAsyncComponent(() => import('./field-filter')) -import { h } from 'vue' import tool from '@/utils/tool' import iframe from '@/store/modules/iframe' @@ -205,7 +204,7 @@ export default { contextOpers: { type: Array, default: [] }, contextAdvs: { type: Array, default: [] }, contextExtra: { type: Object }, - tableName: { type: String, default: '' }, + tableName: { type: String, default: `` }, beforePost: { type: Function, }, @@ -222,14 +221,14 @@ export default { type: Object, default: () => {}, }, - height: { type: [String, Number], default: '100%' }, - size: { type: String, default: 'default' }, + height: { type: [String, Number], default: `100%` }, + size: { type: String, default: `default` }, border: { type: Boolean, default: false }, stripe: { type: Boolean, default: false }, defaultExpandAll: { type: Boolean, default: false }, pageSize: { type: Number, default: config.pageSize }, pageSizes: { type: Array, default: config.pageSizes }, - rowKey: { type: String, default: '' }, + rowKey: { type: String, default: `` }, summaryMethod: { type: Function, default: null }, filterMethod: { type: Function, default: null }, cellClickMethod: { type: Function, default: null }, @@ -273,10 +272,10 @@ export default { return tool }, _height() { - return Number(this.height) ? Number(this.height) + 'px' : this.height + return Number(this.height) ? Number(this.height) + `px` : this.height }, _table_height() { - return this.hidePagination && this.hideDo ? '100%' : 'calc(100% - 4rem)' + return this.hidePagination && this.hideDo ? `100%` : `calc(100% - 4rem)` }, }, data() { @@ -289,7 +288,7 @@ export default { }, scPageSize: this.pageSize, isActivate: true, - emptyText: '暂无数据', + emptyText: `暂无数据`, toggleIndex: 0, tableData: [], total: 0, @@ -297,7 +296,7 @@ export default { prop: null, order: null, loading: false, - tableHeight: '100%', + tableHeight: `100%`, tableParams: this.params, userColumn: [], customColumnShow: false, @@ -336,68 +335,68 @@ export default { }, methods: { dbClick(row) { - if (this.dblClickDisable) { + if (this.dblClickDisable || !this.contextOpers.includes(`view`)) { return } if (this.vue.dialog) { - this.vue.dialog.detail = { mode: 'view', row: { id: row.id } } + this.vue.dialog.detail = { mode: `view`, row: { id: row.id } } } }, async contextMenuCommand(command) { - if (typeof command === 'object') { + if (typeof command === `object`) { return command.action(this.vue, this.current.row) } - if (command === 'refresh') { + if (command === `refresh`) { this.vue.reload() return } - if (command === 'copy') { + if (command === `copy`) { let data = tool.getNestedProperty(this.current.row, this.current.column?.property) if (!data) return - const textarea = document.createElement('textarea') + const textarea = document.createElement(`textarea`) textarea.readOnly = true - textarea.style.position = 'absolute' - textarea.style.left = '-9999px' + textarea.style.position = `absolute` + textarea.style.left = `-9999px` textarea.value = data document.body.appendChild(textarea) textarea.select() textarea.setSelectionRange(0, textarea.value.length) - const result = document.execCommand('Copy') + const result = document.execCommand(`Copy`) if (result) { - this.$message.success(this.$t('复制成功')) + this.$message.success(this.$t(`复制成功`)) } document.body.removeChild(textarea) return } - if (command === 'view') { + if (command === `view`) { await this.vue.onViewClick(this.current.row) return } - if (command === 'export') { + if (command === `export`) { await this.exportData() return } - if (command === 'add') { + if (command === `add`) { await this.vue.onAddClick() return } - if (command === 'edit') { + if (command === `edit`) { await this.vue.onEditClick(this.current.row) return } - if (command === 'del') { + if (command === `del`) { await this.vue.onDeleteClick(this.current.row) return } - const kv = command.split('^|^') - if (kv[1].indexOf('order-') === 0) { + const kv = command.split(`^|^`) + if (kv[1].indexOf(`order-`) === 0) { this.vue.query.prop = kv[0] this.vue.query.order = kv[1].substring(6) await this.upData() } else { this.$refs.fieldFilterDialog.open({ field: kv[0], operator: kv[1], value: kv[2] }, (data) => { - const value = data.value?.split('\n') ?? [''] + const value = data.value?.split(`\n`) ?? [``] this.vue.query.dynamicFilter.filters.push({ field: data.field, operator: data.operator, @@ -445,8 +444,8 @@ export default { if (ids.length > 0) { reqData.dynamicFilter = { filters: [reqData.dynamicFilter], - field: 'id', - operator: 'Any', + field: `id`, + operator: `Any`, value: ids, } } @@ -473,7 +472,7 @@ export default { } catch (error) { this._clearData() this.loading = false - this.emptyText = '数据格式错误' + this.emptyText = `数据格式错误` return false } if (response.code !== config.successCode) { @@ -481,7 +480,7 @@ export default { this.loading = false this.emptyText = response.msg } else { - this.emptyText = '暂无数据' + this.emptyText = `暂无数据` if (this.hidePagination) { this.tableData = response.data || [] } else { @@ -495,7 +494,7 @@ export default { return res })() - this.$emit('dataChange', ret, this.tableData) + this.$emit(`dataChange`, ret, this.tableData) }, //清空数据 _clearData() { @@ -519,8 +518,8 @@ export default { async exportData() { this.loading = true try { - await this.exportApi.post(this.getQueryParams(), { responseType: 'blob' }) - this.$message.success(this.$t('数据已导出(上限 {n} 条)', { n: 50000 })) + await this.exportApi.post(this.getQueryParams(), { responseType: `blob` }) + this.$message.success(this.$t(`数据已导出(上限 {n} 条)`, { n: 50000 })) } catch {} this.loading = false }, @@ -551,10 +550,10 @@ export default { try { await config.columnSettingSave(this.tableName, userColumn) } catch (error) { - this.$message.error('保存失败') + this.$message.error(`保存失败`) this.$refs.columnSetting.isSave = false } - this.$message.success('保存成功') + this.$message.success(`保存成功`) this.$refs.columnSetting.isSave = false }, //自定义列重置 @@ -564,7 +563,7 @@ export default { this.userColumn = await config.columnSettingReset(this.tableName, this.column) this.$refs.columnSetting.userColumn = JSON.parse(JSON.stringify(this.userColumn || [])) } catch (error) { - this.$message.error('重置失败') + this.$message.error(`重置失败`) this.$refs.columnSetting.isSave = false } this.$refs.columnSetting.isSave = false @@ -597,7 +596,7 @@ export default { return this.filterMethod(filters) } Object.keys(filters).forEach((key) => { - filters[key] = filters[key].join(',') + filters[key] = filters[key].join(`,`) }) this.upData(filters) }, @@ -607,14 +606,14 @@ export default { const sums = [] columns.forEach((column, index) => { if (index === 0) { - sums[index] = '合计' + sums[index] = `合计` return } const values = this.summary[column.property] if (values) { sums[index] = values } else { - sums[index] = '' + sums[index] = `` } }) return sums diff --git a/src/frontend/admin/src/layout/index.vue b/src/frontend/admin/src/layout/index.vue index b9a8f2e8..9a713347 100644 --- a/src/frontend/admin/src/layout/index.vue +++ b/src/frontend/admin/src/layout/index.vue @@ -220,7 +220,8 @@ import { defineAsyncComponent } from 'vue' const sideM = defineAsyncComponent(() => import('./components/side-m')) const topbar = defineAsyncComponent(() => import('./components/topbar')) -const tags = defineAsyncComponent(() => import('./components/tags')) +// 这里直接import避免闪烁 +import tags from '@/layout/components/tags.vue' const navMenu = defineAsyncComponent(() => import('./components/nav-menu')) const userBar = defineAsyncComponent(() => import('./components/user-bar')) const iframeView = defineAsyncComponent(() => import('./components/iframe-view')) diff --git a/src/frontend/admin/src/style/app.scss b/src/frontend/admin/src/style/app.scss index d811537a..5efc1843 100644 --- a/src/frontend/admin/src/style/app.scss +++ b/src/frontend/admin/src/style/app.scss @@ -576,7 +576,6 @@ textarea { .el-table-column-avatar { justify-content: center; align-items: center; - cursor: pointer; display: flex; gap: 0.5rem; diff --git a/src/frontend/admin/src/views/sys/template/index.vue b/src/frontend/admin/src/views/sys/template/index.vue index 68264fd7..bee35345 100644 --- a/src/frontend/admin/src/views/sys/template/index.vue +++ b/src/frontend/admin/src/views/sys/template/index.vue @@ -91,18 +91,4 @@ entity-name="sys_codetemplate" /> - -