| | |
| | | import { h } from 'vue' |
| | | import ArtButtonMore from '@/components/core/forms/art-button-more/index.vue' |
| | | import { ElTag } from 'element-plus' |
| | | import { $t } from '@/locales' |
| | | import { getRoleStatusMeta } from './rolePage.helpers' |
| | | |
| | | const ROLE_MORE_ACTIONS = [ |
| | | { |
| | | key: 'scope-menu', |
| | | label: '网页权限', |
| | | icon: 'ri:layout-2-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'scope-pda', |
| | | label: 'PDA权限', |
| | | icon: 'ri:smartphone-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'scope-matnr', |
| | | label: '物料权限', |
| | | icon: 'ri:archive-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'scope-warehouse', |
| | | label: '仓库权限', |
| | | icon: 'ri:store-2-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'edit', |
| | | label: '编辑角色', |
| | | icon: 'ri:edit-2-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'delete', |
| | | label: '删除角色', |
| | | icon: 'ri:delete-bin-4-line', |
| | | color: '#f56c6c', |
| | | auth: 'delete' |
| | | } |
| | | ] |
| | | function createRoleMoreActions() { |
| | | return [ |
| | | { |
| | | key: 'scope-menu', |
| | | label: $t('pages.system.role.actions.scopeMenu'), |
| | | icon: 'ri:layout-2-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'scope-pda', |
| | | label: $t('pages.system.role.actions.scopePda'), |
| | | icon: 'ri:smartphone-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'scope-matnr', |
| | | label: $t('pages.system.role.actions.scopeMatnr'), |
| | | icon: 'ri:archive-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'scope-warehouse', |
| | | label: $t('pages.system.role.actions.scopeWarehouse'), |
| | | icon: 'ri:store-2-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'edit', |
| | | label: $t('pages.system.role.actions.edit'), |
| | | icon: 'ri:edit-2-line', |
| | | auth: 'edit' |
| | | }, |
| | | { |
| | | key: 'delete', |
| | | label: $t('pages.system.role.actions.delete'), |
| | | icon: 'ri:delete-bin-4-line', |
| | | color: '#f56c6c', |
| | | auth: 'delete' |
| | | } |
| | | ] |
| | | } |
| | | |
| | | function createTextColumn(prop, label, minWidth, extra = {}) { |
| | | return { |
| | |
| | | export function createRoleTableColumns(handleActionClick) { |
| | | return [ |
| | | { type: 'selection', width: 52, fixed: 'left' }, |
| | | createTextColumn('name', '角色名称', 140), |
| | | createTextColumn('code', '角色编码', 140), |
| | | createTextColumn('memo', '备注', 180), |
| | | createTagColumn('status', '状态', 120, (row) => getRoleStatusMeta(row.statusBool ?? row.status)), |
| | | createTextColumn('updateTimeText', '更新时间', 180, { |
| | | createTextColumn('name', $t('pages.system.role.table.name'), 140), |
| | | createTextColumn('code', $t('pages.system.role.table.code'), 140), |
| | | createTextColumn('memo', $t('pages.system.role.table.memo'), 180), |
| | | createTagColumn('status', $t('pages.system.role.table.status'), 120, (row) => getRoleStatusMeta(row.statusBool ?? row.status)), |
| | | createTextColumn('updateTimeText', $t('pages.system.role.table.updateTime'), 180, { |
| | | sortable: true, |
| | | formatter: (row) => row.updateTimeText || '-' |
| | | }), |
| | | createTextColumn('createTimeText', '创建时间', 180, { |
| | | createTextColumn('createTimeText', $t('pages.system.role.table.createTime'), 180, { |
| | | sortable: true, |
| | | formatter: (row) => row.createTimeText || '-' |
| | | }), |
| | | { |
| | | prop: 'operation', |
| | | label: '操作', |
| | | label: $t('pages.system.role.table.operation'), |
| | | width: 120, |
| | | align: 'center', |
| | | fixed: 'right', |
| | | formatter: (row) => |
| | | h(ArtButtonMore, { |
| | | list: ROLE_MORE_ACTIONS, |
| | | list: createRoleMoreActions(), |
| | | onClick: (item) => handleActionClick(item, row) |
| | | }) |
| | | } |