import { h } from 'vue' import { ElButton, ElTag } from 'element-plus' import { $t } from '@/locales' import ArtButtonMore from '@/components/core/forms/art-button-more/index.vue' import ArtButtonTable from '@/components/core/forms/art-button-table/index.vue' import { getAsnOrderActionList } from './asnOrderPage.helpers' export function createAsnOrderTableColumns({ handleActionClick }) { return [ { type: 'selection', width: 48, align: 'center' }, { type: 'globalIndex', label: $t('table.index'), width: 72, align: 'center' }, { prop: 'code', label: $t('pages.orders.asnOrder.search.code'), minWidth: 170, showOverflowTooltip: true }, { prop: 'poCode', label: $t('pages.orders.asnOrder.search.poCode'), minWidth: 170, showOverflowTooltip: true }, { prop: 'wkTypeLabel', label: $t('pages.orders.asnOrder.search.wkType'), minWidth: 130, showOverflowTooltip: true }, { prop: 'anfme', label: $t('pages.orders.asnOrder.detail.anfme'), width: 110, align: 'right' }, { prop: 'qty', label: $t('pages.orders.asnOrder.detail.qty'), width: 110, align: 'right' }, { prop: 'supplierName', label: $t('pages.orders.asnOrder.search.supplierName'), minWidth: 180, showOverflowTooltip: true }, { prop: 'purchaseUserName', label: $t('pages.orders.asnOrder.search.purchaseUserName'), minWidth: 120, showOverflowTooltip: true }, { prop: 'exceStatusText', label: $t('pages.orders.asnOrder.search.exceStatus'), width: 120, formatter: (row) => h( ElTag, { type: row.exceStatusTagType || 'info', effect: 'light' }, () => row.exceStatusText ) }, { prop: 'updateTimeText', label: $t('pages.orders.asnOrder.detail.updateTime'), minWidth: 170, showOverflowTooltip: true }, { prop: 'operation', label: $t('table.operation'), width: 120, align: 'center', fixed: 'right', formatter: (row) => h(ArtButtonMore, { list: getAsnOrderActionList(row), onClick: (item) => handleActionClick(item, row) }) } ] } export function createAsnOrderDetailItemColumns() { return [ { type: 'globalIndex', label: $t('table.index'), width: 72, align: 'center' }, { prop: 'matnrCode', label: $t('table.materialCode'), minWidth: 150, showOverflowTooltip: true }, { prop: 'maktx', label: $t('table.materialName'), minWidth: 220, showOverflowTooltip: true }, { prop: 'platItemId', label: $t('pages.orders.asnOrder.table.poItemId'), width: 110 }, { prop: 'splrBatch', label: $t('table.supplierBatch'), minWidth: 140, showOverflowTooltip: true }, { prop: 'splrName', label: $t('table.supplier'), minWidth: 180, showOverflowTooltip: true }, { prop: 'stockUnit', label: $t('table.unit'), width: 100 }, { prop: 'anfme', label: $t('pages.orders.asnOrder.table.expectedQty'), width: 110, align: 'right' }, { prop: 'qty', label: $t('pages.orders.asnOrder.table.receivedQty'), width: 110, align: 'right' }, { prop: 'memo', label: $t('table.remark'), minWidth: 180, showOverflowTooltip: true } ] } export function createAsnOrderPurchaseColumns({ handleChoosePurchase }) { return [ { type: 'globalIndex', label: $t('table.index'), width: 72, align: 'center' }, { prop: 'code', label: $t('pages.orders.asnOrder.search.poCode'), minWidth: 170, showOverflowTooltip: true }, { prop: 'wkTypeLabel', label: $t('pages.orders.asnOrder.search.wkType'), minWidth: 130, showOverflowTooltip: true }, { prop: 'source', label: $t('table.source'), minWidth: 140, showOverflowTooltip: true }, { prop: 'supplierName', label: $t('pages.orders.asnOrder.search.supplierName'), minWidth: 180, showOverflowTooltip: true }, { prop: 'purchaseUserName', label: $t('pages.orders.asnOrder.search.purchaseUserName'), minWidth: 120, showOverflowTooltip: true }, { prop: 'remainingQty', label: $t('pages.orders.asnOrder.table.remainingQty'), width: 120, align: 'right' }, { prop: 'exceStatusText', label: $t('pages.orders.asnOrder.table.poStatus'), minWidth: 120, showOverflowTooltip: true }, { prop: 'operation', label: $t('table.operation'), width: 120, align: 'center', fixed: 'right', formatter: (row) => h(ArtButtonTable, { type: 'view', onClick: () => handleChoosePurchase(row) }) } ] } export function createAsnOrderPurchaseItemColumns() { return [ { type: 'globalIndex', label: $t('table.index'), width: 72, align: 'center' }, { prop: 'platItemId', label: $t('pages.orders.asnOrder.table.poItemId'), width: 110 }, { prop: 'matnrCode', label: $t('table.materialCode'), minWidth: 150, showOverflowTooltip: true }, { prop: 'maktx', label: $t('table.materialName'), minWidth: 220, showOverflowTooltip: true }, { prop: 'splrName', label: $t('table.supplier'), minWidth: 180, showOverflowTooltip: true }, { prop: 'splrBatch', label: $t('table.supplierBatch'), minWidth: 140, showOverflowTooltip: true }, { prop: 'unit', label: $t('table.unit'), width: 100 }, { prop: 'anfme', label: $t('pages.orders.asnOrder.table.purchaseQty'), width: 110, align: 'right' }, { prop: 'qty', label: $t('pages.orders.asnOrder.table.generatedQty'), width: 130, align: 'right' }, { prop: 'nromQty', label: $t('pages.orders.asnOrder.table.receivedQtyTotal'), width: 110, align: 'right' }, { prop: 'selectAction', label: $t('table.operation'), minWidth: 120, formatter: () => h( ElButton, { link: true, type: 'primary', class: '!px-0' }, () => $t('pages.orders.asnOrder.buttons.createByPo') ) } ] }