1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
| import { h } from 'vue'
| import ArtButtonMore from '@/components/core/forms/art-button-more/index.vue'
| import { ElTag } from 'element-plus'
| 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 createTextColumn(prop, label, minWidth, extra = {}) {
| return {
| prop,
| label,
| minWidth,
| showOverflowTooltip: true,
| ...extra
| }
| }
|
| function createTagColumn(prop, label, width, resolveMeta) {
| return {
| prop,
| label,
| width,
| formatter: (row) => {
| const statusMeta = resolveMeta(row)
| return h(ElTag, { type: statusMeta.type, effect: 'light' }, () => statusMeta.text)
| }
| }
| }
|
| 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, {
| sortable: true,
| formatter: (row) => row.updateTimeText || '-'
| }),
| createTextColumn('createTimeText', '创建时间', 180, {
| sortable: true,
| formatter: (row) => row.createTimeText || '-'
| }),
| {
| prop: 'operation',
| label: '操作',
| width: 120,
| align: 'center',
| fixed: 'right',
| formatter: (row) =>
| h(ArtButtonMore, {
| list: ROLE_MORE_ACTIONS,
| onClick: (item) => handleActionClick(item, row)
| })
| }
| ]
| }
|
|