import { h } from 'vue' import { ElInputNumber, ElTag } from 'element-plus' import ArtButtonMore from '@/components/core/forms/art-button-more/index.vue' import ArtButtonTable from '@/components/core/forms/art-button-table/index.vue' export function createOutBoundInventoryTableColumns({ handleViewDetail, handleAddToBasket } = {}) { return [ { type: 'selection', width: 48, align: 'center' }, { type: 'globalIndex', label: '序号', width: 72, align: 'center' }, { prop: 'locCode', label: '库位编码', minWidth: 150, showOverflowTooltip: true, formatter: (row) => row.locCode || '--' }, { prop: 'matnrCode', label: '物料编码', minWidth: 150, showOverflowTooltip: true, formatter: (row) => row.matnrCode || '--' }, { prop: 'maktx', label: '物料名称', minWidth: 220, showOverflowTooltip: true, formatter: (row) => row.maktx || '--' }, { prop: 'batch', label: '批次', minWidth: 130, showOverflowTooltip: true, formatter: (row) => row.batch || '--' }, { prop: 'splrBatch', label: '供应商批次', minWidth: 150, showOverflowTooltip: true, formatter: (row) => row.splrBatch || '--' }, { prop: 'trackCode', label: '追踪码', minWidth: 160, showOverflowTooltip: true, formatter: (row) => row.trackCode || '--' }, { prop: 'anfme', label: '可用数量', width: 110, align: 'right' }, { prop: 'workQty', label: '执行数量', width: 110, align: 'right' }, { prop: 'qty', label: '完成数量', width: 110, align: 'right' }, { prop: 'unit', label: '单位', width: 90 }, { prop: 'statusText', label: '状态', width: 100, formatter: (row) => h( ElTag, { type: row.statusTagType || 'info', effect: 'light' }, () => row.statusText || '--' ) }, { prop: 'updateTimeText', label: '更新时间', minWidth: 170, showOverflowTooltip: true, formatter: (row) => row.updateTimeText || '--' }, { prop: 'operation', label: '操作', width: 120, align: 'center', fixed: 'right', formatter: (row) => h(ArtButtonMore, { list: [ { key: 'view', label: '查看详情', icon: 'ri:eye-line' }, { key: 'add', label: '加入任务', icon: 'ri:add-line' } ], onClick: (item) => { if (item.key === 'view') handleViewDetail?.(row) if (item.key === 'add') handleAddToBasket?.([row]) } }) } ] } export function createOutBoundBasketTableColumns({ handleRemoveBasketRow, handleOutQtyChange } = {}) { return [ { type: 'globalIndex', label: '序号', width: 72, align: 'center' }, { prop: 'locCode', label: '库位编码', minWidth: 150, showOverflowTooltip: true, formatter: (row) => row.locCode || '--' }, { prop: 'matnrCode', label: '物料编码', minWidth: 150, showOverflowTooltip: true, formatter: (row) => row.matnrCode || '--' }, { prop: 'maktx', label: '物料名称', minWidth: 220, showOverflowTooltip: true, formatter: (row) => row.maktx || '--' }, { prop: 'batch', label: '批次', minWidth: 130, showOverflowTooltip: true, formatter: (row) => row.batch || '--' }, { prop: 'splrBatch', label: '供应商批次', minWidth: 150, showOverflowTooltip: true, formatter: (row) => row.splrBatch || '--' }, { prop: 'anfme', label: '可用数量', width: 110, align: 'right' }, { prop: 'workQty', label: '执行数量', width: 110, align: 'right' }, { prop: 'outQty', label: '出库数量', minWidth: 140, align: 'right', formatter: (row) => h(ElInputNumber, { modelValue: Number(row.outQty ?? row.anfme ?? 0), min: 0, precision: 3, controlsPosition: 'right', style: 'width: 100%', 'onUpdate:modelValue': (value) => handleOutQtyChange?.(row, value) }) }, { prop: 'unit', label: '单位', width: 90 }, { prop: 'siteNo', label: '站点号', minWidth: 140, showOverflowTooltip: true, formatter: (row) => row.siteNo || '--' }, { prop: 'operation', label: '操作', width: 120, align: 'center', fixed: 'right', formatter: (row) => h(ArtButtonTable, { icon: 'ri:delete-bin-5-line', title: '移除', onClick: () => handleRemoveBasketRow?.(row) }) } ] }