feat(platform): 合并车辆运维页并优化 3D 画布嵌入体验
将维护策略与车队生命周期并入车辆运维 Tab,补充旧路由重定向与 RBAC 页面 key 迁移;改进 Workspace3D 就绪探测与 wwwroot 静态资源。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -45,14 +45,12 @@ public static class PageCatalog
|
||||
new("admin-config-system", "系统级配置", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-integrations", "外部系统对接", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-routing", "路径规划", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-vehicle", "车辆维护策略", "平台配置中心", ScopePlatform),
|
||||
new("admin-vehicle-hub", "车辆运维", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-charge", "充电策略", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-task", "任务分配", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-traffic", "交通管制", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-auth", "权限与角色", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-device", "设备接入", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-fleet", "车队生命周期", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-scenario", "场景模板", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-location", "库位管理", "平台配置中心", ScopePlatform),
|
||||
new("admin-config-ops", "运营维护", "平台配置中心", ScopePlatform),
|
||||
@@ -70,9 +68,21 @@ public static class PageCatalog
|
||||
private static readonly HashSet<string> _keys =
|
||||
All.Select(p => p.Key).ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>已下线页面 Key → 合并后的新 Key(角色数据迁移用)。</summary>
|
||||
private static readonly IReadOnlyDictionary<string, string> LegacyKeyAliases =
|
||||
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["admin-config-vehicle"] = "admin-vehicle-hub",
|
||||
["admin-config-fleet"] = "admin-vehicle-hub",
|
||||
};
|
||||
|
||||
/// <summary>判断页面 Key 是否合法(用于角色保存时过滤掉脏数据 / 已下线页面)。</summary>
|
||||
public static bool IsValidKey(string key) => _keys.Contains(key);
|
||||
|
||||
/// <summary>将旧页面 Key 映射为当前有效 Key;未知 Key 原样返回。</summary>
|
||||
public static string NormalizeKey(string key) =>
|
||||
LegacyKeyAliases.TryGetValue(key, out var mapped) ? mapped : key;
|
||||
|
||||
/// <summary>列出某 scope 下的全部页面 Key(用于把角色的 "*" 通配展开成具体页面集合)。</summary>
|
||||
public static IReadOnlyList<string> KeysForScope(string scope) =>
|
||||
All.Where(p => string.Equals(p.Scope, scope, StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -82,7 +82,11 @@ public sealed class RbacStore
|
||||
snap.Users ??= new();
|
||||
foreach (var r in snap.Roles)
|
||||
{
|
||||
r.Pages = (r.Pages ?? new()).Where(p => p == PageCatalog.Wildcard || PageCatalog.IsValidKey(p)).Distinct().ToList();
|
||||
r.Pages = (r.Pages ?? new())
|
||||
.Select(p => p == PageCatalog.Wildcard ? p : PageCatalog.NormalizeKey(p))
|
||||
.Where(p => p == PageCatalog.Wildcard || PageCatalog.IsValidKey(p))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
r.Ops = (r.Ops ?? new()).Distinct().ToList();
|
||||
r.WidgetGrants ??= new();
|
||||
if (string.IsNullOrWhiteSpace(r.Scope)) r.Scope = PageCatalog.ScopePlatform;
|
||||
|
||||
Reference in New Issue
Block a user