From 980cc00b0e1c560276eec3a38a834b991cb74519 Mon Sep 17 00:00:00 2001
From: jingna <1264204245@qq.com>
Date: Thu, 7 Aug 2025 16:21:44 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B5=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/renderer/src/views/Dashboard.vue | 4 +-
frontend/src/renderer/src/views/Detection.vue | 299 +++++++++++++++---
2 files changed, 265 insertions(+), 38 deletions(-)
diff --git a/frontend/src/renderer/src/views/Dashboard.vue b/frontend/src/renderer/src/views/Dashboard.vue
index 85ca187e..bc517c56 100644
--- a/frontend/src/renderer/src/views/Dashboard.vue
+++ b/frontend/src/renderer/src/views/Dashboard.vue
@@ -1012,8 +1012,10 @@ function delClick(id) {
.main-dashboard-top {
display: flex;
width: 100%;
- padding: 15px 20px 0px;
+ align-items: center;
+ padding: 10px 20px;
gap: 20px;
+ background-color: #292929;
}
.main-dashboard-top-title {
diff --git a/frontend/src/renderer/src/views/Detection.vue b/frontend/src/renderer/src/views/Detection.vue
index f0d0857d..ec396dec 100644
--- a/frontend/src/renderer/src/views/Detection.vue
+++ b/frontend/src/renderer/src/views/Detection.vue
@@ -25,12 +25,12 @@
+ --el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;" >
结束
+ --el-button-border-color: transparent;width: 120px;height: 30px;font-size: 20px;">
保存数据
@@ -86,7 +86,7 @@
-
-
{{
+
{{
pressureStatus }}
@@ -239,7 +239,7 @@
基础信息
-
+
@@ -320,7 +320,7 @@
视频
-
@@ -331,8 +331,8 @@
-
-
+
+
用户ID:
{{ patientInfo.sessionId }}
@@ -358,9 +358,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cm
+
+
+
+
+
+
+ kg
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -378,7 +485,7 @@ import html2canvas from 'html2canvas'
import Header from '@/views/Header.vue'
import { useAuthStore } from '../stores/index.js'
import * as echarts from 'echarts'
-import { getBackendUrl } from '../services/api.js'
+import { getBackendUrl ,patientAPI} from '../services/api.js'
const authStore = useAuthStore()
const router = useRouter()
const route = useRoute()
@@ -418,15 +525,47 @@ let frameCount = 0
// 后端服务器地址配置
const BACKEND_URL = getBackendUrl()
+const resDialogVisible = ref(false)
+const reshandleClose = () => {
+ resDialogVisible.value = false
+}
const dialogVisible = ref(false)
const handleClose = () => {
dialogVisible.value = false
}
+// 表单引用
+const patientFormRef = ref()
+// 表单数据
+const saveLoading = ref(false)
+const patientForm = ref({
+ id: '',
+ name: '',
+ gender: '',
+ birth_date: '',
+ nationality: '',
+ residence: '',
+ height: '',
+ weight: '',
+ shoe_size: '',
+ phone: '',
+ occupation: '',
+ workplace: '',
+ email: ''
+})
+const occupationOptions = ref([
+ { label: '学生', value: '学生' }
+])
+const nationalityOptions = ref([
+ { label: '汉族', value: '汉族' }
+])
const diagnosticForm = ref({
diagnosis_info: '',
treatment_info: '',
suggestion_info: ''
})
+const calculatedAge = ref(null)
+//修改
+
// 模拟历史数据
const historyData = ref([
// { id: 3, rotLeft: '-55.2°', rotRight: '54.2°', tiltLeft: '-17.7°', tiltRight: '18.2°', pitchDown: '-20.2°', pitchUp: '10.5°' },
@@ -434,14 +573,14 @@ const historyData = ref([
// { id: 1, rotLeft: '-56.1°', rotRight: '55.7°', tiltLeft: '-17.5°', tiltRight: '18.5°', pitchDown: '-22.2°', pitchUp: '11.5°' }
])
const chartoption = ref({
- backgroundColor: '#000000',
+ backgroundColor: '#242424',
grid: { top: 0, right: 0, bottom: 0, left: 0 },
animation: false,
series: [
{
type: 'gauge',
radius: '180%',
- center: ['50%', '90%'],
+ center: ['50%', '91%'],
startAngle: 180,
endAngle: 0,
min: -90,
@@ -511,7 +650,7 @@ const chartoption = ref({
},
data: [
{
- value: 20
+ value: 0
}
]
}
@@ -560,6 +699,60 @@ const resetTimer = () => {
seconds.value = 0;
blinkState.value = false;
};
+const validateForm = async () => {
+ try {
+ await patientFormRef.value.validate()
+ return true
+ } catch (error) {
+ ElMessage.error('请完善必填信息')
+ return false
+ }
+}
+//保存基础信息
+const handleSave = async () => {
+ if (!(await validateForm())) return
+ saveLoading.value = true
+ try {
+ await savePatient()
+ ElMessage.success('修改成功')
+ dialogVisible.value = false
+ saveLoading.value = false
+ loadPatientInfo()
+ } catch (error) {
+ ElMessage.error('修改失败:' + error.message)
+ saveLoading.value = false
+ } finally {
+ saveLoading.value = false
+ }
+}
+const savePatient = 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
+ }
+}
function routeTo(path) {
router.push(`/`)
}
@@ -578,7 +771,14 @@ const calculateAge = (birthDate) => {
const handleBack = () => {
console.log('返回上一页')
}
-
+const editPatient = () => {
+ // 修改患者信息
+ patientForm.value = JSON.parse(JSON.stringify(patientInfo.value))
+ if (patientForm.value.birth_date) {
+ calculatedAge.value = calculateAge(patientForm.value.birth_date)
+ }
+ dialogVisible.value = true
+}
// WebSocket连接函数
function connectWebSocket() {
try {
@@ -1604,7 +1804,7 @@ async function saveRecording() {
treatment_info: '',
suggestion_info: ''
}
- dialogVisible.value = true
+ resDialogVisible.value = true
} else {
throw new Error(result.message || '保存失败')
}
@@ -1794,13 +1994,6 @@ const initchart = () => {
}
rotationCharts = echarts.init(chartDom);
rotationCharts.setOption(chartoption.value);
-
- // 添加窗口大小调整监听器
- window.addEventListener('resize', () => {
- if (rotationCharts) {
- rotationCharts.resize();
- }
- });
} else {
console.warn('找不到 ID 为 的 DOM 元素');
}
@@ -1812,12 +2005,6 @@ const initchart = () => {
}
pitchCharts = echarts.init(chartDom2);
pitchCharts.setOption(chartoption.value);
- // 添加窗口大小调整监听器
- window.addEventListener('resize', () => {
- if (pitchCharts) {
- pitchCharts.resize();
- }
- });
} else {
console.warn('找不到 ID 为 的 DOM 元素');
}
@@ -1829,15 +2016,21 @@ const initchart = () => {
}
tiltCharts = echarts.init(chartDom3);
tiltCharts.setOption(chartoption.value);
+ } else {
+ console.warn('找不到 ID 为 的 DOM 元素');
+ }
// 添加窗口大小调整监听器
window.addEventListener('resize', () => {
+ if (rotationCharts) {
+ rotationCharts.resize();
+ }
+ if (pitchCharts) {
+ pitchCharts.resize();
+ }
if (tiltCharts) {
tiltCharts.resize();
}
});
- } else {
- console.warn('找不到 ID 为 的 DOM 元素');
- }
});
}
@@ -2403,10 +2596,6 @@ onUnmounted(() => {
color: #ffffff;
}
-:deep(.el-textarea__inner) {
- background: #1D1b26;
- color: #ffffff;
-}
:deep(.el-table .el-table__cell) {
padding: 4px 0px;
@@ -2521,6 +2710,42 @@ onUnmounted(() => {
:deep(.el-scrollbar__wrap){
background: #282828 !important;
}
+:deep(.tsDialog.el-dialog){
+ background-color: #323232;
+ padding:0px;
+ padding-bottom:20px;
+}
+:deep(.tsDialog.el-dialog .el-input__wrapper){
+ background-color: #242424;
+ border: none;
+ box-shadow: none;
+}
+:deep(.tsDialog.el-dialog .el-select__wrapper){
+ background-color: #242424;
+ border: none;
+ box-shadow: none;
+}
+:deep(.tsDialog.el-dialog .el-input__inner){
+ color: #ffffff;
+}
+:deep(.tsDialog.el-dialog .el-select__placeholder){
+ color: #ffffff;
+}
+:deep(.tsDialog.el-dialog .el-dialog__header){
+ border-bottom: 1px solid #1e1e1e;
+ padding:10px 20px;
+}
+:deep(.tsDialog.el-dialog .el-textarea__inner) {
+ background: #242424;
+ color: #ffffff;
+ box-shadow:none;
+}
+:deep( .el-dialog__body){
+ padding:20px;
+}
+:deep(.el-dialog__footer){
+ padding:0px 20px;
+}