优化提交
This commit is contained in:
parent
94d52e4237
commit
8f1eb56a47
@ -606,6 +606,10 @@ const isCloseCreat = ref(false)
|
||||
function closecreatbox(e){
|
||||
if(e == true){
|
||||
loadPatients()
|
||||
}else if(e != null && e.id != null) {
|
||||
selectedPatient.value = e
|
||||
loadPatients()
|
||||
isDetection.value = true
|
||||
}
|
||||
isCloseCreat.value = false
|
||||
}
|
||||
|
||||
@ -2125,7 +2125,7 @@ function closeDiagnosticMessage(e){
|
||||
|
||||
|
||||
function closecreatbox(e){
|
||||
if(e == true){
|
||||
if(e === true){
|
||||
loadPatientInfo()
|
||||
}
|
||||
isCloseCreat.value = false
|
||||
|
||||
@ -102,12 +102,16 @@
|
||||
class="formsaveCancel">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="primary" :loading="saveLoading" @click="handleSaveAndDetect"
|
||||
class="formsaveCancel">
|
||||
保存并开始检测
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- 底部操作按钮 -->
|
||||
<!-- <div class="footer-actions">
|
||||
<el-button type="success" :loading="saveAndDetectLoading" @click="handleSaveAndDetect">
|
||||
<el-button type="success" :loading="saveAndDetectLoading">
|
||||
保存并开始检测
|
||||
</el-button>
|
||||
</div> -->
|
||||
@ -242,7 +246,6 @@ const savePatient = async () => {
|
||||
const genderValue = genderMap[patientForm.gender] || patientForm.gender
|
||||
|
||||
const patientData = {
|
||||
id: patientForm.id,
|
||||
name: patientForm.name,
|
||||
gender: genderValue,
|
||||
birth_date: patientForm.birth_date,
|
||||
@ -273,15 +276,46 @@ const savePatient = async () => {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const updatePatient = async () => {
|
||||
const patientData = {
|
||||
id: patientForm.value.id,
|
||||
name: patientForm.value.name,
|
||||
gender: patientForm.value.gender,
|
||||
age: calculatedAge.value,
|
||||
birth_date: patientForm.value.birth_date,
|
||||
height: patientForm.value.height,
|
||||
weight: patientForm.value.weight,
|
||||
shoe_size: patientForm.value.shoe_size,
|
||||
phone: patientForm.value.phone,
|
||||
occupation: patientForm.value.occupation,
|
||||
email: patientForm.value.email,
|
||||
nationality: patientForm.value.nationality,
|
||||
residence: patientForm.value.residence,
|
||||
workplace: patientForm.value.workplace
|
||||
}
|
||||
try {
|
||||
const response = await patientAPI.updatePatient(patientForm.value.id, patientData)
|
||||
if (response.success) {
|
||||
return response.data
|
||||
} else {
|
||||
throw new Error(response.message || '修改失败')
|
||||
}
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
const handleSave = async () => {
|
||||
if (!(await validateForm())) return
|
||||
|
||||
saveLoading.value = true
|
||||
saveLoading.value = true
|
||||
try {
|
||||
await savePatient()
|
||||
if(patientForm.value.id == null){
|
||||
await savePatient()
|
||||
}else[
|
||||
await updatePatient ()
|
||||
]
|
||||
|
||||
ElMessage.success('患者档案保存成功')
|
||||
router.push('/')
|
||||
} catch (error) {
|
||||
ElMessage.error('保存失败:' + error.message)
|
||||
} finally {
|
||||
@ -296,7 +330,8 @@ const handleSaveAndDetect = async () => {
|
||||
try {
|
||||
const patient = await savePatient()
|
||||
ElMessage.success('患者档案保存成功,即将开始检测')
|
||||
router.push(`/detection/${patient.id}`)
|
||||
emit('closecreatbox',patient)
|
||||
// router.push(`/detection/${patient.id}`)
|
||||
} catch (error) {
|
||||
ElMessage.error('保存失败:' + error.message)
|
||||
} finally {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user