eight
2025-04-15 589bcdb26f8e9d3e0d5ef46d27acc901c96d50ea
src/views/ecg/appointment/AppointmentForm.vue
@@ -26,7 +26,7 @@
              <el-radio
                  v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_USER_SEX)"
                  :key="dict.value"
                  :label="dict.value"
                  :value="dict.value"
              >
                {{ dict.label }}
              </el-radio>
@@ -158,6 +158,7 @@
import {DICT_TYPE, getIntDictOptions} from '@/utils/dict'
import { AppointmentApi, AppointmentVO } from '@/api/ecg/appointment'
import {useCheckTypeStore} from "@/store/modules/checkType";
import {getCheckTypeName} from "@/utils/checkTypeFormatter";
/** 预约 表单 */
defineOptions({ name: 'AppointmentForm' })
@@ -219,10 +220,25 @@
    }
  }
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const openByQueue = async (type: string, patId: string, checkType: number) => {
  dialogVisible.value = true
  dialogTitle.value = t('action.' + type)
  formType.value = type
  resetForm()
  // 修改时,设置数据
  if (patId) {
    formLoading.value = true
    try {
      formData.value = await AppointmentApi.getCurAppointmentByPatIdAndCheckType( patId, checkType )
    } 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 +248,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
  }
@@ -265,7 +283,7 @@
    bookTime: undefined,
    bookDate: new Date().getTime(),
    bookTimeslot: 9000930,
    bookCheckType: checkTypeStore.getCheckTypeName(100),
    bookCheckType: getCheckTypeName(100),
    paid: 0,
  }
  formRef.value?.resetFields()
@@ -273,7 +291,7 @@
const searchBookInfo = async () => {
  const tmpPatId = formData.value.patId
  if (null === tmpPatId || "" === tmpPatId)
  if (null == tmpPatId || "" === tmpPatId)
    return
  const data = await AppointmentApi.queryAppointmentFromHis( tmpPatId ) // 对应数据库中 pat_id