车间班次菜单调整到「生产-前缫」下

- 菜单归属由「基础数据」改为「生产-前缫」,路径 /base/chejianbanci → /prod/qianxian/chejianbanci
- 权限标识 base:chejianbanci:list → prod:chejianbanci:list
- 清理历史遗留的旧菜单与旧权限单元
- 页面组件路径保持 base/chejianbanci/index 不变,前端无需改动
This commit is contained in:
yanpeng200212
2026-10-12 16:37:07 +08:00
parent 2985003896
commit fe1ab34242
2 changed files with 22 additions and 18 deletions
Binary file not shown.
@@ -82,8 +82,7 @@ public static class DbSeeder
// 6.68 生产模块(按工序拆分:生产-前缫 / 生产-后缫) // 6.68 生产模块(按工序拆分:生产-前缫 / 生产-后缫)
SeedProdMenus(fsql, snowflake); SeedProdMenus(fsql, snowflake);
// 6.69 车间班次菜单(挂在"基础数据"目录下)+ 修正前缫部门的职责类型 // 6.69 修正前缫部门的职责类型(车间班次菜单随"生产-前缫"一起处理)
SeedChejianBanciMenus(fsql, snowflake);
FixQianxianDutyType(fsql); FixQianxianDutyType(fsql);
// 6.7 为菜单创建权限单元(Permission),并修正旧菜单权限关联(统一权限模型) // 6.7 为菜单创建权限单元(Permission),并修正旧菜单权限关联(统一权限模型)
@@ -675,10 +674,30 @@ public static class DbSeeder
} }
// 2) 两个一级目录 + 各自页面菜单 // 2) 两个一级目录 + 各自页面菜单
// 车间班次原先挂在"基础数据"目录下,现归入"生产-前缫"
var legacyChejianbanci = fsql.Select<SysMenu>().Where(m => m.Path == "/base/chejianbanci").First();
if (legacyChejianbanci != null)
{
fsql.Ado.ExecuteNonQuery($"DELETE FROM sys_rbac_role_permissions WHERE permission_id = {legacyChejianbanci.Id}");
fsql.Ado.ExecuteNonQuery($"DELETE FROM sys_rbac_menus WHERE id = {legacyChejianbanci.Id}");
Console.WriteLine("[DbSeeder] 已清理旧菜单 /base/chejianbanci(车间班次移入生产-前缫)");
}
// 一并清理旧菜单遗留的权限单元(权限标识已从 base:chejianbanci:list 改为 prod:chejianbanci:list)
var legacyPerms = fsql.Ado.ExecuteDataTable("SELECT id FROM sys_rbac_permissions WHERE code = 'base:chejianbanci:list'");
foreach (DataRow permRow in legacyPerms.Rows)
{
var permId = Convert.ToInt64(permRow["id"]);
fsql.Ado.ExecuteNonQuery($"DELETE FROM sys_rbac_role_permissions WHERE permission_id = {permId}");
fsql.Ado.ExecuteNonQuery($"DELETE FROM sys_rbac_permissions WHERE id = {permId}");
Console.WriteLine("[DbSeeder] 已清理旧权限单元 base:chejianbanci:list");
}
EnsureTopMenuWithChildren(fsql, snowflake, "/prod/qianxian", "生产-前缫", "Cpu", 5, EnsureTopMenuWithChildren(fsql, snowflake, "/prod/qianxian", "生产-前缫", "Cpu", 5,
new (string Name, string Path, string Component, string Permission, string Icon, int Sort)[] new (string Name, string Path, string Component, string Permission, string Icon, int Sort)[]
{ {
("落丝记录", "/prod/qianxian/lsjl", "prod/lsjl/index", "prod:lsjl:list", "Document", 1) ("落丝记录", "/prod/qianxian/lsjl", "prod/lsjl/index", "prod:lsjl:list", "Document", 1),
("车间班次", "/prod/qianxian/chejianbanci", "base/chejianbanci/index", "prod:chejianbanci:list", "Timer", 2)
}); });
EnsureTopMenuWithChildren(fsql, snowflake, "/prod/houxian", "生产-后缫", "DataLine", 6, EnsureTopMenuWithChildren(fsql, snowflake, "/prod/houxian", "生产-后缫", "DataLine", 6,
@@ -767,21 +786,6 @@ public static class DbSeeder
} }
} }
/// <summary>车间班次菜单(挂在"基础数据"目录下)</summary>
private static void SeedChejianBanciMenus(IFreeSql fsql, ISnowflakeIdGenerator snowflake)
{
try
{
EnsureBaseDataMenu(fsql, snowflake, "/base/chejianbanci", "车间班次",
"base/chejianbanci/index", "base:chejianbanci:list", "Timer", 11);
Console.WriteLine("[DbSeeder] 车间班次菜单已就绪");
}
catch (Exception ex)
{
Console.WriteLine($"[DbSeeder] 车间班次菜单种子跳过:{ex}");
}
}
/// <summary> /// <summary>
/// 修正前缫部门的职责类型:历史数据迁移时 duty_type 统一写成了"其他"(5), /// 修正前缫部门的职责类型:历史数据迁移时 duty_type 统一写成了"其他"(5),
/// 而车间班次等模块需要按职责类型(前缫=25)筛选部门。 /// 而车间班次等模块需要按职责类型(前缫=25)筛选部门。