zhou zhou
5 小时以前 6877c9caa25162e570a3e2a99a5b2ce3ef88368b
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
import { h } from 'vue'
import { ElTag } from 'element-plus'
import ArtButtonTable from '@/components/core/forms/art-button-table/index.vue'
import { $t } from '@/locales'
 
export function createDictDataTableColumns({ handleEdit, handleDelete, t = $t }) {
  return [
    {
      prop: 'dictTypeCode',
      label: '字典编码',
      minWidth: 140,
      showOverflowTooltip: true
    },
    {
      prop: 'value',
      label: '值',
      minWidth: 140,
      showOverflowTooltip: true
    },
    {
      prop: 'label',
      label: '标签',
      minWidth: 160,
      showOverflowTooltip: true
    },
    {
      prop: 'group',
      label: '分组',
      minWidth: 140,
      showOverflowTooltip: true,
      formatter: (row) => row.group || t('common.placeholder.empty')
    },
    {
      prop: 'sort',
      label: t('table.sort'),
      width: 90
    },
    {
      prop: 'status',
      label: t('table.status'),
      width: 100,
      formatter: (row) =>
        h(
          ElTag,
          { type: row.statusType, effect: 'light' },
          () => row.statusText || t('common.placeholder.empty')
        )
    },
    {
      prop: 'updateByLabel',
      label: t('table.updateBy'),
      width: 120,
      formatter: (row) => row.updateByLabel || t('common.placeholder.empty')
    },
    {
      prop: 'updateTimeText',
      label: t('table.updateTime'),
      minWidth: 180,
      formatter: (row) => row.updateTimeText || t('common.placeholder.empty')
    },
    {
      prop: 'memo',
      label: t('table.memo'),
      minWidth: 180,
      showOverflowTooltip: true,
      formatter: (row) => row.memo || t('common.placeholder.empty')
    },
    {
      prop: 'operation',
      label: t('table.operation'),
      width: handleDelete ? 120 : 80,
      align: 'center',
      formatter: (row) => {
        const buttons = [
          h(ArtButtonTable, {
            type: 'edit',
            onClick: () => handleEdit(row)
          })
        ]
 
        if (handleDelete) {
          buttons.push(
            h(ArtButtonTable, {
              type: 'delete',
              onClick: () => handleDelete(row)
            })
          )
        }
 
        return h('div', { class: 'flex justify-center' }, buttons)
      }
    }
  ]
}