| | |
| | | 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: '请输入客户名称', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | label: `${item.productName || ''}(${item.productBarCode || ''})`, |
| | | value: item.productId, |
| | | })), |
| | | showSearch: true, |
| | | onChange: (value: number | undefined) => { |
| | | const selected = items.find((i) => i.productId === value); |
| | | onItemChange?.(selected); |