codes.ts 1.63 KB
/**
 * 商户管理域权限码表(本子应用独占)。
 *
 * 逐字对应 scripts/merchant-menu-migration.sql 的 perm_code 列:
 * 3 个页面 :view(menu_type=2)+ 19 个动作(menu_type=3),域前缀 merchant:。
 * 老 H5 没有权限码概念(按钮由行数据字段控制),这里按现系统 `资源:动作` 格式新定义,
 * 动作名逐字取自老系统页面按钮;判定见 adapter/perms.ts 的三态闸门。
 */
export const MC = {
  // 商户管理 1002801
  MERCHANT_VIEW: 'merchant:merchant:view',
  MERCHANT_CREATE: 'merchant:merchant:create',
  MERCHANT_EDIT: 'merchant:merchant:edit',
  MERCHANT_DETAIL: 'merchant:merchant:detail',
  MERCHANT_CREATE_SUB: 'merchant:merchant:create-sub',
  MERCHANT_CREATE_STAFF: 'merchant:merchant:create-staff',
  MERCHANT_EDIT_PERIOD: 'merchant:merchant:edit-period',
  MERCHANT_EDIT_ACCESS_MODE: 'merchant:merchant:edit-access-mode',
  MERCHANT_IMPORT: 'merchant:merchant:import',

  // 员工管理 1002802
  EMPLOYEE_VIEW: 'merchant:employee:view',
  EMPLOYEE_CREATE: 'merchant:employee:create',
  EMPLOYEE_EDIT: 'merchant:employee:edit',
  EMPLOYEE_DETAIL: 'merchant:employee:detail',
  EMPLOYEE_DELETE: 'merchant:employee:delete',
  EMPLOYEE_TOGGLE_STATUS: 'merchant:employee:toggle-status',
  EMPLOYEE_EDIT_PERIOD: 'merchant:employee:edit-period',
  EMPLOYEE_EXPORT: 'merchant:employee:export',

  // 角色管理 1002803
  ROLE_VIEW: 'merchant:role:view',
  ROLE_CREATE: 'merchant:role:create',
  ROLE_EDIT: 'merchant:role:edit',
  ROLE_DETAIL: 'merchant:role:detail',
  ROLE_DELETE: 'merchant:role:delete',
} as const;

export type PermissionCode = (typeof MC)[keyof typeof MC];