diff --git a/apps/web-antd/src/api/erp/purchase/order/index.ts b/apps/web-antd/src/api/erp/purchase/order/index.ts index 69c9a551f81e04fff6459d9184049ef2e72accf7..ae84c24345081bbec976e4ad628b103efda77c39 100644 --- a/apps/web-antd/src/api/erp/purchase/order/index.ts +++ b/apps/web-antd/src/api/erp/purchase/order/index.ts @@ -3,25 +3,64 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; export namespace ErpPurchaseOrderApi { + /** ERP 采购订单项信息 */ + export interface PurchaseOrderItem { + id?: number; // 订单项编号 + orderId?: number; // 采购订单编号 + productId?: number; // 产品编号 + productName?: string; // 产品名称 + productBarCode?: string; // 产品条码 + productUnitId?: number; // 产品单位编号 + productUnitName?: string; // 产品单位名称 + productPrice?: number; // 产品单价,单位:元 + totalProductPrice?: number; // 产品总价,单位:元 + count?: number; // 数量 + totalPrice?: number; // 总价,单位:元 + taxPercent?: number; // 税率,百分比 + taxPrice?: number; // 税额,单位:元 + totalTaxPrice?: number; // 含税总价,单位:元 + remark?: string; // 备注 + stockCount?: number; // 库存数量(显示字段) + } + /** ERP 采购订单信息 */ export interface PurchaseOrder { id?: number; // 订单工单编号 - no: string; // 采购订单号 - supplierId: number; // 供应商编号 - orderTime: Date; // 订单时间 - totalCount: number; // 合计数量 - totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 - inCount: number; // 采购入库数量 - returnCount: number; // 采购退货数量 + no?: string; // 采购订单号 + supplierId?: number; // 供应商编号 + supplierName?: string; // 供应商名称 + orderTime?: Date | string; // 订单时间 + totalCount?: number; // 合计数量 + totalPrice?: number; // 合计金额,单位:元 + totalProductPrice?: number; // 产品金额,单位:元 + discountPercent?: number; // 优惠率,百分比 + discountPrice?: number; // 优惠金额,单位:元 + depositPrice?: number; // 定金金额,单位:元 + accountId?: number; // 结算账户编号 + status?: number; // 状态 + remark?: string; // 备注 + fileUrl?: string; // 附件地址 + inCount?: number; // 采购入库数量 + returnCount?: number; // 采购退货数量 + inStatus?: number; // 入库状态 + returnStatus?: number; // 退货状态 + productNames?: string; // 产品名称列表 + creatorName?: string; // 创建人名称 + createTime?: Date; // 创建时间 + items?: PurchaseOrderItem[]; // 订单项列表 } /** 采购订单分页查询参数 */ export interface PurchaseOrderPageParam extends PageParam { no?: string; supplierId?: number; + productId?: number; + orderTime?: string[]; status?: number; + remark?: string; + creator?: string; + inStatus?: number; + returnStatus?: number; } } @@ -60,7 +99,12 @@ export function updatePurchaseOrderStatus(id: number, status: number) { } /** 删除采购订单 */ -export function deletePurchaseOrder(ids: number[]) { +export function deletePurchaseOrder(id: number) { + return requestClient.delete(`/erp/purchase-order/delete?id=${id}`); +} + +/** 批量删除采购订单 */ +export function deletePurchaseOrderList(ids: number[]) { return requestClient.delete('/erp/purchase-order/delete', { params: { ids: ids.join(',') }, }); diff --git a/apps/web-antd/src/views/crm/product/modules/product-table.vue b/apps/web-antd/src/views/crm/product/modules/product-table.vue index 4b01eacdcc0c0958e06cf0cb2f58cfe0d4ac36b3..9518396d77107fc97e4a262953ff700212f76ef1 100644 --- a/apps/web-antd/src/views/crm/product/modules/product-table.vue +++ b/apps/web-antd/src/views/crm/product/modules/product-table.vue @@ -66,7 +66,7 @@ function handleUpdateValue(row: any) { } else { tableData.value[index] = row; } - emit('update:products', tableData.value); + emit('update:products', [...tableData.value]); } /** 表格配置 */ diff --git a/apps/web-antd/src/views/erp/purchase/order/data.ts b/apps/web-antd/src/views/erp/purchase/order/data.ts new file mode 100644 index 0000000000000000000000000000000000000000..0aa86f65ebc1e753a9f1e6bdec9d5c39a6eb3761 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/order/data.ts @@ -0,0 +1,427 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpPriceInputFormatter } from '@vben/utils'; + +import { z } from '#/adapter/form'; +import { getAccountSimpleList } from '#/api/erp/finance/account'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getSupplierSimpleList } from '#/api/erp/purchase/supplier'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '订单单号', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'supplierId', + label: '供应商', + rules: 'required', + }, + { + component: 'DatePicker', + componentProps: { + placeholder: '选择订单时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'orderTime', + label: '订单时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 2, maxRows: 4 }, + class: 'w-full', + }, + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-3', + }, + { + component: 'FileUpload', + componentProps: { + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '请输入优惠率', + min: 0, + max: 100, + precision: 2, + style: { width: '100%' }, + }, + fieldName: 'discountPercent', + label: '优惠率(%)', + rules: z.number().min(0).optional(), + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '付款优惠', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountPrice', + label: '付款优惠', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '优惠后金额', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'totalPrice', + label: '优惠后金额', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '请输入支付订金', + precision: 2, + style: { width: '100%' }, + min: 0, + }, + fieldName: 'depositPrice', + label: '支付订金', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function usePurchaseOrderItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + 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: 50, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '订单单号', + component: 'Input', + componentProps: { + placeholder: '请输入订单单号', + allowClear: true, + disabled: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'orderTime', + label: '订单时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'supplierId', + label: '供应商', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + placeholder: '请选择状态', + allowClear: true, + }, + }, + { + fieldName: 'returnStatus', + label: '退货状态', + component: 'Select', + componentProps: { + options: [ + { label: '未退货', value: 0 }, + { label: '部分退货', value: 1 }, + { label: '全部退货', value: 2 }, + ], + placeholder: '请选择退货状态', + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '订单单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'supplierName', + title: '供应商', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDateTime', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'inCount', + title: '入库数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '退货数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'depositPrice', + title: '支付订金', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + width: 220, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/purchase/order/index.vue b/apps/web-antd/src/views/erp/purchase/order/index.vue index e7c22293c5d686715da27600faa4f0a405aeb54c..bc9552c8024b7895359a50c8cca9ed1e3ad5b525 100644 --- a/apps/web-antd/src/views/erp/purchase/order/index.vue +++ b/apps/web-antd/src/views/erp/purchase/order/index.vue @@ -1,34 +1,270 @@ - + - - 该功能支持 Vue3 + element-plus 版本! - - - - 可参考 - https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/erp/purchase/order/index - 代码,pull request 贡献给我们! - + + + + + + + + + + + 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 new file mode 100644 index 0000000000000000000000000000000000000000..7eae56d17a1716640c3a427d4be41eb5d50a24fc --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/order/modules/PurchaseOrderItemForm.vue @@ -0,0 +1,358 @@ + + + + + + + {{ row.productName || '-' }} + + + + + {{ row.count || '-' }} + + + + + {{ row.productPrice || '-' }} + + + + + {{ row.taxPercent || '-' }} + + + + + {{ row.remark || '-' }} + + + + + + 合计: + + 数量:{{ 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 new file mode 100644 index 0000000000000000000000000000000000000000..d1399bfa261b3ab04d6b36b77f548ab9ae544a43 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/order/modules/form.vue @@ -0,0 +1,212 @@ + + + + + + + + + + +