From 1051ab47ac671486801296ccf0ad7c0ed527d7e6 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期二, 22 四月 2025 15:23:19 +0800
Subject: [PATCH] gx优化播报延时
---
src/views/home/index.vue | 35 ++++++++++++++---
src/stores/StoresConfing.ts | 2
imgs/1745300147337.png | 0
src/stores/sockteInfo.ts | 42 +++++++++++++++++----
4 files changed, 64 insertions(+), 15 deletions(-)
diff --git a/imgs/1745300147337.png b/imgs/1745300147337.png
new file mode 100644
index 0000000..59b7bf9
--- /dev/null
+++ b/imgs/1745300147337.png
Binary files differ
diff --git a/src/stores/StoresConfing.ts b/src/stores/StoresConfing.ts
index f671846..affed01 100644
--- a/src/stores/StoresConfing.ts
+++ b/src/stores/StoresConfing.ts
@@ -52,7 +52,7 @@
confingInfo.value=info
// 给默认值
if(info.BobaoJg===undefined){
- confingInfo.value.BobaoJg=4
+ confingInfo.value.BobaoJg=10
}
//
if(info.isLanFace===undefined){
diff --git a/src/stores/sockteInfo.ts b/src/stores/sockteInfo.ts
index 973b618..c3ae235 100644
--- a/src/stores/sockteInfo.ts
+++ b/src/stores/sockteInfo.ts
@@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
+import { patientInfoStore } from './patient';
import { ref } from 'vue'
import { Session } from '@/utils/storage'
import { boolean, string } from 'yargs'
@@ -74,14 +75,39 @@
* @param infoObj 体重结果
*/
function setweightSockte(infoObj:info){
- if(Number(infoObj.result)>10||Number(infoObj.result)===0){
- weightSockte.value.deviceName=infoObj.deviceName
- weightSockte.value.result=infoObj.result
- weightSockte.value.resultTime=infoObj.resultTime
- weightSockte.value.state=infoObj.state
- }else{
- console.log('体重不足10kg')
- }
+ console.log('更新体重秤看看有没有患者信息')
+ const patientInfo = patientInfoStore();
+ // 当患者信息有名字 ,还有体重值,我就放弃体重赋值
+ if(patientInfo.patientInfo.name!==''&&weightSockte.value.result!=='0'){
+ console.log('当患者信息有名字 ,还有体重值,我就放弃体重赋值')
+ return true
+ }
+ // 当患者信息没有 ,体重有值的时候
+ else if(patientInfo.patientInfo.name===''&&weightSockte.value.result!=='0'){
+ console.log('当患者信息没有 ,体重有值的时候')
+ console.log(patientInfo.patientInfo.name,weightSockte.value.result);
+ if(Number(infoObj.result)>10||Number(infoObj.result)===0){
+ weightSockte.value.deviceName=infoObj.deviceName
+ weightSockte.value.result=infoObj.result
+ weightSockte.value.resultTime=infoObj.resultTime
+ weightSockte.value.state=infoObj.state
+ }else{
+ console.log('体重不足10kg')
+ }
+ }
+ else{
+ console.log('直接赋值')
+ console.log(patientInfo.patientInfo.name,weightSockte.value.result);
+ if(Number(infoObj.result)>10||Number(infoObj.result)===0){
+ weightSockte.value.deviceName=infoObj.deviceName
+ weightSockte.value.result=infoObj.result
+ weightSockte.value.resultTime=infoObj.resultTime
+ weightSockte.value.state=infoObj.state
+ }else{
+ console.log('体重不足10kg')
+ }
+ }
+
}
/**
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index bfb84c2..bd80506 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -710,6 +710,7 @@
}
// 没有找到患者
else if (patientInfo.value.name === '') {
+ timer=new Date()
ipcRenderer.invoke('logger', '接收到的患者为空')
console.log('接收到的患者为空')
if (isUseFaceRecogService.value) {
@@ -752,7 +753,7 @@
() => weightInfo.value.resultTime,
async () => {
const X= jgTime(timer,new Date())
- // console.log(X,'收到体重',configData.value.BobaoJg)
+ console.log(X,'收到体重',configData.value.BobaoJg)
// 体重不能0
if (weightInfo.value.result !== "0"&&patientInfo.value.code!=='') {
ipcRenderer.invoke('logger', `体重变化了:${weightInfo.value.result}`)
@@ -786,14 +787,36 @@
}else if(Number(patientInfo.value.pureWeight) !== 0&&patientInfo.value.isAfterMed===1 && patientInfo.value.preWeight>10){
aimTSL.value = (Number(patientInfo.value.preWeight)- Number(patientInfo.value.pureWeight) - Number(patientInfo.value.clothesWeight)).toFixed(2)
}
- }// 要过4秒才能重复播报这个消息
- else if(patientInfo.value.code===''&&weightInfo.value.result !== "0"&&X>configData.value.BobaoJg){
- timer=new Date()
- speech.value?.speak({ text: "没有识别的患者,请先验证患者" }).then(() => {
- })
+ }// 要过设置的10秒才能重复播报这个消息
+ else if(patientInfo.value.code===''&&weightInfo.value.result !== "0"){
+ //10后才执行
+ if(播报是否完成.value){
+ 播报是否完成.value=false
+ setTimeout(bobaoyuy, configData.value.BobaoJg*1000);
+ }else{
+ console.log('上一次播报还没完成,放弃这次播报',播报是否完成.value)
+ }
+
+
}
}
);
+// 默认播报完成
+const 播报是否完成=ref(true)
+const bobaoyuy=()=>{
+
+ if(patientInfo.value.name===''){
+ speech.value?.speak({ text: "没有识别的患者,请先验证患者",onend:()=>{
+ console.log('播报完成')
+
+ 播报是否完成.value=true
+ console.log('播报完成111111',播报是否完成.value)
+ }
+ })
+ 播报是否完成.value=true
+ }
+
+}
// 血压发送了变化
watch(
() => xyjInfo.value.resultTime,
--
Gitblit v1.8.0