| | |
| | | import ArtButtonTable from '@/components/core/forms/art-button-table/index.vue' |
| | | import { $t } from '@/locales' |
| | | |
| | | export function createDictTypeTableColumns({ handleView, handleEdit, handleDelete, t = $t }) { |
| | | export function createDictTypeTableColumns({ |
| | | handleView, |
| | | handleEdit, |
| | | handleDelete, |
| | | handleManageData, |
| | | t = $t |
| | | }) { |
| | | const hasStandaloneView = !handleManageData && handleView |
| | | |
| | | return [ |
| | | { |
| | | prop: 'code', |
| | |
| | | label: t('table.status'), |
| | | width: 100, |
| | | formatter: (row) => |
| | | h(ElTag, { type: row.statusType, effect: 'light' }, () => row.statusText || t('common.placeholder.empty')) |
| | | h( |
| | | ElTag, |
| | | { type: row.statusType, effect: 'light' }, |
| | | () => row.statusText || t('common.placeholder.empty') |
| | | ) |
| | | }, |
| | | { |
| | | prop: 'updateByLabel', |
| | |
| | | { |
| | | prop: 'operation', |
| | | label: t('table.operation'), |
| | | width: handleDelete ? 160 : 120, |
| | | width: handleDelete ? (hasStandaloneView ? 200 : 240) : hasStandaloneView ? 160 : 200, |
| | | align: 'center', |
| | | formatter: (row) => { |
| | | const buttons = [ |
| | | h(ArtButtonTable, { |
| | | type: 'view', |
| | | onClick: () => handleView(row) |
| | | }), |
| | | const buttons = [] |
| | | |
| | | if (handleManageData) { |
| | | buttons.push( |
| | | h(ArtButtonTable, { |
| | | type: 'view', |
| | | onClick: () => handleManageData(row) |
| | | }) |
| | | ) |
| | | } |
| | | |
| | | if (hasStandaloneView) { |
| | | buttons.push( |
| | | h(ArtButtonTable, { |
| | | type: 'view', |
| | | onClick: () => handleView(row) |
| | | }) |
| | | ) |
| | | } |
| | | |
| | | buttons.push( |
| | | h(ArtButtonTable, { |
| | | type: 'edit', |
| | | onClick: () => handleEdit(row) |
| | | }) |
| | | ] |
| | | ) |
| | | |
| | | if (handleDelete) { |
| | | buttons.push( |
| | |
| | | ) |
| | | } |
| | | |
| | | return h('div', { class: 'flex justify-center' }, buttons) |
| | | return h('div', { class: 'flex items-center justify-center gap-2' }, buttons) |
| | | } |
| | | } |
| | | ] |