oaEnums.ts 1.83 KB
/**
 * OA 枚举镜像(与后端 src/services/oa/enums.py 一一对应,取值必须一致)。
 * 改动任一枚举时两侧同步。
 */

export const Status = { ACTIVE: "active", DISABLED: "disabled" } as const;
export const StatusLabel: Record<string, string> = {
  active: "启用",
  disabled: "停用",
};

export const GrantStatus = { ACTIVE: "active", REVOKED: "revoked" } as const;

export const DeptCategory = { HQ: "hq", OUTSOURCE: "outsource", STORE: "store" } as const;
export const DeptCategoryLabel: Record<string, string> = { hq: "总部", outsource: "外包", store: "驻店" };

export const SourceType = {
  DIR: "M",
  MENU: "C",
  PAGE: "P",
  BUTTON: "F",
  API: "A",
} as const;
export const SourceTypeLabel: Record<string, string> = {
  M: "目录",
  C: "菜单",
  P: "页面",
  F: "按钮",
  A: "接口",
};

export const DataScope = {
  ALL: 1,
  CUSTOM: 2,
  DEPT: 3,
  DEPT_AND_SUB: 4,
  SELF: 5,
} as const;
export const DataScopeLabel: Record<number, string> = {
  1: "全部",
  2: "自定义",
  3: "本部门",
  4: "本部门及以下",
  5: "仅本人",
};

export const KbType = { BASE: "base", DEPT: "dept", PROJECT: "project" } as const;
export const KbTypeLabel: Record<string, string> = {
  base: "基础库",
  dept: "部门库",
  project: "项目库",
};

// 知识库权限三层模型:owner(绑定部门归属,由 kb.dept_id 承载,只作有效级别)
// / editor(可授权,读写)/ reader(可授权,只读)。
export const KbAccess = { OWNER: "owner", EDITOR: "editor", READER: "reader" } as const;
export const KbAccessLabel: Record<string, string> = {
  owner: "所有者",
  editor: "写权限",
  reader: "访问权限",
};

export const BuiltinRole = {
  SUPER_ADMIN: "super_admin",
  CENTER_LEAD: "center_lead",
  DEPT_LEAD: "dept_lead",
  STAFF: "staff",
  GUEST: "guest",
} as const;