| | |
| | | const ROLE_STATUS_META = { |
| | | 1: { type: 'success', text: '正常', bool: true }, |
| | | 0: { type: 'danger', text: '禁用', bool: false } |
| | | } |
| | | import { $t } from '@/locales' |
| | | |
| | | const ROLE_STATUS_OPTIONS = [ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 } |
| | | ] |
| | | const ROLE_STATUS_META = { |
| | | 1: { type: 'success', key: 'common.status.normal', bool: true }, |
| | | 0: { type: 'danger', key: 'common.status.disabled', bool: false } |
| | | } |
| | | |
| | | export function createRoleSearchState() { |
| | | return { |
| | |
| | | } |
| | | |
| | | export function getRoleStatusOptions() { |
| | | return ROLE_STATUS_OPTIONS.map((option) => ({ ...option })) |
| | | return [ |
| | | { label: $t('common.status.normal'), value: 1 }, |
| | | { label: $t('common.status.disabled'), value: 0 } |
| | | ] |
| | | } |
| | | |
| | | export function buildRoleSearchParams(params = {}) { |
| | |
| | | } |
| | | |
| | | const ROLE_REPORT_COLUMNS = [ |
| | | { source: 'name', label: '角色名称' }, |
| | | { source: 'code', label: '角色编码' }, |
| | | { source: 'statusText', label: '状态' }, |
| | | { source: 'memo', label: '备注' }, |
| | | { source: 'createTimeText', label: '创建时间' }, |
| | | { source: 'updateTimeText', label: '更新时间' } |
| | | { source: 'name', labelKey: 'pages.system.role.table.name' }, |
| | | { source: 'code', labelKey: 'pages.system.role.table.code' }, |
| | | { source: 'statusText', labelKey: 'pages.system.role.table.status' }, |
| | | { source: 'memo', labelKey: 'pages.system.role.table.memo' }, |
| | | { source: 'createTimeText', labelKey: 'pages.system.role.table.createTime' }, |
| | | { source: 'updateTimeText', labelKey: 'pages.system.role.table.updateTime' } |
| | | ] |
| | | |
| | | const ROLE_REPORT_SOURCE_ALIAS = { |
| | | status: 'statusText' |
| | | } |
| | | |
| | | export const ROLE_REPORT_TITLE = '角色管理报表' |
| | | export function getRoleReportTitle() { |
| | | return $t('pages.system.role.reportTitle') |
| | | } |
| | | |
| | | export const ROLE_REPORT_STYLE = { |
| | | titleAlign: 'center', |
| | |
| | | } |
| | | |
| | | export function getRoleReportColumns() { |
| | | return ROLE_REPORT_COLUMNS.map((column) => ({ ...column })) |
| | | return ROLE_REPORT_COLUMNS.map((column) => ({ |
| | | source: column.source, |
| | | label: $t(column.labelKey) |
| | | })) |
| | | } |
| | | |
| | | export function resolveRoleReportColumns(columns = []) { |
| | |
| | | const allowedColumn = allowedColumns.get(source) |
| | | return { |
| | | source, |
| | | label: column.label || allowedColumn.label |
| | | label: column.label || $t(allowedColumn.labelKey) |
| | | } |
| | | }) |
| | | .filter(Boolean) |
| | |
| | | titleLevel = ROLE_REPORT_STYLE.titleLevel |
| | | } = {}) { |
| | | return { |
| | | reportTitle: ROLE_REPORT_TITLE, |
| | | reportTitle: getRoleReportTitle(), |
| | | reportDate: previewMeta.reportDate, |
| | | printedAt: previewMeta.printedAt, |
| | | operator: previewMeta.operator, |
| | |
| | | return { |
| | | ...record, |
| | | statusBool: record.statusBool !== void 0 ? Boolean(record.statusBool) : statusMeta.bool, |
| | | statusText: statusMeta.text, |
| | | statusText: $t(statusMeta.key), |
| | | statusType: statusMeta.type, |
| | | createTimeText: normalizeText(record.createTime$ || record.createTime), |
| | | updateTimeText: normalizeText(record.updateTime$ || record.updateTime) |
| | |
| | | if (status === false || status === 0 || status === '0') { |
| | | return ROLE_STATUS_META[0] |
| | | } |
| | | return { type: 'info', text: '未知', bool: false } |
| | | return { type: 'info', key: 'common.status.unknown', bool: false } |
| | | } |
| | | |
| | | export function getRoleScopeConfig(scopeType) { |
| | | const configMap = { |
| | | menu: { |
| | | scopeType: 'menu', |
| | | title: '网页权限', |
| | | title: $t('pages.system.role.scopes.menu'), |
| | | listUrl: '/role/scope/list', |
| | | treeUrl: '/menu/tree' |
| | | }, |
| | | pda: { |
| | | scopeType: 'pda', |
| | | title: 'PDA权限', |
| | | title: $t('pages.system.role.scopes.pda'), |
| | | listUrl: '/rolePda/scope/list', |
| | | treeUrl: '/menuPda/tree' |
| | | }, |
| | | matnr: { |
| | | scopeType: 'matnr', |
| | | title: '物料权限', |
| | | title: $t('pages.system.role.scopes.matnr'), |
| | | listUrl: '/roleMatnr/scope/list', |
| | | treeUrl: '/menuMatnrGroup/tree' |
| | | }, |
| | | warehouse: { |
| | | scopeType: 'warehouse', |
| | | title: '仓库权限', |
| | | title: $t('pages.system.role.scopes.warehouse'), |
| | | listUrl: '/roleWarehouse/scope/list', |
| | | treeUrl: '/menuWarehouse/tree' |
| | | } |