| | |
| | | import { |
| | | DICT_TYPE, |
| | | MesAutoCodeRuleCode, |
| | | MesWmSalesNoticeOutStatusEnum, |
| | | } from '@vben/constants'; |
| | | |
| | | import { Button, Tag } from 'ant-design-vue'; |
| | | import { Button } from 'ant-design-vue'; |
| | | |
| | | 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 { MdClientSelect } from '#/views/mes/md/client/components'; |
| | | import { MdItemSelect } from '#/views/mes/md/item/components'; |
| | | |
| | | /** 表单类型 */ |
| | | export type FormType = 'create' | 'detail' | 'finish' | 'update'; |
| | | export type FormType = 'create' | 'detail' | 'update'; |
| | | |
| | | /** 表单头部是否只读(详情、执行出库态) */ |
| | | /** 表单头部是否只读(详情态) */ |
| | | function isHeaderReadonly(formType: FormType): boolean { |
| | | return formType === 'detail' || formType === 'finish'; |
| | | return formType === 'detail'; |
| | | } |
| | | |
| | | /** 新增/修改的表单 */ |
| | |
| | | onChange: (item: any) => { |
| | | if (item?.customerId && formApi) { |
| | | formApi.setFieldValue('clientId', item.customerId); |
| | | formApi.setFieldValue('clientName', item.customerName); |
| | | } |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientName', |
| | | label: '', |
| | | component: 'Input', |
| | | dependencies: { |
| | | triggerFields: [''], |
| | | show: () => false, |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | disabled: true, |
| | | }, |
| | | dependencies: { |
| | | triggerFields: ['clientName'], |
| | | componentProps: (values) => ({ |
| | | placeholder: '请选择客户', |
| | | disabled: true, |
| | | clientName: values.clientName as string, |
| | | }), |
| | | }, |
| | | rules: 'selectRequired', |
| | | }, |
| | |
| | | }, |
| | | }, |
| | | { |
| | | fieldName: 'salesOrderCode', |
| | | fieldName: 'saleOrderCode', |
| | | label: '销售订单编号', |
| | | component: 'Input', |
| | | componentProps: { |
| | |
| | | { |
| | | fieldName: 'clientId', |
| | | label: '客户', |
| | | component: markRaw(MdClientSelect), |
| | | component: markRaw(CrmCustomerSelect), |
| | | componentProps: { |
| | | placeholder: '请选择客户', |
| | | }, |
| | |
| | | minWidth: 150, |
| | | }, |
| | | { |
| | | field: 'salesOrderCode', |
| | | field: 'saleOrderCode', |
| | | title: '销售订单编号', |
| | | minWidth: 140, |
| | | }, |
| | |
| | | field: 'outStatus', |
| | | title: '出库状态', |
| | | minWidth: 100, |
| | | cellRender: { |
| | | name: 'CellTag', |
| | | props: { |
| | | formatter: ({ row }: { row: MesWmSalesNoticeApi.SalesNotice }) => { |
| | | const statusMap: Record<number, { color: string; label: string }> = { |
| | | [MesWmSalesNoticeOutStatusEnum.NONE]: { color: 'default', label: '未出库' }, |
| | | [MesWmSalesNoticeOutStatusEnum.PARTIAL]: { color: 'warning', label: '部分出库' }, |
| | | [MesWmSalesNoticeOutStatusEnum.ALL]: { color: 'success', label: '全部出库' }, |
| | | }; |
| | | const status = statusMap[row.outStatus ?? MesWmSalesNoticeOutStatusEnum.NONE]; |
| | | return { color: status?.color, label: status?.label ?? '未出库' }; |
| | | }, |
| | | }, |
| | | }, |
| | | slots: { default: 'outStatus' }, |
| | | }, |
| | | { |
| | | title: '操作', |