From aa0aba6f52399779899c78677617c90a95961e86 Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期一, 04 八月 2025 16:40:31 +0800
Subject: [PATCH] Merge branch 'ID1918-患者姓名脱敏' into test

---
 src/store/bedsideAuxiliaryScreen.ts |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/store/bedsideAuxiliaryScreen.ts b/src/store/bedsideAuxiliaryScreen.ts
index 11ff7fa..63a739c 100644
--- a/src/store/bedsideAuxiliaryScreen.ts
+++ b/src/store/bedsideAuxiliaryScreen.ts
@@ -1,7 +1,6 @@
 import { defineStore } from "pinia";
 import { ref } from "vue";
 import dayjs from "dayjs";
-import cache from "../utils/cache";
 import { EventSourcePolyfill } from "event-source-polyfill";
 import type { BedsideAuxiliaryScreen, SseMsgData } from "./type/bedsideAuxiliaryScreen.type";
 import type { Task } from "./type/task.type";
@@ -11,12 +10,13 @@
   formatDeviceData,
 } from "./type/bedsideAuxiliaryScreen.type";
 import { ElMessage } from "element-plus/es";
+import { Local } from "@/utils/storage";
 
 export const useBedsideAuxiliaryScreenStore = defineStore(
   "bedsideAuxiliaryScreen",
   () => {
     /** 设备编号 */
-    const deviceCode = ref<string>(cache.get("devcieCode") || "");
+    const deviceCode = ref<string>(Local.get("devcieCode") || "");
 
     /** 设备信息数据 */
     const deviceData = ref<BedsideAuxiliaryScreen>(defaultDeviceData());
@@ -30,7 +30,7 @@
      */
     const setDeviceCode = (code: string) => {
       deviceCode.value = code;
-      cache.set("devcieCode", code);
+      Local.set("devcieCode", code);
     };
 
     /**
@@ -110,7 +110,7 @@
         if (retryCount < maxRetryCount) {
           const delay = baseRetryDelay * Math.pow(2, retryCount); // 指数退避
           retryCount++;
-          console.log(`[SSE] 第${retryCount}次重连,延迟${delay}ms`);
+          console.log(`[SSE] 第${retryCount}次重连,延迟${baseRetryDelay}ms`);
           ElMessage.warning(
             `链接服务失败, 第${retryCount}次重连,请耐心等待重连。。`
           );
@@ -134,21 +134,26 @@
           const dataBody = JSON.parse(datax) as SseMsgData;
           console.log("dataBody: ", dataBody);
           // 倒计时提示文本
-          if (dataBody.倒计时?.提醒文本) {
-            const taskTime = dayjs(dataBody.倒计时?.当前服务器时间).add(dataBody.倒计时?.设定提醒倒计时, 'minute')
+          if (dataBody.倒计时?.提醒文本 && Number(dataBody.倒计时?.设定提醒倒计时 > 0)) {
+            const serverTimeRaw = dataBody.倒计时?.当前服务器时间;
+            const reminderMinutes = Number(dataBody.倒计时?.设定提醒倒计时 ?? 0);
+            const serverTimeFormatted = serverTimeRaw.replace(' ', 'T');
+
+            const taskTime = dayjs(serverTimeFormatted).add(reminderMinutes, 'second');
             setSyncTask({
               deviceCode: dataBody.IOT信息.设备唯一编号,
               recordCode: dataBody.透析状态?.透析单编号,
               taskDate: taskTime.format('YYYY-MM-DD HH:mm'),
               taskName: dataBody.倒计时?.提醒文本,
               overdue: false,
+              sync: true,
               countdown: dataBody.倒计时?.设定提醒倒计时
             })
           } else {
             clearTask();
           }
 
-          deviceData.value = formatDeviceData(dataBody);
+          deviceData.value = formatDeviceData(deviceData.value, dataBody);
         }
       };
     };

--
Gitblit v1.8.0