diff --git a/apps/web-antd/src/api/erp/purchase/in/index.ts b/apps/web-antd/src/api/erp/purchase/in/index.ts index fde2c0fb..79664597 100644 --- a/apps/web-antd/src/api/erp/purchase/in/index.ts +++ b/apps/web-antd/src/api/erp/purchase/in/index.ts @@ -2,19 +2,45 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpPurchaseInApi { +export namespace ErpPurchaseInApi { /** 采购入库信息 */ export interface PurchaseIn { id?: number; // 入库工单编号 - no: string; // 采购入库号 - supplierId: number; // 供应商编号 - inTime: Date; // 入库时间 - totalCount: number; // 合计数量 - totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 - outCount: number; // 采购出库数量 - returnCount: number; // 采购退货数量 + no?: string; // 采购入库号 + supplierId?: number; // 供应商编号 + inTime?: Date; // 入库时间 + totalCount?: number; // 合计数量 + totalPrice?: number; // 合计金额,单位:元 + status?: number; // 状态 + remark?: string; // 备注 + outCount?: number; // 采购出库数量 + returnCount?: number; // 采购退货数量 + discountPercent?: number; // 折扣百分比 + discountPrice?: number; // 折扣金额 + paymentPrice?: number; // 实际支付金额 + otherPrice?: number; // 其他费用 + totalProductPrice?: number; // 合计商品金额 + taxPrice?: number; // 合计税额 + items?: PurchaseInItem[]; // 采购入库明细 + } + export interface PurchaseInItem { + count?: number; + id?: number; + orderItemId?: number; + productBarCode?: string; + productId?: number; + productName: string; + productPrice: number; + productUnitId?: number; + productUnitName?: string; + totalProductPrice?: number; + remark: string; + stockCount?: number; + taxPercent?: number; + taxPrice?: number; + totalPrice?: number; + warehouseId?: number; + inCount?: number; } /** 采购入库分页查询参数 */ @@ -71,11 +97,12 @@ export function updatePurchaseIn(data: ErpPurchaseInApi.PurchaseIn) { /** * 更新采购入库的状态 */ -export function updatePurchaseInStatus( - params: ErpPurchaseInApi.PurchaseInStatusParams, -) { +export function updatePurchaseInStatus(id: number, status: number) { return requestClient.put('/erp/purchase-in/update-status', null, { - params, + params: { + id, + status, + }, }); } 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 ae84c243..ec08dc17 100644 --- a/apps/web-antd/src/api/erp/purchase/order/index.ts +++ b/apps/web-antd/src/api/erp/purchase/order/index.ts @@ -41,6 +41,7 @@ export namespace ErpPurchaseOrderApi { remark?: string; // 备注 fileUrl?: string; // 附件地址 inCount?: number; // 采购入库数量 + count?: number; // 数量 returnCount?: number; // 采购退货数量 inStatus?: number; // 入库状态 returnStatus?: number; // 退货状态 diff --git a/apps/web-antd/src/api/erp/purchase/return/index.ts b/apps/web-antd/src/api/erp/purchase/return/index.ts index 461a76f7..86423c46 100644 --- a/apps/web-antd/src/api/erp/purchase/return/index.ts +++ b/apps/web-antd/src/api/erp/purchase/return/index.ts @@ -2,17 +2,40 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpPurchaseReturnApi { +export namespace ErpPurchaseReturnApi { /** 采购退货信息 */ export interface PurchaseReturn { id?: number; // 采购退货编号 - no: string; // 采购退货号 - supplierId: number; // 供应商编号 - returnTime: Date; // 退货时间 - totalCount: number; // 合计数量 + no?: string; // 采购退货号 + supplierId?: number; // 供应商编号 + returnTime?: Date; // 退货时间 + totalCount?: number; // 合计数量 totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 + discountPercent?: number; // 折扣百分比 + discountPrice?: number; // 折扣金额 + status?: number; // 状态 + remark?: string; // 备注 + totalTaxPrice?: number; // 合计税额 + otherPrice?: number; // 其他费用 + items?: PurchaseReturnItem[]; + } + export interface PurchaseReturnItem { + count?: number; + id?: number; + orderItemId?: number; + productBarCode?: string; + productId?: number; + productName: string; + productPrice: number; + productUnitId?: number; + productUnitName?: string; + totalProductPrice?: number; + remark: string; + stockCount?: number; + taxPercent?: number; + taxPrice?: number; + totalPrice?: number; + warehouseId?: number; } /** 采购退货分页查询参数 */ diff --git a/apps/web-antd/src/api/erp/sale/order/index.ts b/apps/web-antd/src/api/erp/sale/order/index.ts index 211a28e2..7bd9b4fa 100644 --- a/apps/web-antd/src/api/erp/sale/order/index.ts +++ b/apps/web-antd/src/api/erp/sale/order/index.ts @@ -8,13 +8,40 @@ export namespace ErpSaleOrderApi { id?: number; // 订单工单编号 no: string; // 销售订单号 customerId: number; // 客户编号 + accountId?: number; // 收款账户编号 orderTime: Date; // 订单时间 totalCount: number; // 合计数量 totalPrice: number; // 合计金额,单位:元 status: number; // 状态 remark: string; // 备注 outCount: number; // 销售出库数量 + fileUrl?: string; // 附件地址 + inCount?: number; // 采购入库数量 returnCount: number; // 销售退货数量 + totalProductPrice?: number; // 产品金额,单位:元 + discountPercent?: number; // 优惠率,百分比 + discountPrice?: number; // 优惠金额,单位:元 + depositPrice?: number; // 定金金额,单位:元 + items?: SaleOrderItem[]; // 销售订单产品明细列表 + } + /** ERP 销售订单产品明细 */ + export interface SaleOrderItem { + 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; // 库存数量(显示字段) } /** 销售订单分页查询参数 */ diff --git a/apps/web-antd/src/api/erp/sale/out/index.ts b/apps/web-antd/src/api/erp/sale/out/index.ts index 62045216..dc4f5d05 100644 --- a/apps/web-antd/src/api/erp/sale/out/index.ts +++ b/apps/web-antd/src/api/erp/sale/out/index.ts @@ -2,17 +2,45 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpSaleOutApi { +export namespace ErpSaleOutApi { /** 销售出库信息 */ export interface SaleOut { id?: number; // 销售出库编号 - no: string; // 销售出库号 - customerId: number; // 客户编号 - outTime: Date; // 出库时间 - totalCount: number; // 合计数量 - totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 + no?: string; // 销售出库号 + customerId?: number; // 客户编号 + saleUserId?: number; // 客户编号 + outTime?: Date; // 出库时间 + totalCount?: number; // 合计数量 + totalPrice?: number; // 合计金额,单位:元 + status?: number; // 状态 + remark?: string; // 备注 + discountPercent?: number; // 折扣百分比 + discountPrice?: number; // 折扣金额 + otherPrice?: number; // 其他费用 + totalProductPrice?: number; // 合计商品金额 + taxPrice?: number; // 合计税额 + totalTaxPrice?: number; // 合计税额 + fileUrl?: string; // 附件地址 + items?: SaleOutItem[]; + } + export interface SaleOutItem { + count?: number; + id?: number; + orderItemId?: number; + productBarCode?: string; + productId?: number; + productName: string; + productPrice: number; + productUnitId?: number; + productUnitName?: string; + totalProductPrice?: number; + remark: string; + stockCount?: number; + taxPercent?: number; + taxPrice?: number; + totalPrice?: number; + warehouseId?: number; + outCount?: number; } /** 销售出库分页查询参数 */ diff --git a/apps/web-antd/src/api/erp/sale/return/index.ts b/apps/web-antd/src/api/erp/sale/return/index.ts index 0ebcfc75..91057f4d 100644 --- a/apps/web-antd/src/api/erp/sale/return/index.ts +++ b/apps/web-antd/src/api/erp/sale/return/index.ts @@ -2,17 +2,44 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpSaleReturnApi { +export namespace ErpSaleReturnApi { /** 销售退货信息 */ export interface SaleReturn { id?: number; // 销售退货编号 - no: string; // 销售退货号 - customerId: number; // 客户编号 - returnTime: Date; // 退货时间 - totalCount: number; // 合计数量 - totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 + no?: string; // 销售退货号 + customerId?: number; // 客户编号 + returnTime?: Date; // 退货时间 + totalCount?: number; // 合计数量 + totalPrice?: number; // 合计金额,单位:元 + status?: number; // 状态 + remark?: string; // 备注 + discountPercent?: number; // 折扣百分比 + discountPrice?: number; // 折扣金额 + otherPrice?: number; // 其他费用 + totalProductPrice?: number; // 合计商品金额 + taxPrice?: number; // 合计税额 + totalTaxPrice?: number; // 合计税额 + fileUrl?: string; // 附件地址 + items?: SaleReturnItem[]; + } + export interface SaleReturnItem { + count?: number; + id?: number; + orderItemId?: number; + productBarCode?: string; + productId?: number; + productName: string; + productPrice: number; + productUnitId?: number; + productUnitName?: string; + totalProductPrice?: number; + remark: string; + stockCount?: number; + taxPercent?: number; + taxPrice?: number; + totalPrice?: number; + warehouseId?: number; + returnCount?: number; } /** 销售退货分页查询参数 */ diff --git a/apps/web-antd/src/api/erp/stock/check/index.ts b/apps/web-antd/src/api/erp/stock/check/index.ts index 090d8786..3c31a5e8 100644 --- a/apps/web-antd/src/api/erp/stock/check/index.ts +++ b/apps/web-antd/src/api/erp/stock/check/index.ts @@ -2,7 +2,7 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpStockCheckApi { +export namespace ErpStockCheckApi { /** 库存盘点单信息 */ export interface StockCheck { id?: number; // 盘点编号 @@ -12,8 +12,27 @@ namespace ErpStockCheckApi { totalPrice: number; // 合计金额,单位:元 status: number; // 状态 remark: string; // 备注 + fileUrl?: string; // 附件 + productNames?: string; // 产品信息 + creatorName?: string; // 创建人 + items?: StockCheckItem[]; // 盘点产品清单 + } + // 库存盘点单产品信息 + export interface StockCheckItem { + id?: number; // 编号 + warehouseId?: number; // 仓库编号 + productId?: number; // 产品编号 + productName?: string; // 产品名称 + productUnitId?: number; // 产品单位编号 + productUnitName?: string; // 产品单位名称 + productBarCode?: string; // 产品条码 + count?: number; // 盈亏数量 + actualCount?: number; // 实际库存 + productPrice?: number; // 产品单价 + totalPrice?: number; // 总价 + stockCount?: number; // 账面库存 + remark?: string; // 备注 } - /** 库存盘点单分页查询参数 */ export interface StockCheckPageParams extends PageParam { no?: string; diff --git a/apps/web-antd/src/api/erp/stock/move/index.ts b/apps/web-antd/src/api/erp/stock/move/index.ts index 765d27eb..33e49f29 100644 --- a/apps/web-antd/src/api/erp/stock/move/index.ts +++ b/apps/web-antd/src/api/erp/stock/move/index.ts @@ -2,7 +2,7 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpStockMoveApi { +export namespace ErpStockMoveApi { /** 库存调拨单信息 */ export interface StockMove { id?: number; // 调拨编号 @@ -12,6 +12,29 @@ namespace ErpStockMoveApi { totalPrice: number; // 合计金额,单位:元 status: number; // 状态 remark: string; // 备注 + fileUrl?: string; // 附件 + fromWarehouseId?: number; // 来源仓库编号 + createTime: Date; // 创建时间 + creator: string; // 创建人 + creatorName: string; // 创建人名称 + productNames: string; // 产品名称 + items?: StockMoveItem[]; // 子表信息 + } + + /** 库存调拨单子表信息 */ + export interface StockMoveItem { + count: number; // 数量 + fromWarehouseId?: number; // 来源仓库ID + id?: number; // ID + productBarCode: string; // 产品条形码 + productId?: number; // 产品ID + productName?: string; // 产品名称 + productPrice: number; // 产品单价 + productUnitName?: string; // 产品单位 + remark?: string; // 备注 + stockCount: number; // 库存数量 + toWarehouseId?: number; // 目标仓库ID + totalPrice?: number; // 总价 } /** 库存调拨单分页查询参数 */ diff --git a/apps/web-antd/src/api/erp/stock/stock/index.ts b/apps/web-antd/src/api/erp/stock/stock/index.ts index 3ef12dff..df8aaaa9 100644 --- a/apps/web-antd/src/api/erp/stock/stock/index.ts +++ b/apps/web-antd/src/api/erp/stock/stock/index.ts @@ -72,3 +72,12 @@ export function exportStock(params: ErpStockApi.StockPageParams) { params, }); } + +/** + * 获取库存数量 + */ +export function getWarehouseStockCount(params: ErpStockApi.StockQueryParams) { + return requestClient.get('/erp/stock/get-count', { + params, + }); +} diff --git a/apps/web-antd/src/views/erp/finance/account/data.ts b/apps/web-antd/src/views/erp/finance/account/data.ts new file mode 100644 index 00000000..dc11d945 --- /dev/null +++ b/apps/web-antd/src/views/erp/finance/account/data.ts @@ -0,0 +1,167 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { h } from 'vue'; + +import { Tag } from 'ant-design-vue'; + +import { z } from '#/adapter/form'; +import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + component: 'Input', + fieldName: 'name', + label: '名称', + rules: 'required', + componentProps: { + placeholder: '请输入名称', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + + { + fieldName: 'sort', + label: '排序', + component: 'InputNumber', + componentProps: { + placeholder: '请输入排序', + precision: 0, + class: 'w-full', + }, + rules: 'required', + defaultValue: 0, + }, + { + fieldName: 'defaultStatus', + label: '是否默认', + component: 'RadioGroup', + componentProps: { + options: [ + { + label: '是', + value: true, + }, + { + label: '否', + value: false, + }, + ], + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.boolean().default(false).optional(), + }, + { + fieldName: 'no', + label: '编码', + component: 'Input', + componentProps: { + placeholder: '请输入编码', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '名称', + component: 'Input', + }, + { + fieldName: 'no', + label: '编码', + component: 'Input', + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'name', + title: '名称', + }, + { + field: 'no', + title: '编码', + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'sort', + title: '排序', + }, + { + field: 'status', + title: '状态', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'defaultStatus', + title: '是否默认', + slots: { + default: ({ row }) => { + return h( + Tag, + { + class: 'mr-1', + color: row.defaultStatus ? 'blue' : 'red', + }, + () => (row.defaultStatus ? '是' : '否'), + ); + }, + }, + }, + { + field: 'createTime', + title: '创建时间', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 130, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/finance/account/index.vue b/apps/web-antd/src/views/erp/finance/account/index.vue index c5323373..858ccbd4 100644 --- a/apps/web-antd/src/views/erp/finance/account/index.vue +++ b/apps/web-antd/src/views/erp/finance/account/index.vue @@ -1,34 +1,152 @@ diff --git a/apps/web-antd/src/views/erp/finance/account/modules/form.vue b/apps/web-antd/src/views/erp/finance/account/modules/form.vue new file mode 100644 index 00000000..9adcff6d --- /dev/null +++ b/apps/web-antd/src/views/erp/finance/account/modules/form.vue @@ -0,0 +1,86 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/in/data.ts b/apps/web-antd/src/views/erp/purchase/in/data.ts new file mode 100644 index 00000000..28b74fa7 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/data.ts @@ -0,0 +1,586 @@ +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 { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): 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: { + disabled: true, + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'supplierId', + label: '供应商', + rules: 'required', + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + formItemClass: 'col-span-1', + componentProps: { + disabled: formType === 'detail', + placeholder: '请选择关联订单', + }, + rules: 'required', + }, + { + component: 'DatePicker', + componentProps: { + disabled: formType === 'detail', + placeholder: '选择订单时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'inTime', + label: '入库时间', + rules: 'required', + }, + + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + disabled: formType === 'detail', + autoSize: { minRows: 1, maxRows: 1 }, + class: 'w-full', + }, + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-2', + }, + + { + component: 'FileUpload', + componentProps: { + disabled: formType === 'detail', + 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', + fieldName: 'discountPercent', + componentProps: { + placeholder: '优惠率', + min: 0, + max: 100, + disabled: true, + precision: 2, + style: { width: '100%' }, + }, + + label: '优惠率(%)', + }, + { + 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: 'discountedPrice', + label: '优惠后金额', + }, + { + component: 'InputNumber', + componentProps: { + disabled: formType === 'detail', + placeholder: '请输入其他费用', + precision: 2, + formatter: erpPriceInputFormatter, + style: { width: '100%' }, + }, + fieldName: 'otherPrice', + label: '其他费用', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + disabled: true, + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + precision: 2, + style: { width: '100%' }, + disabled: true, + min: 0, + }, + fieldName: 'totalPrice', + label: '应付金额', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function usePurchaseOrderItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 200, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '仓库库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'totalCount', + title: '原数量', + minWidth: 120, + }, + { + field: 'inCount', + title: '已入库数量', + minWidth: 120, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + fixed: 'right', + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + fixed: 'right', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + fixed: 'right', + title: '产品金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + fixed: 'right', + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + }, + { + fixed: 'right', + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + fixed: 'right', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '入库单号', + component: 'Input', + componentProps: { + placeholder: '请输入入库单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'inTime', + 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: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + componentProps: { + placeholder: '请输入关联订单号', + allowClear: true, + }, + }, + { + fieldName: 'paymentStatus', + label: '付款状态', + component: 'Select', + componentProps: { + options: [ + { label: '未付款', value: 0 }, + { label: '部分付款', value: 1 }, + { label: '全部付款', value: 2 }, + ], + placeholder: '请选择退货状态', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + 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: 'inTime', + title: '入库时间', + width: 160, + formatter: 'formatDateTime', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '应付金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'paymentPrice', + title: '已付金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + minWidth: 250, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} +/** 列表的搜索表单 */ +export function useOrderGridFormSchema(): 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', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useOrderGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'radio', + 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: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'inCount', + title: '入库数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/purchase/in/index.vue b/apps/web-antd/src/views/erp/purchase/in/index.vue index 197c7594..70ea4500 100644 --- a/apps/web-antd/src/views/erp/purchase/in/index.vue +++ b/apps/web-antd/src/views/erp/purchase/in/index.vue @@ -1,34 +1,232 @@ diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue new file mode 100644 index 00000000..f86740fd --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue @@ -0,0 +1,313 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-item-form.vue b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-item-form.vue new file mode 100644 index 00000000..78a978ea --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-item-form.vue @@ -0,0 +1,255 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-form.vue b/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-form.vue new file mode 100644 index 00000000..f02c7971 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-form.vue @@ -0,0 +1,69 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-grid.vue b/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-grid.vue new file mode 100644 index 00000000..4809eac8 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-grid.vue @@ -0,0 +1,54 @@ + + + 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 7805c0b2..f6b69cfc 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 @@ -15,7 +15,7 @@ import { } from '#/api/erp/purchase/order'; import { useFormSchema } from '../data'; -import PurchaseOrderItemForm from './PurchaseOrderItemForm.vue'; +import PurchaseOrderItemForm from './purchase-order-item-form.vue'; const emit = defineEmits(['success']); const formData = ref(); @@ -94,8 +94,7 @@ const [Modal, modalApi] = useVbenModal({ message.error('子表单验证失败'); return; } - } catch (error) { - // TODO @nehc:这里的红色告警,看看怎么处理掉 + } catch (error: any) { message.error(error.message || '子表单验证失败'); return; } @@ -164,17 +163,6 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(); try { formData.value = await getPurchaseOrder(data.id); - // 将字符串形式的文件 URL 转换为数组形式以适配 FileUpload 组件 - // TODO @nehc:这里的 idea 会有黄色告警,看看是不是简化下? - // TODO @nehc:记忆中,好像不用数组的转换,可以在看看? - if ( - formData.value.fileUrl && - typeof formData.value.fileUrl === 'string' - ) { - formData.value.fileUrl = formData.value.fileUrl - ? [formData.value.fileUrl] - : []; - } // 设置到 values await formApi.setValues(formData.value); // 初始化子表单 diff --git a/apps/web-antd/src/views/erp/purchase/order/modules/PurchaseOrderItemForm.vue b/apps/web-antd/src/views/erp/purchase/order/modules/purchase-order-item-form.vue similarity index 98% rename from apps/web-antd/src/views/erp/purchase/order/modules/PurchaseOrderItemForm.vue rename to apps/web-antd/src/views/erp/purchase/order/modules/purchase-order-item-form.vue index b6118932..4202c34b 100644 --- a/apps/web-antd/src/views/erp/purchase/order/modules/PurchaseOrderItemForm.vue +++ b/apps/web-antd/src/views/erp/purchase/order/modules/purchase-order-item-form.vue @@ -95,8 +95,7 @@ watch( props.discountPercent === null ? 0 : erpPriceMultiply(totalPrice, props.discountPercent / 100); - // TODO @nehc:这里的 idea 红色告警? - const finalTotalPrice = totalPrice - discountPrice; + const finalTotalPrice = totalPrice - discountPrice!; // 发送计算结果给父组件 emit('update:discount-price', discountPrice); @@ -112,9 +111,9 @@ onMounted(async () => { function handleAdd() { const newRow = { - productId: null, + productId: undefined, productName: '', - productUnitId: null, + productUnitId: undefined, productUnitName: '', productBarCode: '', count: 1, diff --git a/apps/web-antd/src/views/erp/purchase/return/data.ts b/apps/web-antd/src/views/erp/purchase/return/data.ts new file mode 100644 index 00000000..9d77cd7c --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/data.ts @@ -0,0 +1,599 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpNumberFormatter, 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 { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): 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: { + disabled: true, + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'supplierId', + label: '供应商', + rules: 'required', + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + formItemClass: 'col-span-1', + rules: 'required', + componentProps: { + disabled: formType === 'detail', + placeholder: '请选择关联订单', + }, + }, + { + component: 'DatePicker', + componentProps: { + disabled: formType === 'detail', + placeholder: '选择退货时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'returnTime', + label: '退货时间', + rules: 'required', + }, + + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + disabled: formType === 'detail', + autoSize: { minRows: 1, maxRows: 1 }, + class: 'w-full', + }, + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-2', + }, + + { + component: 'FileUpload', + componentProps: { + disabled: formType === 'detail', + 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', + fieldName: 'discountPercent', + componentProps: { + placeholder: '优惠率', + min: 0, + max: 100, + disabled: true, + precision: 2, + style: { width: '100%' }, + }, + + label: '优惠率(%)', + }, + { + 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: 'discountedPrice', + label: '优惠后金额', + }, + { + component: 'InputNumber', + componentProps: { + disabled: formType === 'detail', + placeholder: '请输入其他费用', + precision: 2, + formatter: erpPriceInputFormatter, + style: { width: '100%' }, + }, + fieldName: 'otherPrice', + label: '其他费用', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + disabled: true, + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + precision: 2, + style: { width: '100%' }, + disabled: true, + min: 0, + }, + fieldName: 'totalPrice', + label: '应退金额', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function usePurchaseOrderItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 200, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '仓库库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'inCount', + title: '已入库数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '已退货', + minWidth: 120, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + fixed: 'right', + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + fixed: 'right', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + fixed: 'right', + title: '产品金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + fixed: 'right', + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + }, + { + fixed: 'right', + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + fixed: 'right', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + ]; +} + +/** 采购退货列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '退货单号', + component: 'Input', + componentProps: { + placeholder: '请输入入库单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'returnTime', + 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: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + componentProps: { + placeholder: '请输入关联订单号', + allowClear: true, + }, + }, + { + fieldName: 'refundStatus', + label: '退款状态', + component: 'Select', + componentProps: { + options: [ + { label: '未退款', value: 0 }, + { label: '部分退款', value: 1 }, + { label: '全部退款', value: 2 }, + ], + placeholder: '请选择退货状态', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + 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: 'returnTime', + title: '退货时间', + width: 160, + formatter: 'formatDateTime', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '应退金额', + formatter: 'formatAmount2', + minWidth: 120, + }, + { + field: 'refundPrice', + title: '已退金额', + formatter: 'formatAmount2', + minWidth: 120, + }, + { + field: 'noRefundPrice', + title: '未退金额', + minWidth: 120, + formatter: ({ row }) => { + return `${erpNumberFormatter(row.totalPrice - row.refundPrice, 2)}元`; + }, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + minWidth: 250, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} +/** 采购订单列表的搜索表单 */ +export function useOrderGridFormSchema(): 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', + }, + }, + ]; +} + +/** 采购订单列表的字段 */ +export function useOrderGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'radio', + 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: 'formatDate', + }, + { + 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, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/purchase/return/index.vue b/apps/web-antd/src/views/erp/purchase/return/index.vue index ea638d71..119e8e08 100644 --- a/apps/web-antd/src/views/erp/purchase/return/index.vue +++ b/apps/web-antd/src/views/erp/purchase/return/index.vue @@ -1,34 +1,233 @@ diff --git a/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-form.vue b/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-form.vue new file mode 100644 index 00000000..8b34a363 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-form.vue @@ -0,0 +1,315 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-item-form.vue b/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-item-form.vue new file mode 100644 index 00000000..38077b0e --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-item-form.vue @@ -0,0 +1,260 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-form.vue b/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-form.vue new file mode 100644 index 00000000..f02c7971 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-form.vue @@ -0,0 +1,69 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-grid.vue b/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-grid.vue new file mode 100644 index 00000000..51aca19b --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-grid.vue @@ -0,0 +1,54 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/customer/data.ts b/apps/web-antd/src/views/erp/sale/customer/data.ts new file mode 100644 index 00000000..ad44e221 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/customer/data.ts @@ -0,0 +1,214 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { z } from '#/adapter/form'; +import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + component: 'Input', + fieldName: 'name', + label: '名称', + rules: 'required', + componentProps: { + placeholder: '请输入名称', + }, + }, + { + fieldName: 'contact', + label: '联系人', + component: 'Input', + componentProps: { + placeholder: '请输入联系人', + }, + }, + { + fieldName: 'mobile', + label: '手机号码', + component: 'Input', + componentProps: { + placeholder: '请输入手机号码', + }, + }, + { + fieldName: 'telephone', + label: '联系电话', + component: 'Input', + componentProps: { + placeholder: '请输入联系电话', + }, + }, + { + fieldName: 'email', + label: '电子邮箱', + component: 'Input', + componentProps: { + placeholder: '请输入电子邮箱', + }, + }, + { + fieldName: 'fax', + label: '传真', + component: 'Input', + componentProps: { + placeholder: '请输入传真', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'sort', + label: '排序', + component: 'InputNumber', + componentProps: { + placeholder: '请输入排序', + precision: 0, + class: 'w-full', + }, + rules: 'required', + defaultValue: 0, + }, + { + fieldName: 'taxNo', + label: '纳税人识别号', + component: 'Input', + componentProps: { + placeholder: '请输入纳税人识别号', + }, + }, + { + fieldName: 'taxPercent', + label: '税率(%)', + component: 'InputNumber', + componentProps: { + placeholder: '请输入税率', + precision: 0, + class: 'w-full', + }, + rules: z.number().min(0).max(100).default(0).optional(), + defaultValue: 0, + }, + { + fieldName: 'bankName', + label: '开户行名称', + component: 'Input', + componentProps: { + placeholder: '请输入开户行名称', + }, + }, + { + fieldName: 'bankAccount', + label: '开户行账号', + component: 'Input', + componentProps: { + placeholder: '请输入开户行账号', + }, + }, + { + fieldName: 'bankAddress', + label: '开户行地址', + component: 'Input', + componentProps: { + placeholder: '请输入开户行地址', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + rows: 1, + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '名称', + component: 'Input', + }, + { + fieldName: 'mobile', + label: '手机号码', + component: 'Input', + }, + { + fieldName: 'email', + label: '邮箱', + component: 'Input', + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'name', + title: '名称', + }, + { + field: 'contact', + title: '联系人', + }, + { + field: 'mobile', + title: '手机号码', + }, + { + field: 'telephone', + title: '联系电话', + }, + { + field: 'email', + title: '邮箱', + }, + { + field: 'taxNo', + title: '纳税人识别号', + }, + { + field: 'status', + title: '状态', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 130, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/sale/customer/index.vue b/apps/web-antd/src/views/erp/sale/customer/index.vue index 05c511ef..3716a9f9 100644 --- a/apps/web-antd/src/views/erp/sale/customer/index.vue +++ b/apps/web-antd/src/views/erp/sale/customer/index.vue @@ -1,34 +1,152 @@ diff --git a/apps/web-antd/src/views/erp/sale/customer/modules/form.vue b/apps/web-antd/src/views/erp/sale/customer/modules/form.vue new file mode 100644 index 00000000..f1348df1 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/customer/modules/form.vue @@ -0,0 +1,86 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/order/data.ts b/apps/web-antd/src/views/erp/sale/order/data.ts new file mode 100644 index 00000000..64d41c62 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/order/data.ts @@ -0,0 +1,454 @@ +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 { getCustomerSimpleList } from '#/api/erp/sale/customer'; +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: 'DatePicker', + componentProps: { + placeholder: '选择订单时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'orderTime', + label: '订单时间', + rules: 'required', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'customerId', + label: '客户', + rules: 'required', + }, + { + fieldName: 'saleUserId', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 1, maxRows: 1 }, + }, + fieldName: 'remark', + label: '备注', + }, + { + 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 useSaleOrderItemTableColumns(): 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, + }, + }, + { + 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: getCustomerSimpleList, + 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: 'outStatus', + label: '出库状态', + component: 'Select', + componentProps: { + options: [ + { label: '未出库', value: 0 }, + { label: '部分出库', value: 1 }, + { label: '全部出库', value: 2 }, + ], + 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: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'outCount', + 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/sale/order/index.vue b/apps/web-antd/src/views/erp/sale/order/index.vue index 51b03d26..cafc5012 100644 --- a/apps/web-antd/src/views/erp/sale/order/index.vue +++ b/apps/web-antd/src/views/erp/sale/order/index.vue @@ -1,34 +1,236 @@ diff --git a/apps/web-antd/src/views/erp/sale/order/modules/form.vue b/apps/web-antd/src/views/erp/sale/order/modules/form.vue new file mode 100644 index 00000000..a61c368c --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/order/modules/form.vue @@ -0,0 +1,206 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/order/modules/sale-order-item-form.vue b/apps/web-antd/src/views/erp/sale/order/modules/sale-order-item-form.vue new file mode 100644 index 00000000..5fa6850d --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/order/modules/sale-order-item-form.vue @@ -0,0 +1,356 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/out/data.ts b/apps/web-antd/src/views/erp/sale/out/data.ts new file mode 100644 index 00000000..9212d47f --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/data.ts @@ -0,0 +1,591 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; + +import { z } from '#/adapter/form'; +import { getAccountSimpleList } from '#/api/erp/finance/account'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getCustomerSimpleList } from '#/api/erp/sale/customer'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): 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: { + disabled: true, + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'customerId', + label: '客户', + rules: 'required', + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + formItemClass: 'col-span-1', + rules: 'required', + componentProps: { + placeholder: '请选择关联订单', + disabled: formType === 'detail', + }, + }, + { + component: 'DatePicker', + componentProps: { + disabled: formType === 'detail', + placeholder: '选择出库时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'outTime', + label: '出库时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + disabled: formType === 'detail', + autoSize: { minRows: 1, maxRows: 1 }, + class: 'w-full', + }, + fieldName: 'remark', + formItemClass: 'col-span-2', + label: '备注', + }, + { + component: 'FileUpload', + componentProps: { + disabled: formType === 'detail', + 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', + fieldName: 'discountPercent', + componentProps: { + placeholder: '优惠率', + min: 0, + max: 100, + disabled: true, + precision: 2, + style: { width: '100%' }, + }, + + label: '优惠率(%)', + }, + { + 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: 'discountedPrice', + label: '优惠后金额', + }, + { + component: 'InputNumber', + componentProps: { + disabled: formType === 'detail', + placeholder: '请输入其他费用', + precision: 2, + formatter: erpPriceInputFormatter, + style: { width: '100%' }, + }, + fieldName: 'otherPrice', + label: '其他费用', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + disabled: true, + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + precision: 2, + style: { width: '100%' }, + disabled: true, + min: 0, + }, + fieldName: 'totalPrice', + label: '应收金额', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function useSaleOutItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 200, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '仓库库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'totalCount', + title: '原数量', + minWidth: 120, + }, + { + field: 'outCount', + title: '已出库数量', + minWidth: 120, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + fixed: 'right', + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + fixed: 'right', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + fixed: 'right', + title: '产品金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + fixed: 'right', + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + }, + { + fixed: 'right', + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + fixed: 'right', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '出库单号', + component: 'Input', + componentProps: { + placeholder: '请输入出库单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'outTime', + label: '出库时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'customerId', + label: '客户', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + componentProps: { + placeholder: '请输入关联订单号', + allowClear: true, + }, + }, + { + fieldName: 'receiptStatus', + label: '收款状态', + component: 'Select', + componentProps: { + options: [ + { label: '未收款', value: 0 }, + { label: '部分收款', value: 1 }, + { label: '全部收款', value: 2 }, + ], + placeholder: '请选择收款状态', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + 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: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'outTime', + title: '出库时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '应收金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'receiptPrice', + title: '已收金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'unReceiptPrice', + title: '未收金额', + formatter: ({ row }) => { + return `${erpNumberFormatter(row.totalPrice - row.receiptPrice, 2)}元`; + }, + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + minWidth: 250, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} +/** 列表的搜索表单 */ +export function useOrderGridFormSchema(): 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', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useOrderGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'radio', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '订单单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'outCount', + title: '出库数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/sale/out/index.vue b/apps/web-antd/src/views/erp/sale/out/index.vue index a94068e2..3909cd1b 100644 --- a/apps/web-antd/src/views/erp/sale/out/index.vue +++ b/apps/web-antd/src/views/erp/sale/out/index.vue @@ -1,34 +1,239 @@ diff --git a/apps/web-antd/src/views/erp/sale/out/modules/sale-out-form.vue b/apps/web-antd/src/views/erp/sale/out/modules/sale-out-form.vue new file mode 100644 index 00000000..eb2a4703 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/modules/sale-out-form.vue @@ -0,0 +1,309 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/out/modules/sale-out-item-form.vue b/apps/web-antd/src/views/erp/sale/out/modules/sale-out-item-form.vue new file mode 100644 index 00000000..d16f7d12 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/modules/sale-out-item-form.vue @@ -0,0 +1,255 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-form.vue b/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-form.vue new file mode 100644 index 00000000..2f435178 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-form.vue @@ -0,0 +1,69 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-grid.vue b/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-grid.vue new file mode 100644 index 00000000..79114dab --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-grid.vue @@ -0,0 +1,54 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/return/data.ts b/apps/web-antd/src/views/erp/sale/return/data.ts new file mode 100644 index 00000000..01c04672 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/data.ts @@ -0,0 +1,591 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; + +import { z } from '#/adapter/form'; +import { getAccountSimpleList } from '#/api/erp/finance/account'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getCustomerSimpleList } from '#/api/erp/sale/customer'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): 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: { + disabled: true, + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'customerId', + label: '客户', + rules: 'required', + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + formItemClass: 'col-span-1', + rules: 'required', + componentProps: { + placeholder: '请选择关联订单', + disabled: formType === 'detail', + }, + }, + { + component: 'DatePicker', + componentProps: { + disabled: formType === 'detail', + placeholder: '选择退货时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'returnTime', + label: '退货时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + disabled: formType === 'detail', + autoSize: { minRows: 1, maxRows: 1 }, + class: 'w-full', + }, + fieldName: 'remark', + formItemClass: 'col-span-2', + label: '备注', + }, + { + component: 'FileUpload', + componentProps: { + disabled: formType === 'detail', + 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', + fieldName: 'discountPercent', + componentProps: { + placeholder: '优惠率', + min: 0, + max: 100, + disabled: true, + precision: 2, + style: { width: '100%' }, + }, + + label: '优惠率(%)', + }, + { + 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: 'discountedPrice', + label: '优惠后金额', + }, + { + component: 'InputNumber', + componentProps: { + disabled: formType === 'detail', + placeholder: '请输入其他费用', + precision: 2, + formatter: erpPriceInputFormatter, + style: { width: '100%' }, + }, + fieldName: 'otherPrice', + label: '其他费用', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + disabled: true, + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + precision: 2, + style: { width: '100%' }, + disabled: true, + min: 0, + }, + fieldName: 'totalPrice', + label: '应退金额', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function useSaleReturnItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 200, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '仓库库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'totalCount', + title: '原数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '已退货数量', + minWidth: 120, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + fixed: 'right', + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + fixed: 'right', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + fixed: 'right', + title: '产品金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + fixed: 'right', + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + }, + { + fixed: 'right', + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + fixed: 'right', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '退货单号', + component: 'Input', + componentProps: { + placeholder: '请输入退货单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'returnTime', + label: '退货时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'customerId', + label: '客户', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + componentProps: { + placeholder: '请输入关联订单号', + allowClear: true, + }, + }, + { + fieldName: 'refundStatus', + label: '退货状态', + component: 'Select', + componentProps: { + options: [ + { label: '未退货', value: 0 }, + { label: '部分退货', value: 1 }, + { label: '全部退货', value: 2 }, + ], + placeholder: '请选择退货状态', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + 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: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'returnTime', + title: '退货时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '应退金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'refundPrice', + title: '已退金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'unRefundPrice', + title: '未退金额', + formatter: ({ row }) => { + return `${erpNumberFormatter(row.totalPrice - row.refundPrice, 2)}元`; + }, + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + minWidth: 250, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} +/** 列表的搜索表单 */ +export function useOrderGridFormSchema(): 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', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useOrderGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'radio', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '订单单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '已退货数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/sale/return/index.vue b/apps/web-antd/src/views/erp/sale/return/index.vue index a4795921..1cf8a618 100644 --- a/apps/web-antd/src/views/erp/sale/return/index.vue +++ b/apps/web-antd/src/views/erp/sale/return/index.vue @@ -1,34 +1,239 @@ diff --git a/apps/web-antd/src/views/erp/sale/return/modules/sale-return-form.vue b/apps/web-antd/src/views/erp/sale/return/modules/sale-return-form.vue new file mode 100644 index 00000000..dd7f263a --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/modules/sale-return-form.vue @@ -0,0 +1,313 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/return/modules/sale-return-item-form.vue b/apps/web-antd/src/views/erp/sale/return/modules/sale-return-item-form.vue new file mode 100644 index 00000000..b2ce1adc --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/modules/sale-return-item-form.vue @@ -0,0 +1,255 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-form.vue b/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-form.vue new file mode 100644 index 00000000..2f435178 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-form.vue @@ -0,0 +1,69 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-grid.vue b/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-grid.vue new file mode 100644 index 00000000..f690d368 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-grid.vue @@ -0,0 +1,54 @@ + + + diff --git a/apps/web-antd/src/views/erp/stock/check/data.ts b/apps/web-antd/src/views/erp/stock/check/data.ts new file mode 100644 index 00000000..a0d75ea7 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/check/data.ts @@ -0,0 +1,313 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { createRequiredValidation } from '#/adapter/vxe-table'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): 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: 'DatePicker', + componentProps: { + placeholder: '选择盘点时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + disabled: formType === 'detail', + fieldName: 'checkTime', + label: '盘点时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 2, maxRows: 4 }, + class: 'w-full', + }, + disabled: formType === 'detail', + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-3', + }, + { + component: 'FileUpload', + disabled: formType === 'detail', + 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', + disabled: formType === 'detail', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + ]; +} + +/** 库存盘点清单表格列定义 */ +export function useStockCheckItemTableColumns( + isValidating?: any, +): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 150, + slots: { default: 'warehouseId' }, + className: createRequiredValidation(isValidating, 'warehouseId'), + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + className: createRequiredValidation(isValidating, 'productId'), + }, + { + field: 'stockCount', + title: '账面库存', + minWidth: 100, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'actualCount', + title: '实际库存', + minWidth: 120, + slots: { default: 'actualCount' }, + className: createRequiredValidation(isValidating, 'actualCount'), + }, + { + field: 'count', + title: '盈亏数量', + minWidth: 120, + slots: { default: 'count' }, + className: createRequiredValidation(isValidating, 'count'), + }, + { + field: 'productPrice', + title: '产品单价', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + 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, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'checkTime', + label: '盘点时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始日期', '结束日期'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + labelField: 'nickname', + valueField: 'id', + filterOption: false, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '盘点单号', + minWidth: 180, + }, + { + field: 'productNames', + title: '产品信息', + minWidth: 200, + showOverflow: 'tooltip', + }, + { + field: 'checkTime', + title: '出库时间', + minWidth: 180, + cellRender: { + name: 'CellDateTime', + }, + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 100, + }, + { + field: 'totalCount', + title: '数量', + minWidth: 100, + }, + { + field: 'totalPrice', + title: '金额', + minWidth: 100, + }, + { + field: 'status', + title: '状态', + minWidth: 90, + fixed: 'right', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + width: 300, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/stock/check/index.vue b/apps/web-antd/src/views/erp/stock/check/index.vue index 3b9a7ec5..941f8eba 100644 --- a/apps/web-antd/src/views/erp/stock/check/index.vue +++ b/apps/web-antd/src/views/erp/stock/check/index.vue @@ -1,34 +1,219 @@ diff --git a/apps/web-antd/src/views/erp/stock/check/modules/form.vue b/apps/web-antd/src/views/erp/stock/check/modules/form.vue new file mode 100644 index 00000000..7c7eaa07 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/check/modules/form.vue @@ -0,0 +1,196 @@ + + + diff --git a/apps/web-antd/src/views/erp/stock/check/modules/stock-check-item-form.vue b/apps/web-antd/src/views/erp/stock/check/modules/stock-check-item-form.vue new file mode 100644 index 00000000..739d4f4f --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/check/modules/stock-check-item-form.vue @@ -0,0 +1,373 @@ + + + + + diff --git a/apps/web-antd/src/views/erp/stock/move/data.ts b/apps/web-antd/src/views/erp/stock/move/data.ts new file mode 100644 index 00000000..94ab7fa0 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/move/data.ts @@ -0,0 +1,312 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { createRequiredValidation } from '#/adapter/vxe-table'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): 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: '调度单号', + disabled: formType === 'detail', + }, + { + component: 'DatePicker', + componentProps: { + placeholder: '选择调度时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + disabled: formType === 'detail', + fieldName: 'moveTime', + label: '调度时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 2, maxRows: 4 }, + class: 'w-full', + }, + disabled: formType === 'detail', + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-3', + }, + { + component: 'FileUpload', + disabled: formType === 'detail', + 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', + disabled: formType === 'detail', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + ]; +} + +/** 调度产品清单表格列定义 */ +export function useStockMoveItemTableColumns( + isValidating?: any, +): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'fromWarehouseId', + title: '调出仓库', + minWidth: 150, + slots: { default: 'fromWarehouseId' }, + className: createRequiredValidation(isValidating, 'fromWarehouseId'), + }, + { + field: 'toWarehouseId', + title: '调入仓库', + minWidth: 150, + slots: { default: 'toWarehouseId' }, + className: createRequiredValidation(isValidating, 'toWarehouseId'), + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + className: createRequiredValidation(isValidating, 'productId'), + }, + { + field: 'stockCount', + title: '库存', + minWidth: 100, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + slots: { default: 'count' }, + className: createRequiredValidation(isValidating, 'count'), + }, + { + field: 'productPrice', + title: '产品单价', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + 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, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'moveTime', + label: '调度时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始日期', '结束日期'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'fromWarehouseId', + label: '调出仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择调出仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + labelField: 'nickname', + valueField: 'id', + filterOption: false, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '调度单号', + minWidth: 180, + }, + { + field: 'productNames', + title: '产品信息', + minWidth: 200, + showOverflow: 'tooltip', + }, + { + field: 'moveTime', + title: '调度时间', + minWidth: 180, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 100, + }, + { + field: 'totalCount', + title: '数量', + minWidth: 100, + }, + { + field: 'totalPrice', + title: '金额', + minWidth: 100, + }, + { + field: 'status', + title: '状态', + minWidth: 90, + fixed: 'right', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + width: 300, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/stock/move/index.vue b/apps/web-antd/src/views/erp/stock/move/index.vue index d073d6f7..8a61ecfa 100644 --- a/apps/web-antd/src/views/erp/stock/move/index.vue +++ b/apps/web-antd/src/views/erp/stock/move/index.vue @@ -1,34 +1,219 @@ diff --git a/apps/web-antd/src/views/erp/stock/move/modules/form.vue b/apps/web-antd/src/views/erp/stock/move/modules/form.vue new file mode 100644 index 00000000..35b51a96 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/move/modules/form.vue @@ -0,0 +1,196 @@ + + + diff --git a/apps/web-antd/src/views/erp/stock/move/modules/stock-move-item-form.vue b/apps/web-antd/src/views/erp/stock/move/modules/stock-move-item-form.vue new file mode 100644 index 00000000..32835bf7 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/move/modules/stock-move-item-form.vue @@ -0,0 +1,382 @@ + + + + +