liu
3 天以前 31f8c28b502a3f963a2651194112584371448e37
src/views/srm/supplierApply/modules/form.vue
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { SrmSupplierApplyApi } from '#/api/srm/supplierApply';
import type { FormType } from '../data';
import { computed, ref } from 'vue';
@@ -19,10 +20,16 @@
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({
@@ -60,7 +67,10 @@
      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;
    }
@@ -78,7 +88,11 @@
</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>