| | |
| | | import { h } from 'vue' |
| | | import { ElTag } from 'element-plus' |
| | | import ArtButtonMore from '@/components/core/forms/art-button-more/index.vue' |
| | | import { getMatnrGroupStatusMeta } from './matnrGroupPage.helpers' |
| | | |
| | | export function createMatnrGroupTableColumns({ |
| | | handleView, |
| | | handleEdit, |
| | | handleDelete, |
| | | resolveParentLabel, |
| | | canEdit = true, |
| | | canDelete = true |
| | | }) { |
| | |
| | | align: 'center' |
| | | }, |
| | | { |
| | | type: 'globalIndex', |
| | | label: '序号', |
| | | width: 72, |
| | | align: 'center' |
| | | }, |
| | | { |
| | | prop: 'name', |
| | | label: '分组名称', |
| | | minWidth: 180, |
| | | showOverflowTooltip: true |
| | | }, |
| | | { |
| | | prop: 'code', |
| | | label: '分组编码', |
| | | minWidth: 150, |
| | | showOverflowTooltip: true |
| | | }, |
| | | { |
| | | prop: 'parentLabel', |
| | | label: '上级分组', |
| | | minWidth: 160, |
| | | showOverflowTooltip: true, |
| | | formatter: (row) => { |
| | | if (typeof resolveParentLabel === 'function') { |
| | | const resolved = resolveParentLabel(row.parentId) |
| | | if (resolved) { |
| | | return resolved |
| | | } |
| | | } |
| | | return row.parentLabel || (Number(row.parentId) === 0 ? '顶级分组' : '--') |
| | | } |
| | | showOverflowTooltip: true |
| | | }, |
| | | { |
| | | prop: 'parCode', |
| | | label: '上级编码', |
| | | minWidth: 160, |
| | | showOverflowTooltip: true |
| | | showOverflowTooltip: true, |
| | | formatter: (row) => row.parCode || '--' |
| | | }, |
| | | { |
| | | prop: 'sort', |
| | | label: '排序', |
| | | width: 90, |
| | | align: 'center' |
| | | }, |
| | | { |
| | | prop: 'status', |
| | | label: '状态', |
| | | width: 100, |
| | | align: 'center', |
| | | formatter: (row) => { |
| | | const statusMeta = getMatnrGroupStatusMeta(row.statusBool ?? row.status) |
| | | return h(ElTag, { type: statusMeta.type, effect: 'light' }, () => statusMeta.text) |
| | | } |
| | | }, |
| | | { |
| | | prop: 'memo', |
| | | label: '备注', |
| | | minWidth: 180, |
| | | showOverflowTooltip: true |
| | | }, |
| | | { |
| | | prop: 'createByText', |
| | | label: '创建人', |
| | | minWidth: 120, |
| | | showOverflowTooltip: true |
| | | }, |
| | | { |
| | | prop: 'createTimeText', |
| | | label: '创建时间', |
| | | minWidth: 170, |
| | | showOverflowTooltip: true |
| | | }, |
| | | { |
| | | prop: 'updateByText', |
| | | label: '更新人', |
| | | minWidth: 120, |
| | | showOverflowTooltip: true |
| | | }, |
| | | { |
| | | prop: 'updateTimeText', |
| | | label: '更新时间', |
| | | minWidth: 170, |
| | | prop: 'name', |
| | | label: '分组名称', |
| | | minWidth: 240, |
| | | showOverflowTooltip: true |
| | | }, |
| | | { |
| | | prop: 'operation', |
| | | label: '操作', |
| | | width: 160, |
| | | align: 'right', |
| | | width: 120, |
| | | align: 'center', |
| | | fixed: 'right', |
| | | formatter: (row) => |
| | | h(ArtButtonMore, { |
| | | list: operations, |