constants.ts 624 Bytes
import type { FieldOption } from '@/components';
import { dataScopeOptions } from '@/constants/dataScope';

/** 角色管理页专用的下拉选项。 */

export const baseList = {
  roleType: [
    { label: '内置', value: 1 },
    { label: '自定义', value: 0 },
  ],
  roleStatus: [
    { label: '启用', value: 1 },
    { label: '停用', value: 0 },
  ],
  dataScope: dataScopeOptions,
} satisfies Record<string, FieldOption[]>;

export function getBaseList(key: keyof typeof baseList, includeAll = true): FieldOption[] {
  return includeAll ? [{ label: '全部', value: '' }, ...baseList[key]] : baseList[key];
}