diff --git a/frontend/src/renderer/src/assets/new/add.png b/frontend/src/renderer/src/assets/new/add.png new file mode 100644 index 00000000..6646b708 Binary files /dev/null and b/frontend/src/renderer/src/assets/new/add.png differ diff --git a/frontend/src/renderer/src/assets/new/bigavatar.svg b/frontend/src/renderer/src/assets/new/bigavatar.svg new file mode 100644 index 00000000..38c0f6bd --- /dev/null +++ b/frontend/src/renderer/src/assets/new/bigavatar.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/renderer/src/assets/new/homeedit.png b/frontend/src/renderer/src/assets/new/homeedit.png new file mode 100644 index 00000000..e0a0de5d Binary files /dev/null and b/frontend/src/renderer/src/assets/new/homeedit.png differ diff --git a/frontend/src/renderer/src/services/api.js b/frontend/src/renderer/src/services/api.js index c175d682..1e9c3726 100644 --- a/frontend/src/renderer/src/services/api.js +++ b/frontend/src/renderer/src/services/api.js @@ -13,7 +13,7 @@ api.interceptors.request.use( if (window.electronAPI) { config.baseURL = window.electronAPI.getBackendUrl() } else { - config.baseURL = 'http://localhost:5000' + config.baseURL = 'http://192.168.1.62:5000' } // 为需要发送数据的请求设置Content-Type(避免覆盖FormData) @@ -660,7 +660,7 @@ export const getBackendUrl = () => { if (window.electronAPI) { return window.electronAPI.getBackendUrl() } else { - return 'http://localhost:5000' + return 'http://192.168.1.62:5000' } } diff --git a/frontend/src/renderer/src/views/Dashboard.vue b/frontend/src/renderer/src/views/Dashboard.vue index 7ed94a00..30c7e78f 100644 --- a/frontend/src/renderer/src/views/Dashboard.vue +++ b/frontend/src/renderer/src/views/Dashboard.vue @@ -10,17 +10,15 @@
- - - - 新建患者档案 - +
+ 新建患者档案 +
- - - - + + - - @@ -152,19 +142,21 @@ const patientForm = reactive({ shoe_size: '', phone: '', occupation: '', - workplace: '', + idcode: '', email: '' }) // 加载状态 const saveLoading = ref(false) const saveAndDetectLoading = ref(false) -const patienttitle = ref("新建患者信息") +const patienttitle = ref("新建档案") // 生命周期 onMounted(() => { // 从认证状态管理中加载用户信息 if (props.patienttype == 'edit') { - patienttitle.value = '编辑患者信息' - Object.assign(patientForm, props.selectedPatient) + patienttitle.value = '编辑个人信息' + let tempInfo = props.selectedPatient + tempInfo.age = calculateAgeres(tempInfo.birth_date ) + Object.assign(patientForm, tempInfo) } @@ -227,7 +219,7 @@ const calculateAgeres = (date) => { calculatedAge.value = age } const handleCancel = async () => { - emit('closecreatbox',false) + emit('closecreatbox','关闭','') } const validateForm = async () => { @@ -253,7 +245,7 @@ const savePatient = async () => { email: patientForm.email, nationality: patientForm.nationality, residence: patientForm.residence, - workplace: patientForm.workplace, + idcode: patientForm.idcode, medical_history: '', // 添加病史字段 notes: '' // 添加备注字段 } @@ -261,7 +253,7 @@ const savePatient = async () => { try { const response = await patientAPI.create(patientData) if (response.success) { - emit('closecreatbox',true) + emit('closecreatbox','新建',response.data) return response.data } else { @@ -274,24 +266,25 @@ const savePatient = async () => { } const updatePatient = async () => { const patientData = { - id: patientForm.value.id, - name: patientForm.value.name, - gender: patientForm.value.gender, + id: patientForm.id, + name: patientForm.name, + gender: patientForm.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 + birth_date: patientForm.birth_date, + height: patientForm.height, + weight: patientForm.weight, + shoe_size: patientForm.shoe_size, + phone: patientForm.phone, + occupation: patientForm.occupation, + email: patientForm.email, + nationality: patientForm.nationality, + residence: patientForm.residence, + idcode: patientForm.idcode } try { - const response = await patientAPI.updatePatient(patientForm.value.id, patientData) + const response = await patientAPI.updatePatient(patientForm.id, patientData) if (response.success) { + emit('closecreatbox','编辑',patientData) return response.data } else { throw new Error(response.message || '修改失败') @@ -305,35 +298,22 @@ const handleSave = async () => { saveLoading.value = true try { - if(patientForm.value.id == null){ + if(patientForm.id == null){ await savePatient() - }else[ - await updatePatient () - ] + }else{ + await updatePatient() + } + + ElMessage.success('患者档案保存成功') + } catch (error) { ElMessage.error('保存失败:' + error.message) } finally { saveLoading.value = false } } - -const handleSaveAndDetect = async () => { - if (!(await validateForm())) return - - saveAndDetectLoading.value = true - try { - const patient = await savePatient() - ElMessage.success('患者档案保存成功,即将开始检测') - emit('closecreatbox',patient) - // router.push(`/detection/${patient.id}`) - } catch (error) { - ElMessage.error('保存失败:' + error.message) - } finally { - saveAndDetectLoading.value = false - } -}