refactor: ♻️ 框架代码同步

This commit is contained in:
tk 2025-04-16 16:00:40 +08:00 committed by nsnail
parent 7d0fcd4906
commit 220b19d152
7 changed files with 28 additions and 9 deletions

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base FROM mcr.microsoft.com/dotnet/aspnet:9.0.4 AS base
WORKDIR /app WORKDIR /app
EXPOSE 8080 EXPOSE 8080
RUN apt update RUN apt update

View File

@ -1,11 +1,11 @@
namespace NetAdmin.Domain.Attributes; namespace NetAdmin.Domain.Attributes;
/// <summary> /// <summary>
/// 标记一个枚举的状态指示 /// 枚举装饰
/// </summary> /// </summary>
/// <inheritdoc /> /// <inheritdoc />
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Enum)] [AttributeUsage(AttributeTargets.Field | AttributeTargets.Enum)]
public sealed class IndicatorAttribute(string indicate, bool pulse) : Attribute public sealed class EnumDecorationAttribute(string indicate = nameof(Indicates.None), bool pulse = false, int sort = 0) : Attribute
{ {
/// <summary> /// <summary>
/// 状态指示 /// 状态指示
@ -16,4 +16,9 @@ public sealed class IndicatorAttribute(string indicate, bool pulse) : Attribute
/// 脉动 /// 脉动
/// </summary> /// </summary>
public bool Pulse { get; } = pulse; public bool Pulse { get; } = pulse;
/// <summary>
/// 排序值
/// </summary>
public int Sort { get; } = sort;
} }

View File

@ -9,7 +9,7 @@ public enum JobStatues
/// <summary> /// <summary>
/// 空闲 /// 空闲
/// </summary> /// </summary>
[Indicator(nameof(Indicates.Success), false)] [EnumDecoration(nameof(Indicates.Success), false)]
[ResourceDescription<Ln>(nameof(Ln.空闲))] [ResourceDescription<Ln>(nameof(Ln.空闲))]
Idle = 1 Idle = 1
@ -18,7 +18,7 @@ public enum JobStatues
/// <summary> /// <summary>
/// 运行 /// 运行
/// </summary> /// </summary>
[Indicator(nameof(Indicates.Warning), true)] [EnumDecoration(nameof(Indicates.Warning), true)]
[ResourceDescription<Ln>(nameof(Ln.运行))] [ResourceDescription<Ln>(nameof(Ln.运行))]
Running = 2 Running = 2
} }

View File

@ -38,4 +38,11 @@ public enum Indicates
/// 危险 /// 危险
/// </summary> /// </summary>
Danger = 5 Danger = 5
,
/// <summary>
/// 无
/// </summary>
None = 6
} }

View File

@ -35,8 +35,11 @@ public sealed class ConstantService : ServiceBase<IConstantService>, IConstantSe
return [..ret, z.GetCallingCode().ToInvString()]; return [..ret, z.GetCallingCode().ToInvString()];
} }
var indicate = y.Attr<IndicatorAttribute>(); var decorationAttribute = y.Attr<EnumDecorationAttribute>() ?? new EnumDecorationAttribute();
return indicate == null ? ret : [..ret, indicate.Indicate.ToLowerInvariant(), indicate.Pulse.ToString().ToLowerInvariant()]; return [
..ret, decorationAttribute.Indicate.ToLowerInvariant(), decorationAttribute.Pulse.ToString().ToLowerInvariant()
, decorationAttribute.Sort.ToInvString()
];
} }
static string[] GetHttpStatusCodeDicValue(string name) static string[] GetHttpStatusCodeDicValue(string name)

View File

@ -26,7 +26,7 @@
"vue-i18n": "11.1.3", "vue-i18n": "11.1.3",
"vue-router": "4.5.0", "vue-router": "4.5.0",
"vue3-ace-editor": "2.2.4", "vue3-ace-editor": "2.2.4",
"vue3-json-viewer": "2.2.2", "vue3-json-viewer": "2.3.0",
"vuedraggable": "4.0.3", "vuedraggable": "4.0.3",
"vuex": "4.1.0" "vuex": "4.1.0"
}, },

View File

@ -3,7 +3,11 @@
<div v-if="this.$TOOL.getNestedProperty(data, this.prop)?.toString().toLowerCase() === item.value?.toString().toLowerCase()"> <div v-if="this.$TOOL.getNestedProperty(data, this.prop)?.toString().toLowerCase() === item.value?.toString().toLowerCase()">
<scStatusIndicator <scStatusIndicator
:pulse="item.pulse" :pulse="item.pulse"
:style="item.type ? '' : `background: #${Math.abs(this.$TOOL.crypto.hashCode(item.value)).toString(16).substring(0, 6)}`" :style="
item.type && item.type !== 'none'
? ''
: `background: #${Math.abs(this.$TOOL.crypto.hashCode(item.value)).toString(16).substring(0, 6)}`
"
:type="item.type" /> :type="item.type" />
<span v-if="!$slots.default">&nbsp;{{ item.text }}</span> <span v-if="!$slots.default">&nbsp;{{ item.text }}</span>
<slot :data="data" :text="item.text"></slot> <slot :data="data" :text="item.text"></slot>