From c4315986bc6ff814b0d8975699d9e89ab75961a2 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 13 十月 2023 10:19:35 +0800
Subject: [PATCH] 更新体重秤通讯

---
 src/views/home/index.vue |   52 +++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 992881b..e102b5f 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -201,9 +201,9 @@
           </div>
         </div>
     </div>
-    <el-dialog title="提示" v-model="netLink" width="30%">
+    <!-- <el-dialog title="提示" v-model="netLink" width="30%">
       <span>无法链接到网络!</span>
-    </el-dialog>
+    </el-dialog> -->
   </div>
 </template>
 <script setup lang="ts">
@@ -222,7 +222,9 @@
 import{initPort} from '@/samples/portApi'
 import{initPort as oumulongHbp9030 } from '@/samples/deviceApi/oumulong-HBP-9030'
 import{initPort as zhiRongT605 } from '@/samples/deviceApi/zhiRongT605'
-
+import{initPort as taiHengM523 } from '@/samples/deviceApi/taiHengM523'
+// 读取体重文件
+import{toDataTz,todatatzs } from '@/samples/deviceApi/seca101'
 import { ElLoading, ElMessage } from 'element-plus'
 let trackerTask: any = null;
 // 标识用的画布
@@ -315,8 +317,16 @@
     ipcRenderer.invoke('logger', '网络已经断开')
   }else{
     ipcRenderer.invoke('logger', '网络已经恢复')
+   
   }
   return !sockte.netLink
+})
+watch(netLink,()=>{
+  if(!netLink.value){
+    ElMessage.success('网络已经连接')
+  }else{
+    ElMessage.warning('网络已断开,等待重连')
+  }
 })
 
 // 体重
@@ -421,6 +431,7 @@
       dialogVisible.value = false
       speech.value?.speak({ text: str }).then(() => {
       })
+
       sockteStore().setweightSockte({
         type: "体重秤",
         state: 2,
@@ -435,6 +446,9 @@
         result: "",
         resultTime: ""
       })
+     
+     
+      
 
     }
     // 没有找到患者
@@ -492,7 +506,7 @@
           settime()
           // 定时数秒器
           const tt = mode.weight.replace('.', '点')
-          speech.value?.speak({ text: `称重完成,${tt}kg` }).then(() => {
+          speech.value?.speak({ text: `称重完成,${tt}千克` }).then(() => {
             console.log("播报完成...")
           })
           patientCodeLs = mode.patientCode
@@ -650,7 +664,7 @@
   sendPationCodeApi(inputCode.value)
   setTimeout(function () {
     inputCode.value = ''
-  }, 1000)
+  }, 5000)
 }
 // 点击10下关闭程序
 const guyanbi = () => {
@@ -660,9 +674,9 @@
   }
 }
 onMounted(() => {
+  console.log(0%5)
   console.log('页面初始化', os.hostname())
   setTimeout(()=>{
-
     console.log('8秒后执行')
     console.log('打印设置文件')
     console.log(configData.value)
@@ -676,7 +690,17 @@
     }
     // 是否开启志荣体重秤联机
     if(configData.value.Is_tzc){
-      zhiRongT605(configData.value.tzcPortPath,configData.value.tzcBaudRate)
+      //台衡M523
+      if(configData.value.tzc_type==='taiHengM523'){
+        taiHengM523(configData.value.tzcPortPath,configData.value.tzcBaudRate)
+      }
+      // seca101读取文件
+      else if(configData.value.tzc_type==='seca101'){
+        console.log('体重是读取文件')
+      }
+      else{
+        zhiRongT605(configData.value.tzcPortPath,configData.value.tzcBaudRate)
+      }
     }
     // 是否开启脸识别
     isUseFaceRecogService.value = configData.value.isUseFaceRecogService
@@ -693,10 +717,9 @@
     setInterval(function () {
       clockNum.value--
       if(clockNum.value===0){
-       
         fuxuan()
       }
-      inputRef.value.focus();
+      
       date.value=formatDate(new Date(),'YYYY-mm-dd HH:MM')
       if(Number(date.value.substring(11,13))<12){
         timeShidaun.value='上午好!'
@@ -705,6 +728,17 @@
       }else {
         timeShidaun.value='晚上好!'
       }
+      //5秒一次验证读取体重数据
+      console.log(clockNum.value,clockNum.value%5==0)
+      if(clockNum.value%3==0){
+        // 验证人脸识别已经通过但是还没有体重数据主动获取数据
+        if(patientInfo.value.name!==''&&weightInfo.value.result==='0'){
+          console.log('主动获取体重')
+          todatatzs(patientInfo.value.datetime)
+        }
+      }
+      inputRef.value.focus();
+
     }, 1000)
     speech.value = new Speech();
     speech.value?.setLanguage('zh-CN')

--
Gitblit v1.8.0