修改实时检查保存方法,添加删除历史检查方法
This commit is contained in:
parent
67a3ff35f2
commit
6d4c22d3f4
@ -13,7 +13,7 @@ api.interceptors.request.use(
|
|||||||
if (window.electronAPI) {
|
if (window.electronAPI) {
|
||||||
config.baseURL = window.electronAPI.getBackendUrl()
|
config.baseURL = window.electronAPI.getBackendUrl()
|
||||||
} else {
|
} else {
|
||||||
config.baseURL = 'http://192.168.1.173:5000'
|
config.baseURL = 'http://192.168.1.58:5000'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 只为需要发送数据的请求设置Content-Type
|
// 只为需要发送数据的请求设置Content-Type
|
||||||
@ -610,16 +610,22 @@ export const historyAPI = {
|
|||||||
// 删除检测数据记录
|
// 删除检测数据记录
|
||||||
detectionDelById(id) {
|
detectionDelById(id) {
|
||||||
return api.delete(`/api/detection/data/${id}`, {})
|
return api.delete(`/api/detection/data/${id}`, {})
|
||||||
|
},
|
||||||
|
// 删除检测会话及其相关的检测数据
|
||||||
|
sessionsDelById(id) {
|
||||||
|
return api.delete(`api/detection/sessions/${id}`, {})
|
||||||
},
|
},
|
||||||
// 获取检测会话历史
|
// 获取检测会话历史
|
||||||
sessionById(id) {
|
sessionById(id) {
|
||||||
return api.get(`/api/history/sessions/${id}`)
|
return api.get(`/api/history/sessions/${id}`)
|
||||||
},
|
},
|
||||||
// detectionLatestById(id) {
|
|
||||||
// return api.get(`/api/detection/data/detail/${id}`)
|
|
||||||
// },
|
|
||||||
|
|
||||||
detectionLatestById(id) {
|
//获取最新的检测数据
|
||||||
|
detectionLatestList(id) {
|
||||||
|
return api.get(`/api/detection/data/detail/${id}/latest`)
|
||||||
|
},
|
||||||
|
//根据主键ID查询检测数据详情
|
||||||
|
detectionById(id) {
|
||||||
return api.get(`/api/detection/data/detail/${id}`)
|
return api.get(`/api/detection/data/detail/${id}`)
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -631,7 +637,7 @@ export const getBackendUrl = () => {
|
|||||||
if (window.electronAPI) {
|
if (window.electronAPI) {
|
||||||
return window.electronAPI.getBackendUrl()
|
return window.electronAPI.getBackendUrl()
|
||||||
} else {
|
} else {
|
||||||
return 'http://192.168.1.173:5000'
|
return 'http://192.168.1.58:5000'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
<div :style="{ color: femtoboltStatus == '已连接' ? '#00CC33' : '#808080' }" style="font-size: 14px;">
|
<div :style="{ color: femtoboltStatus == '已连接' ? '#00CC33' : '#808080' }" style="font-size: 14px;">
|
||||||
{{ femtoboltStatus }}</div>
|
{{ femtoboltStatus }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex;justify-content: center;height: 100%;padding-top: 0px;">
|
<div ref="wholeBodyRef" style="display: flex;justify-content: center;height: 100%;padding-top: 0px;">
|
||||||
<!-- 使用深度相机视频流替换静态图片 -->
|
<!-- 使用深度相机视频流替换静态图片 -->
|
||||||
<img :src="(femtoboltStatus === '已连接' && depthCameraImgSrc) ? depthCameraImgSrc : noImageSvg" alt="深度相机视频流"
|
<img :src="(femtoboltStatus === '已连接' && depthCameraImgSrc) ? depthCameraImgSrc : noImageSvg" alt="深度相机视频流"
|
||||||
style="width: 100%;height: calc(100% - 40px);object-fit:contain;background:#323232;">
|
style="width: 100%;height: calc(100% - 40px);object-fit:contain;background:#323232;">
|
||||||
@ -323,7 +323,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 视频模块 -->
|
<!-- 视频模块 -->
|
||||||
<div class="module-card" style="height: 50%;">
|
<div class="module-card" style="height: 50%;">
|
||||||
<div style="display: flex;margin-bottom: 15px;">
|
<div style="display: flex;">
|
||||||
<div class="module-header">
|
<div class="module-header">
|
||||||
<div class="module-title">
|
<div class="module-title">
|
||||||
<div class="module-title-bg">
|
<div class="module-title-bg">
|
||||||
@ -334,9 +334,12 @@
|
|||||||
<div :style="{ color: cameraStatus == '已连接' ? '#00CC33' : '#808080' }" style="font-size: 14px;">{{ cameraStatus }}</div>
|
<div :style="{ color: cameraStatus == '已连接' ? '#00CC33' : '#808080' }" style="font-size: 14px;">{{ cameraStatus }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div ref="videoImgRef" style="width: 100%;height: calc(100% - 40px)">
|
||||||
|
<img :src="(cameraStatus === '已连接' && rtspImgSrc) ? rtspImgSrc : noImageSvg" alt=""
|
||||||
|
style="width: 100%;height: calc(100%);object-fit:contain;background:#323232;" />
|
||||||
|
</div>
|
||||||
<!-- 使用img元素显示视频流(优化的Data URL方案) -->
|
<!-- 使用img元素显示视频流(优化的Data URL方案) -->
|
||||||
<img :src="(cameraStatus === '已连接' && rtspImgSrc) ? rtspImgSrc : noImageSvg" alt=""
|
|
||||||
style="width: 100%;height: calc(100% - 80px);object-fit:contain;background:#323232;" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -569,6 +572,9 @@ const dataCollectionLoading = ref(false)
|
|||||||
const isRecording = ref(false)
|
const isRecording = ref(false)
|
||||||
const cameraDialogVisible =ref(false) // 设置相机参数弹框
|
const cameraDialogVisible =ref(false) // 设置相机参数弹框
|
||||||
|
|
||||||
|
const wholeBodyRef = ref(null) // 身体姿态ref
|
||||||
|
const videoImgRef =ref(null) // 视频流图片ref
|
||||||
|
|
||||||
// 录像相关变量
|
// 录像相关变量
|
||||||
let mediaRecorder = null
|
let mediaRecorder = null
|
||||||
let recordedChunks = []
|
let recordedChunks = []
|
||||||
@ -908,6 +914,7 @@ const editPatient = () => {
|
|||||||
}
|
}
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
const tempInfo = ref({})
|
||||||
// WebSocket连接函数
|
// WebSocket连接函数
|
||||||
function connectWebSocket() {
|
function connectWebSocket() {
|
||||||
try {
|
try {
|
||||||
@ -1037,25 +1044,29 @@ function connectWebSocket() {
|
|||||||
// 监听各设备数据事件
|
// 监听各设备数据事件
|
||||||
devicesSocket.on('camera_frame', (data) => {
|
devicesSocket.on('camera_frame', (data) => {
|
||||||
frameCount++
|
frameCount++
|
||||||
|
tempInfo.value.camera_frame = data
|
||||||
displayFrame(data.image)
|
displayFrame(data.image)
|
||||||
})
|
})
|
||||||
devicesSocket.on('video_frame', (data) => {
|
// devicesSocket.on('video_frame', (data) => {
|
||||||
frameCount++
|
// frameCount++
|
||||||
displayFrame(data.image)
|
// displayFrame(data.image)
|
||||||
})
|
// })
|
||||||
|
|
||||||
devicesSocket.on('femtobolt_frame', (data) => {
|
devicesSocket.on('femtobolt_frame', (data) => {
|
||||||
|
tempInfo.value.femtobolt_frame = data
|
||||||
displayDepthCameraFrame(data.depth_image || data.image)
|
displayDepthCameraFrame(data.depth_image || data.image)
|
||||||
})
|
})
|
||||||
devicesSocket.on('depth_camera_frame', (data) => {
|
// devicesSocket.on('depth_camera_frame', (data) => {
|
||||||
displayDepthCameraFrame(data.depth_image || data.image)
|
// displayDepthCameraFrame(data.depth_image || data.image)
|
||||||
})
|
// })
|
||||||
|
|
||||||
devicesSocket.on('imu_data', (data) => {
|
devicesSocket.on('imu_data', (data) => {
|
||||||
|
tempInfo.value.imu_data = data
|
||||||
handleIMUData(data)
|
handleIMUData(data)
|
||||||
})
|
})
|
||||||
|
|
||||||
devicesSocket.on('pressure_data', (data) => {
|
devicesSocket.on('pressure_data', (data) => {
|
||||||
|
tempInfo.value.pressure_data = data
|
||||||
handlePressureData(data)
|
handlePressureData(data)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1634,11 +1645,12 @@ async function saveDetectionData() {
|
|||||||
patientId: patientInfo.value.id,
|
patientId: patientInfo.value.id,
|
||||||
patientName: patientInfo.value.name,
|
patientName: patientInfo.value.name,
|
||||||
sessionId: patientInfo.value.sessionId,
|
sessionId: patientInfo.value.sessionId,
|
||||||
head_pose: {},
|
head_data: imu_data,
|
||||||
body_pose: {},
|
body_data: femtobolt_frame,
|
||||||
foot_data: {}
|
foot_data: pressure_data,
|
||||||
|
camera_data: camera_frame,
|
||||||
})
|
})
|
||||||
|
tempInfo.value
|
||||||
// 显示成功消息和文件路径
|
// 显示成功消息和文件路径
|
||||||
ElMessage.success({
|
ElMessage.success({
|
||||||
message: `截图保存成功!`,
|
message: `截图保存成功!`,
|
||||||
@ -2286,6 +2298,9 @@ const getDevicesInit = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
// wholeBodyRef.value
|
||||||
|
console.log(wholeBodyRef.value.getBoundingClientRect())
|
||||||
|
console.log(videoImgRef.value.getBoundingClientRect())
|
||||||
// 加载患者信息
|
// 加载患者信息
|
||||||
loadPatientInfo()
|
loadPatientInfo()
|
||||||
|
|
||||||
@ -2301,6 +2316,7 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|
||||||
if (timerId.value) {
|
if (timerId.value) {
|
||||||
clearInterval(timerId.value);
|
clearInterval(timerId.value);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<div class="content-left-text2">{{ item.created_at }}</div>
|
<div class="content-left-text2">{{ item.created_at }}</div>
|
||||||
<div class="content-left-text3" v-if="index==0">最近会诊</div>
|
<div class="content-left-text3" v-if="index==0">最近会诊</div>
|
||||||
<div class="content-left-text3" v-else>{{ getDayNum(item.created_at,index) }}</div>
|
<div class="content-left-text3" v-else>{{ getDayNum(item.created_at,index) }}</div>
|
||||||
<!-- <el-button type="danger" style="margin-top: 20px;" @click="deleteClick(item,index)">删除</el-button> -->
|
<el-button type="danger" style="margin-top: 20px;" @click="sessionsDelById(item,index)">删除</el-button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="content-center">
|
<div class="content-center">
|
||||||
@ -75,11 +75,11 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 15px;">
|
<div style="margin-top: 15px;">
|
||||||
<div @click="patientdetails(item)">
|
<div @click="patientdetails(item2)">
|
||||||
<img src="@/assets/svg/datalist.svg" alt="" style="cursor: pointer;" title="查看详情">
|
<img src="@/assets/svg/datalist.svg" alt="" style="cursor: pointer;" title="查看详情">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<img src="@/assets/svg/del.svg" alt="" style="cursor: pointer;" title="删除" @click="deleteClick(item2,index)">
|
<img src="@/assets/svg/del.svg" alt="" style="cursor: pointer;" title="删除" @click="deleteClick(item,item2,index)">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -435,6 +435,10 @@ function getDayNum(date2,index){
|
|||||||
|
|
||||||
// 转换为天数
|
// 转换为天数
|
||||||
const daysDiff = Math.floor(timeDiff / (1000 * 3600 * 24));
|
const daysDiff = Math.floor(timeDiff / (1000 * 3600 * 24));
|
||||||
|
|
||||||
|
if(daysDiff == 0){
|
||||||
|
return "当天";
|
||||||
|
}
|
||||||
return daysDiff + "天";
|
return daysDiff + "天";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,6 +548,7 @@ const deleteScreenshot = async (screenshot) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const exportReport = async (record) => {
|
const exportReport = async (record) => {
|
||||||
try {
|
try {
|
||||||
ElMessage.info('正在生成报告...')
|
ElMessage.info('正在生成报告...')
|
||||||
@ -712,8 +717,7 @@ function editClick(row,index) {
|
|||||||
}
|
}
|
||||||
//数据详情
|
//数据详情
|
||||||
function patientdetails(row) {
|
function patientdetails(row) {
|
||||||
// historyAPI.sessionById(row.id).then(res => {
|
detectionById(row)
|
||||||
// })
|
|
||||||
detailsDialogVisible.value = true
|
detailsDialogVisible.value = true
|
||||||
}
|
}
|
||||||
async function handleDiagnosticInfo(status) {
|
async function handleDiagnosticInfo(status) {
|
||||||
@ -776,8 +780,42 @@ const playNewVideo = () => {
|
|||||||
videoPlayerRef.value[index].play()
|
videoPlayerRef.value[index].play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function detectionById(row) {
|
||||||
|
historyAPI.detectionById(row.id).then((response)=>{
|
||||||
|
if(response.success){
|
||||||
|
debugger
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
|
||||||
const deleteClick = async (row) => {
|
})
|
||||||
|
}
|
||||||
|
const deleteClick = async (row,row2) => {
|
||||||
|
detectionLatestList(row.id)
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'确定义删除此条数据?',
|
||||||
|
'提示',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
).then(() => {
|
||||||
|
historyAPI.detectionDelById(row2.id).then((response)=>{
|
||||||
|
if(response.success){
|
||||||
|
ElMessage.success({
|
||||||
|
message: response.message,
|
||||||
|
duration: 5000
|
||||||
|
});
|
||||||
|
sessionsInit()
|
||||||
|
// detectionLatestList(row.id)
|
||||||
|
}
|
||||||
|
}).catch(()=>{
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const sessionsDelById = async (row) => {
|
||||||
|
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
'确定义删除此条数据?',
|
'确定义删除此条数据?',
|
||||||
@ -788,7 +826,7 @@ const deleteClick = async (row) => {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
historyAPI.detectionDelById(row.id).then((response)=>{
|
historyAPI.sessionsDelById(row.id).then((response)=>{
|
||||||
if(response.success){
|
if(response.success){
|
||||||
ElMessage.success({
|
ElMessage.success({
|
||||||
message: response.message,
|
message: response.message,
|
||||||
@ -796,63 +834,20 @@ const deleteClick = async (row) => {
|
|||||||
});
|
});
|
||||||
sessionsInit()
|
sessionsInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const detectionLatestList = async(id)=>{
|
||||||
// try {
|
const response = await historyAPI.detectionLatestList(id)
|
||||||
// // 检查是否有活跃的会话ID
|
console.log(response)
|
||||||
// if (!row.id) {
|
// historyAPI.detectionLatestList(id).then((response)=>{
|
||||||
// throw new Error('缺少会话Id');
|
// if(response.success){
|
||||||
|
// console.log(response)
|
||||||
// }
|
// }
|
||||||
|
// }).catch(()=>{
|
||||||
// // 显示确认对话框
|
// })
|
||||||
// await ElMessageBox.confirm(
|
|
||||||
// '确定要删除此条数据?',
|
|
||||||
// '警告',
|
|
||||||
// {
|
|
||||||
// confirmButtonText: '确定',
|
|
||||||
// cancelButtonText: '取消',
|
|
||||||
// type: 'warning',
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
|
|
||||||
// // 调用后端API删除数据
|
|
||||||
// const response = await fetch(`${BACKEND_URL}/api/detection/data/${row.id}`, {
|
|
||||||
// method: 'DELETE',
|
|
||||||
// headers: {
|
|
||||||
// 'Content-Type': 'application/json'
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if (!response.ok) {
|
|
||||||
// throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const result = await response.json();
|
|
||||||
// if (result.success) {
|
|
||||||
// ElMessage.success({
|
|
||||||
// message: '删除成功',
|
|
||||||
// duration: 5000
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// throw new Error(result.message || '删除失败');
|
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// // 如果是用户取消操作,不显示错误
|
|
||||||
// if (error === 'cancel' || error === 'close') {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ElMessage.error({
|
|
||||||
// message: error.message || '删除过程中发生错误',
|
|
||||||
// duration: 5000
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
// // 其他控制方法
|
// // 其他控制方法
|
||||||
// const togglePlayPause = () => {
|
// const togglePlayPause = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user