| | |
| | | finishReturnVendor, |
| | | getReturnVendor, |
| | | stockReturnVendor, |
| | | submitReturnVendor, |
| | | updateReturnVendor, |
| | | } from '#/api/mes/wm/returnvendor'; |
| | | import { $t } from '#/locales'; |
| | |
| | | ); |
| | | const isStock = computed(() => formType.value === 'stock'); // 是否为拣货模式 |
| | | const isFinish = computed(() => formType.value === 'finish'); // 是否为完成退货模式 |
| | | const canSubmit = computed( |
| | | () => |
| | | // 是否可提交 |
| | | formType.value === 'update' && |
| | | formData.value?.status === MesWmReturnVendorStatusEnum.PREPARE, |
| | | ); |
| | | const getTitle = computed(() => { |
| | | if (formType.value === 'detail') { |
| | | return $t('ui.actionTitle.view', ['供应商退货单']); |
| | |
| | | return formatDate(value, 'YYYY-MM-DD HH:mm:ss'); |
| | | } |
| | | return undefined; |
| | | } |
| | | |
| | | /** 提交退货单:表单有修改时先保存,再调用提交接口 */ |
| | | async function handleSubmit() { |
| | | const { valid } = await formApi.validate(); |
| | | if (!valid || !formData.value?.id) { |
| | | return; |
| | | } |
| | | modalApi.lock(); |
| | | try { |
| | | const current = JSON.stringify(await formApi.getValues()); |
| | | if (current !== originalSnapshot.value) { |
| | | const data = |
| | | (await formApi.getValues()) as MesWmReturnVendorApi.ReturnVendor; |
| | | await updateReturnVendor({ ...formData.value, ...data }); |
| | | originalSnapshot.value = current; |
| | | } |
| | | await submitReturnVendor(formData.value.id); |
| | | message.success('提交成功'); |
| | | await modalApi.close(); |
| | | emit('success'); |
| | | } finally { |
| | | modalApi.unlock(); |
| | | } |
| | | } |
| | | |
| | | /** 执行拣货:拣货数量与退货数量不一致时二次确认 */ |
| | |
| | | </template> |
| | | <template #prepend-footer> |
| | | <div class="flex flex-auto items-center gap-2"> |
| | | <Popconfirm |
| | | v-if="canSubmit" |
| | | title="确认提交该退货单?【提交后将不能修改】" |
| | | @confirm="handleSubmit" |
| | | > |
| | | <Button type="primary">提交</Button> |
| | | </Popconfirm> |
| | | <Button v-if="isStock" type="primary" @click="handleStock"> |
| | | 执行拣货 |
| | | </Button> |