| | |
| | | |
| | | import { confirm, useVbenModal } from '@vben/common-ui'; |
| | | import { MesWmReturnVendorStatusEnum } from '@vben/constants'; |
| | | import { formatDate } from '@vben/utils'; |
| | | |
| | | import { Button, Divider, message, Popconfirm } from 'ant-design-vue'; |
| | | |
| | |
| | | showDefaultActions: false, |
| | | wrapperClass: 'grid-cols-3', |
| | | }); |
| | | |
| | | function normalizeReturnDate(value: unknown): string | undefined { |
| | | if (Array.isArray(value) && value.length >= 3) { |
| | | const [year, month, day] = value; |
| | | return `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')} 00:00:00`; |
| | | } |
| | | if (typeof value === 'number' || typeof value === 'string') { |
| | | return formatDate(value, 'YYYY-MM-DD HH:mm:ss'); |
| | | } |
| | | return undefined; |
| | | } |
| | | |
| | | /** 提交退货单:表单有修改时先保存,再调用提交接口 */ |
| | | async function handleSubmit() { |
| | |
| | | try { |
| | | formData.value = await getReturnVendor(data.id); |
| | | // 设置到 values |
| | | await formApi.setValues(formData.value); |
| | | await formApi.setValues({ |
| | | ...formData.value, |
| | | returnDate: normalizeReturnDate(formData.value.returnDate), |
| | | }); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |