feat: 統一庫存管理分頁 UI 與寬度規範,並更新 SKILL 規範文件

This commit is contained in:
2026-02-03 17:24:34 +08:00
parent 15aaa039e4
commit bd999c7bb6
17 changed files with 357 additions and 205 deletions

View File

@@ -70,16 +70,20 @@ export default function RoleEdit({ role, groupedPermissions, currentPermissions
const translateAction = (permissionName: string) => {
const parts = permissionName.split('.');
if (parts.length < 2) return permissionName;
const action = parts[1];
const action = parts[parts.length - 1];
const map: Record<string, string> = {
'view': '檢視',
'create': '新增',
'edit': '編輯',
'delete': '刪除',
'publish': '發',
'publish': '發',
'adjust': '調整',
'transfer': '調撥',
'count': '盤點',
// 'inventory_count': '盤點', // Hide prefix
// 'inventory_adjust': '盤調', // Hide prefix
// 'inventory_transfer': '調撥', // Hide prefix
'safety_stock': '安全庫存設定',
'export': '匯出',
'complete': '完成',
@@ -88,7 +92,19 @@ export default function RoleEdit({ role, groupedPermissions, currentPermissions
'activate': '啟用/停用',
};
return map[action] || action;
const actionText = map[action] || action;
// 處理多段式權限 (例如 inventory_count.view)
if (parts.length >= 2) {
const middleKey = parts[parts.length - 2];
// 如果中間那段有翻譯且不等於動作本身,則顯示為 "標籤: 動作"
if (map[middleKey] && middleKey !== action) {
return `${map[middleKey]}: ${actionText}`;
}
}
return actionText;
};
return (