diff --git a/frontend/src/renderer/src/views/Detection.vue b/frontend/src/renderer/src/views/Detection.vue
index 7d1a9b54..11b6cd2f 100644
--- a/frontend/src/renderer/src/views/Detection.vue
+++ b/frontend/src/renderer/src/views/Detection.vue
@@ -320,13 +320,13 @@
-
+
-
+
-
+
@@ -335,8 +335,8 @@
@@ -398,7 +398,11 @@ const dialogVisible = ref(false)
const handleClose = () => {
dialogVisible.value = false
}
-const diagnosticForm = ref({})
+const diagnosticForm = ref({
+ diagnosis_info:'',
+ treatment_info:'',
+ suggestion_info:''
+})
// 模拟历史数据
const historyData = ref([
// { id: 3, rotLeft: '-55.2°', rotRight: '54.2°', tiltLeft: '-17.7°', tiltRight: '18.2°', pitchDown: '-20.2°', pitchUp: '10.5°' },
@@ -1064,7 +1068,51 @@ function stopPressureStreaming() {
}
}
+async function handleDiagnosticInfo(status){
+ try {
+ // 检查是否有活跃的会话ID
+ if (!patientInfo.value.sessionId) {
+ throw new Error('缺少会话Id')
+ }
+ // 调用后端API采集检测数据
+ const response = await fetch(`${BACKEND_URL}/api/detection/${patientInfo.value.sessionId}/save-info`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ diagnosis_info:diagnosticForm.diagnosis_info,
+ treatment_info:diagnosticForm.treatment_info,
+ suggestion_info:diagnosticForm.suggestion_info,
+ status:status,
+ session_id:patientInfo.value.sessionId,
+ })
+ })
+ if (!response.ok) {
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`)
+ }
+ const result = await response.json()
+ if (result.success) {
+ // 显示成功消息
+ ElMessage.success({
+ message: status + '诊断信息成功',
+ duration: 5000
+ })
+ patientInfo.value.sessionId = null
+ } else {
+ throw new Error(result.message || '诊断信息失败')
+ }
+ } catch (error) {
+ ElMessage.error({
+ message: errorMessage,
+ duration: 5000
+ })
+ patientInfo.value.sessionId = null
+ } finally {
+ patientInfo.value.sessionId = null
+ }
+}
// 检测数据采集功能
async function handleDataCollection() {
@@ -1238,7 +1286,6 @@ async function saveDetectionData() {
// 调用后端API保存检测数据
async function sendDetectionData(data) {
-
try {
const response = await fetch(`${BACKEND_URL}/api/detection/${patientInfo.value.sessionId}/collect`
, {
@@ -1495,7 +1542,6 @@ async function saveRecording() {
const result = await response.json()
if (result.success) {
//诊断信息说明
- dialogVisible.value = true
console.log('🎬 录像保存成功:', result.filepath)
ElMessage.success({
message: `录像保存成功!文件路径: ${result.filepath}`,
@@ -1518,6 +1564,12 @@ async function saveRecording() {
// 录像保存完成后,清空会话ID,正式结束会话
// patientInfo.value.sessionId = null
console.log('✅ 会话正式结束,会话ID已清空')
+ diagnosticForm.value = {
+ diagnosis_info:'',
+ treatment_info:'',
+ suggestion_info:''
+ }
+ dialogVisible.value = true
} else {
throw new Error(result.message || '保存失败')
}
@@ -1529,7 +1581,7 @@ async function saveRecording() {
duration: 5000
})
// 即使保存失败,也要清空会话ID,避免状态混乱
- patientInfo.value.sessionId = null
+ // patientInfo.value.sessionId = null
console.log('⚠️ 录像保存失败,但会话已结束,会话ID已清空')
}
}
@@ -1542,9 +1594,6 @@ async function saveRecording() {
} catch (error) {
console.error('❌ 保存录像失败:', error)
ElMessage.error(`保存录像失败: ${error.message}`)
-
- // 即使保存失败,也要清空会话ID,避免状态混乱
- patientInfo.value.sessionId = null
console.log('⚠️ 录像保存失败,但会话已结束,会话ID已清空')
}
}