feat(wls): 仓储物流单据跨模块关联字段改为手工填写
北方科技不使用生产/采购/销售模块,各单据新增表单里关联其他模块的下拉选择框
改为文本输入,可自定义填写,不再要求选择已有档案。
- 到货通知/采购退货:采购订单号、供应商名称
- 发货通知/产品发货/销售退货:销售订单号、客户名称、发货通知单号
- 装箱单:销售订单编号、客户名称、装箱行生产订单号
- 产品入库:生产订单号
- 生产退料:生产订单号、工作站名称
- 委外发料/委外入库:外协订单号、供应商名称
- 搜索条件同步改为按名称/单号文本模糊搜索
- 销售退货去掉按销售订单反查 ERP 明细的回显逻辑
Co-Authored-By: Claude Code <noreply@anthropic.com>
| | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdmItemSelect } from '#/views/basicData/mdm/components'; |
| | | import { ErpPurchaseOrderSelect } from '#/views/erp/purchase/order/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'vendorName', |
| | | label: '', |
| | | fieldName: 'purchaseOrderCode', |
| | | label: '采购订单号', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderId', |
| | | label: '采购订单', |
| | | component: markRaw(ErpPurchaseOrderSelect), |
| | | componentProps: { |
| | | placeholder: '请选择采购订单', |
| | | onChange: (item: any) => { |
| | | if (item?.supplierId && formApi) { |
| | | formApi.setFieldValue('vendorId', item.supplierId); |
| | | formApi.setFieldValue('vendorName', item.supplierName); |
| | | } |
| | | }, |
| | | placeholder: '请输入采购订单号', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | disabled: true, |
| | | placeholder: '请输入供应商名称', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['vendorName'], |
| | | componentProps: (values) => ({ |
| | | placeholder: '请选择供应商', |
| | | disabled: true, |
| | | vendorName: values.vendorName as string, |
| | | }), |
| | | }, |
| | | rules: 'selectRequired', |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'arrivalDate', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderNo', |
| | | fieldName: 'purchaseOrderCode', |
| | | label: '采购订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | import type { MesWmMaterialStockApi } from '#/api/mes/wm/materialstock'; |
| | | import type { MesWmOutsourceIssueApi } from '#/api/mes/wm/outsourceissue'; |
| | | import type { MesWmOutsourceIssueDetailApi } from '#/api/mes/wm/outsourceissue/detail'; |
| | |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | MesProWorkOrderTypeEnum, |
| | | } from '@vben/constants'; |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '外协订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | fieldName: 'workOrderCode', |
| | | label: '外协订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | // 选择外协订单后,自动回填供应商 |
| | | onChange: async (workOrder?: MesProWorkOrderApi.WorkOrder) => { |
| | | await formApi?.setFieldValue('vendorId', workOrder?.vendorId); |
| | | }, |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | type: MesProWorkOrderTypeEnum.OUTSOURCE, |
| | | placeholder: '请输入外协订单号', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | placeholder: '请输入供应商名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | allowClear: true, |
| | | placeholder: '请输入供应商名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import type { VbenFormApi, VbenFormSchema } from '#/adapter/form'; |
| | | import type { VxeTableGridOptions } from '#/adapter/vxe-table'; |
| | | import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder'; |
| | | import type { MesWmOutsourceReceiptApi } from '#/api/mes/wm/outsourcereceipt'; |
| | | import type { MesWmOutsourceReceiptDetailApi } from '#/api/mes/wm/outsourcereceipt/detail'; |
| | | import type { MesWmOutsourceReceiptLineApi } from '#/api/mes/wm/outsourcereceipt/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | MesProWorkOrderTypeEnum, |
| | | } from '@vben/constants'; |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '外协订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | fieldName: 'workOrderCode', |
| | | label: '外协订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | // 选择外协订单后,自动回填供应商 |
| | | onChange: async (workOrder?: MesProWorkOrderApi.WorkOrder) => { |
| | | await formApi?.setFieldValue('vendorId', workOrder?.vendorId); |
| | | }, |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | type: MesProWorkOrderTypeEnum.OUTSOURCE, |
| | | placeholder: '请输入外协订单号', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | placeholder: '请输入供应商名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | allowClear: true, |
| | | placeholder: '请输入供应商名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '@vben/constants'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getSimpleUserList } from '#/api/system/user'; |
| | | import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components'; |
| | | import { MdClientSelect } from '#/views/mes/md/client/components'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'saleOrderId', |
| | | label: '销售订单编号', |
| | | component: markRaw(ErpSaleOrderSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择销售订单', |
| | | onChange: (item: any) => { |
| | | if (formApi) { |
| | | formApi.setFieldValue('salesOrderCode', item?.no ?? ''); |
| | | formApi.setFieldValue('clientId', item?.customerId ?? undefined); |
| | | formApi.setFieldValue('clientName', item?.customerName ?? ''); |
| | | } |
| | | }, |
| | | placeholder: '请输入销售订单编号', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'invoiceCode', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '选择销售订单后自动反显', |
| | | disabled: true, |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | allowClear: true, |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | export function useLineFormSchema(): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | fieldName: 'workOrderCode', |
| | | label: '生产订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择生产订单', |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | placeholder: '请输入生产订单号', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'itemId', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | allowClear: true, |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '@vben/constants'; |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | fieldName: 'workOrderCode', |
| | | label: '生产订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | checkMethod: (row: any) => row.productionStatus !== 0, |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请输入生产订单号', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import type { MesWmProductSalesApi } from '#/api/mes/wm/productsales'; |
| | | import type { MesWmProductSalesDetailApi } from '#/api/mes/wm/productsales/detail'; |
| | | import type { MesWmProductSalesLineApi } from '#/api/mes/wm/productsales/line'; |
| | | import type { MesWmSalesNoticeApi } from '#/api/mes/wm/salesnotice'; |
| | | import type { MesWmSalesNoticeLineApi } from '#/api/mes/wm/salesnotice/line'; |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesWmSalesNoticeStatusEnum, |
| | | } from '@vben/constants'; |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components'; |
| | | import { getRangePickerDefaultProps } from '#/utils'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | | WmSalesNoticeLineSelect, |
| | | WmSalesNoticeSelect, |
| | | } from '#/views/wls/salesnotice/components'; |
| | | import { WmSalesNoticeLineSelect } from '#/views/wls/salesnotice/components'; |
| | | import { |
| | | WmWarehouseAreaSelect, |
| | | WmWarehouseLocationSelect, |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'noticeId', |
| | | label: '发货通知单', |
| | | component: markRaw(WmSalesNoticeSelect), |
| | | fieldName: 'noticeCode', |
| | | label: '发货通知单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: isHeaderReadonly(formType), |
| | | // 选择发货通知单后,自动回填销售订单号、客户、收货人信息 |
| | | onChange: async (notice?: MesWmSalesNoticeApi.SalesNotice) => { |
| | | await formApi?.setValues({ |
| | | clientId: notice?.clientId, |
| | | contactAddress: notice?.recipientAddress, |
| | | contactName: notice?.recipientName, |
| | | contactTelephone: notice?.recipientTelephone, |
| | | salesOrderCode: notice?.salesOrderCode, |
| | | }); |
| | | }, |
| | | status: MesWmSalesNoticeStatusEnum.APPROVED, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'saleOrderId', |
| | | label: '销售订单编号', |
| | | component: markRaw(ErpSaleOrderSelect), |
| | | componentProps: { |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请选择销售订单', |
| | | onChange: (item: any) => { |
| | | if (formApi) { |
| | | formApi.setFieldValue('salesOrderCode', item?.no ?? ''); |
| | | if (item?.customerId) { |
| | | formApi.setFieldValue('clientId', item.customerId); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | rules: 'selectRequired', |
| | | dependencies: { |
| | | triggerFields: ['salesOrderCode'], |
| | | if: () => formType === 'create', |
| | | placeholder: '请输入发货通知单号', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | label: '销售订单编号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: true, |
| | | placeholder: '销售订单编号', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | if: () => formType !== 'create', |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请输入销售订单编号', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: markRaw(CrmCustomerSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请选择客户', |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | rules: 'selectRequired', |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'contactName', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: markRaw(CrmCustomerSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | allowClear: true, |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | |
| | | import { h, markRaw } from 'vue'; |
| | | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesProWorkOrderStatusEnum, |
| | | } from '@vben/constants'; |
| | | import { DICT_TYPE, MesAutoCodeRuleCode } from '@vben/constants'; |
| | | import { getDictOptions } from '@vben/hooks'; |
| | | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { MdWorkstationSelect } from '#/views/mes/md/workstation/components'; |
| | | import { ProWorkOrderSelect } from '#/views/mes/pro/workorder/components'; |
| | | import { WmProductIssueLineSelect } from '#/views/wls/productissue/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | fieldName: 'workOrderCode', |
| | | label: '生产订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | status: MesProWorkOrderStatusEnum.CONFIRMED, |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请输入生产订单号', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'workstationId', |
| | | fieldName: 'workstationName', |
| | | label: '工作站', |
| | | component: markRaw(MdWorkstationSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择工作站', |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请输入工作站名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'workOrderId', |
| | | label: '生产订单', |
| | | component: markRaw(ProWorkOrderSelect), |
| | | fieldName: 'workOrderCode', |
| | | label: '生产订单号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择生产订单', |
| | | allowClear: true, |
| | | placeholder: '请输入生产订单号', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { WmBatchSelect } from '#/views/wls/batch/components'; |
| | | import { |
| | |
| | | export function useFormSchema( |
| | | formType: FormType, |
| | | formApi?: VbenFormApi, |
| | | onOrderChange?: (item: Record<string, unknown> | undefined) => void, |
| | | ): VbenFormSchema[] { |
| | | return [ |
| | | { |
| | |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'saleOrderId', |
| | | label: '销售订单号', |
| | | component: markRaw(ErpSaleOrderSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | outStatus: 3, |
| | | placeholder: '请选择销售订单', |
| | | onChange: (item: any) => { |
| | | if (formApi) { |
| | | formApi.setFieldValue('salesOrderCode', item?.no ?? ''); |
| | | if (item?.customerId) { |
| | | formApi.setFieldValue('clientId', item.customerId); |
| | | } |
| | | } |
| | | onOrderChange?.(item); |
| | | }, |
| | | placeholder: '请输入销售订单号', |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: markRaw(CrmCustomerSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | rules: 'selectRequired', |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'returnDate', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: markRaw(CrmCustomerSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | allowClear: true, |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | submitReturnSales, |
| | | updateReturnSales, |
| | | } from '#/api/mes/wm/returnsales'; |
| | | import type { ErpSaleOrderApi } from '#/api/erp/sale/order'; |
| | | |
| | | import { getSaleOrder, getSaleOrderPage } from '#/api/erp/sale/order'; |
| | | import { $t } from '#/locales'; |
| | | |
| | | import { useFormSchema } from '../data'; |
| | |
| | | const formType = ref<FormType>('create'); |
| | | const formData = ref<MesWmReturnSalesApi.ReturnSales>(); |
| | | const originalSnapshot = ref(''); // 表单原始数据快照,用于提交时跳过未变更的保存请求 |
| | | const saleOrderItems = ref<ErpSaleOrderApi.SaleOrderItem[]>([]); // 当前销售订单的物料行 |
| | | const isEditable = computed(() => |
| | | // 是否为编辑模式(可保存) |
| | | ['create', 'update'].includes(formType.value), |
| | |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data.formType; |
| | | formApi.setState({ |
| | | schema: useFormSchema(formType.value, formApi, (item) => { |
| | | if (item?.id) { |
| | | getSaleOrder(item.id as number).then((order) => { |
| | | saleOrderItems.value = (order as ErpSaleOrderApi.SaleOrder)?.items || []; |
| | | }); |
| | | } else { |
| | | saleOrderItems.value = []; |
| | | } |
| | | }), |
| | | schema: useFormSchema(formType.value, formApi), |
| | | }); |
| | | formApi.setDisabled(!isEditable.value); |
| | | modalApi.setState({ showConfirmButton: isEditable.value }); |
| | |
| | | modalApi.lock(); |
| | | try { |
| | | formData.value = await getReturnSales(data.id); |
| | | // 通过销售订单号反查订单ID,确保 ErpSaleOrderSelect 能正确回显 |
| | | if (formData.value?.salesOrderCode && !formData.value.saleOrderId) { |
| | | const orderPage = await getSaleOrderPage({ |
| | | pageNo: 1, |
| | | pageSize: 1, |
| | | no: formData.value.salesOrderCode, |
| | | } as Record<string, unknown> as never); |
| | | const list = (orderPage as Record<string, unknown>)?.list as Array<Record<string, unknown>> | undefined; |
| | | if (list?.length) { |
| | | const orderId = list[0].id as number; |
| | | (formData.value as Record<string, unknown>).saleOrderId = orderId; |
| | | const order = await getSaleOrder(orderId); |
| | | saleOrderItems.value = order?.items || []; |
| | | } |
| | | } |
| | | // 设置到 values |
| | | await formApi.setValues(formData.value); |
| | | } finally { |
| | |
| | | :client-id="formData.clientId" |
| | | :form-type="formType" |
| | | :return-id="formData.id" |
| | | :sale-order-items="saleOrderItems" |
| | | :sale-order-items="[]" |
| | | :sales-order-code="formData.salesOrderCode" |
| | | /> |
| | | </div> |
| | |
| | | |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | import { MdVendorSelect } from '#/views/mes/md/vendor/components'; |
| | | import { ErpPurchaseOrderSelect } from '#/views/erp/purchase/order/components'; |
| | | import { WmBatchSelect } from '#/views/wls/batch/components'; |
| | | import { WmMaterialStockSelect } from '#/views/wls/materialstock/components'; |
| | | import { |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'vendorName', |
| | | label: '', |
| | | fieldName: 'purchaseOrderCode', |
| | | label: '采购订单号', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'purchaseOrderId', |
| | | label: '采购订单', |
| | | component: markRaw(ErpPurchaseOrderSelect), |
| | | componentProps: { |
| | | placeholder: '请选择采购订单', |
| | | onChange: (item: any) => { |
| | | if (item?.supplierId && formApi) { |
| | | formApi.setFieldValue('vendorId', item.supplierId); |
| | | formApi.setFieldValue('vendorName', item.supplierName); |
| | | } |
| | | }, |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请输入采购订单号', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | disabled: true, |
| | | disabled: isHeaderReadonly(formType), |
| | | placeholder: '请输入供应商', |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['vendorName'], |
| | | componentProps: (values) => ({ |
| | | placeholder: '请选择供应商', |
| | | disabled: true, |
| | | vendorName: values.vendorName as string, |
| | | }), |
| | | }, |
| | | rules: 'selectRequired', |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'returnDate', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'vendorId', |
| | | fieldName: 'vendorName', |
| | | label: '供应商', |
| | | component: markRaw(MdVendorSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择供应商', |
| | | allowClear: true, |
| | | placeholder: '请输入供应商', |
| | | }, |
| | | }, |
| | | ]; |
| | |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import CrmCustomerSelect from '#/components/crm-customer-select.vue'; |
| | | import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | |
| | | /** 表单类型 */ |
| | |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'saleOrderId', |
| | | label: '销售订单', |
| | | component: markRaw(ErpSaleOrderSelect), |
| | | fieldName: 'saleOrderCode', |
| | | label: '销售订单编号', |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择销售订单', |
| | | // 选择销售订单后,自动回填客户信息 |
| | | onChange: (item: any) => { |
| | | if (item?.customerId && formApi) { |
| | | formApi.setFieldValue('clientId', item.customerId); |
| | | } |
| | | }, |
| | | placeholder: '请输入销售订单编号', |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: markRaw(CrmCustomerSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | disabled: true, |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | rules: 'selectRequired', |
| | | rules: 'required', |
| | | }, |
| | | { |
| | | fieldName: 'salesDate', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | fieldName: 'clientName', |
| | | label: '客户', |
| | | component: markRaw(CrmCustomerSelect), |
| | | component: 'Input', |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | allowClear: true, |
| | | placeholder: '请输入客户名称', |
| | | }, |
| | | }, |
| | | ]; |