| | |
| | | } |
| | | } |
| | | } |
| | | 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() |
| | |
| | | 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 |
| | | } |