eight
2024-10-31 812ffe6f989303514b45f8106f09ff902bbe0d8a
src/views/ecg/appointment/AppointmentForm.vue
@@ -219,10 +219,25 @@
    }
  }
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const openByQueue = async (type: string, patId: string) => {
  dialogVisible.value = true
  dialogTitle.value = t('action.' + type)
  formType.value = type
  resetForm()
  // 修改时,设置数据
  if (patId) {
    formLoading.value = true
    try {
      formData.value = await AppointmentApi.getCurAppointmentByPatId( patId )
    } finally {
      formLoading.value = false
    }
  }
}
defineExpose({ open, openByQueue }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
const emit = defineEmits(['event_appointment_success']) // 定义 success 事件,用于操作成功后的回调
const submitForm = async () => {
  // 校验表单
  await formRef.value.validate()
@@ -232,14 +247,16 @@
    const data = formData.value as unknown as AppointmentVO
    if (formType.value === 'create') {
      await AppointmentApi.createAppointment(data)
      // 发送操作成功的事件
      emit('event_appointment_success')
      message.success(t('common.createSuccess'))
    } else {
    } else if (formType.value === 'update') {
      await AppointmentApi.updateAppointment(data)
      // 发送操作成功的事件
      emit('event_appointment_success')
      message.success(t('common.updateSuccess'))
    }
    dialogVisible.value = false
    // 发送操作成功的事件
    emit('success')
  } finally {
    formLoading.value = false
  }