diff --git a/apps/web-antd/src/views/erp/purchase/order/data.ts b/apps/web-antd/src/views/erp/purchase/order/data.ts index 897d25ee5..60f9e2954 100644 --- a/apps/web-antd/src/views/erp/purchase/order/data.ts +++ b/apps/web-antd/src/views/erp/purchase/order/data.ts @@ -128,6 +128,82 @@ export function useFormSchema(): VbenFormSchema[] { ]; } +/** 采购订单项表格列定义 */ +export function usePurchaseOrderItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50 }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + title: '金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + slots: { default: 'taxPercent' }, + }, + { + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + title: '税额合计', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'remark', + title: '备注', + minWidth: 150, + slots: { default: 'remark' }, + }, + { + title: '操作', + width: 120, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + /** 列表的搜索表单 */ export function useGridFormSchema(): VbenFormSchema[] { return [ diff --git a/apps/web-antd/src/views/erp/purchase/order/modules/PurchaseOrderItemForm.vue b/apps/web-antd/src/views/erp/purchase/order/modules/PurchaseOrderItemForm.vue index 158549f4f..f17254326 100644 --- a/apps/web-antd/src/views/erp/purchase/order/modules/PurchaseOrderItemForm.vue +++ b/apps/web-antd/src/views/erp/purchase/order/modules/PurchaseOrderItemForm.vue @@ -1,148 +1,127 @@ - - - - 添加产品 - - + + + + {{ row.productName || '-' }} + - - - - - onChangeProduct(value, index)" - class="w-full" - > - - {{ product.name }} - - - {{ record.productName || '-' }} - + + + {{ row.count || '-' }} + - - - onCountChange(value, index)" - class="w-full" - /> - {{ record.count || '-' }} - + + + {{ row.productPrice || '-' }} + - - - onPriceChange(value, index)" - class="w-full" - /> - {{ record.productPrice || '-' }} - + + + {{ row.taxPercent || '-' }} + - - - onTaxPercentChange(value, index)" - class="w-full" - /> - {{ record.taxPercent || '-' }} - + + + {{ row.remark || '-' }} + - - - - onRemarkChange((e.target as HTMLInputElement).value, index) - " - class="w-full" - /> - {{ record.remark || '-' }} - - - - - - 删除 - - - - - - - - - 合计: - - 数量:{{ getSummaries().count }} - 金额:{{ getSummaries().totalProductPrice }} - 税额:{{ getSummaries().taxPrice }} - 税额合计:{{ getSummaries().totalPrice }} + + + + + 合计: + + 数量:{{ getSummaries().count }} + 金额:{{ getSummaries().totalProductPrice }} + 税额:{{ getSummaries().taxPrice }} + 税额合计:{{ getSummaries().totalPrice }} + - - + + + + + + + + diff --git a/apps/web-antd/src/views/erp/purchase/order/modules/form.vue b/apps/web-antd/src/views/erp/purchase/order/modules/form.vue index 93d62604a..fc56e02d0 100644 --- a/apps/web-antd/src/views/erp/purchase/order/modules/form.vue +++ b/apps/web-antd/src/views/erp/purchase/order/modules/form.vue @@ -67,6 +67,12 @@ watch( { deep: true }, ); +const handleUpdateItems = (items: ErpPurchaseOrderApi.PurchaseOrderItem[]) => { + if (formData.value) { + formData.value.items = items; + } +}; + const [Modal, modalApi] = useVbenModal({ async onConfirm() { const { valid } = await formApi.validate(); @@ -138,6 +144,7 @@ defineExpose({ modalApi }); ref="itemFormRef" :items="formData?.items || []" :disabled="formType === 'detail'" + @update:items="handleUpdateItems" />