zhou zhou
昨天 3fdcf1d5e6468c735532e67bde5ff1cdf85bb0c6
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
97
98
99
100
101
102
103
104
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'
  }
]
 
export function createRoleTableColumns(handleActionClick) {
  return [
    { type: 'selection', width: 52, fixed: 'left' },
    {
      prop: 'name',
      label: '角色名称',
      minWidth: 140,
      showOverflowTooltip: true
    },
    {
      prop: 'code',
      label: '角色编码',
      minWidth: 140,
      showOverflowTooltip: true
    },
    {
      prop: 'memo',
      label: '备注',
      minWidth: 180,
      showOverflowTooltip: true
    },
    {
      prop: 'status',
      label: '状态',
      width: 120,
      formatter: (row) => {
        const statusMeta = getRoleStatusMeta(row.statusBool ?? row.status)
        return h(ElTag, { type: statusMeta.type, effect: 'light' }, () => statusMeta.text)
      }
    },
    {
      prop: 'updateTimeText',
      label: '更新时间',
      minWidth: 180,
      sortable: true,
      formatter: (row) => row.updateTimeText || '-'
    },
    {
      prop: 'createTimeText',
      label: '创建时间',
      minWidth: 180,
      sortable: true,
      formatter: (row) => row.createTimeText || '-'
    },
    {
      prop: 'operation',
      label: '操作',
      width: 120,
      fixed: 'right',
      formatter: (row) =>
        h('div', [
          h(ArtButtonMore, {
            list: ROLE_MORE_ACTIONS,
            onClick: (item) => handleActionClick(item, row)
          })
        ])
    }
  ]
}