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