| | |
| | | <script lang="ts" setup> |
| | | import type { SrmSupplierApplyApi } from '#/api/srm/supplierApply'; |
| | | import type { FormType } from '../data'; |
| | | |
| | | import { computed, ref } from 'vue'; |
| | | |
| | |
| | | |
| | | const emit = defineEmits(['success']); |
| | | const formData = ref<SrmSupplierApplyApi.ApplyVO>(); |
| | | const formType = ref<FormType>('create'); |
| | | |
| | | const getTitle = computed(() => { |
| | | return formData.value?.id |
| | | ? $t('ui.actionTitle.edit', ['准入申请']) |
| | | : $t('ui.actionTitle.create', ['准入申请']); |
| | | if (formType.value === 'create') { |
| | | return $t('ui.actionTitle.create', ['准入申请']); |
| | | } else if (formType.value === 'edit') { |
| | | return $t('ui.actionTitle.edit', ['准入申请']); |
| | | } else { |
| | | return '准入申请详情'; |
| | | } |
| | | }); |
| | | |
| | | const [Form, formApi] = useVbenForm({ |
| | |
| | | formData.value = undefined; |
| | | return; |
| | | } |
| | | const data = modalApi.getData<SrmSupplierApplyApi.ApplyVO>(); |
| | | const data = modalApi.getData<{ formType: FormType; id?: number }>(); |
| | | formType.value = data?.formType ?? 'create'; |
| | | formApi.setDisabled(formType.value === 'detail'); |
| | | formApi.updateSchema(useFormSchema(formApi)); |
| | | if (!data || !data.id) { |
| | | return; |
| | | } |
| | |
| | | </script> |
| | | |
| | | <template> |
| | | <Modal :title="getTitle" class="w-1/2"> |
| | | <Modal |
| | | :title="getTitle" |
| | | class="w-1/2" |
| | | :show-confirm-button="formType !== 'detail'" |
| | | > |
| | | <Form class="mx-4" /> |
| | | </Modal> |
| | | </template> |