单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
chenyc
2025-06-05 d37d152c6638aef9bd29887c037f8ef638603d39
src/views/deviceWindoes2.vue
@@ -43,9 +43,10 @@
                
                <div style="position: absolute; top: 0; right: 0; display: flex;  align-items: center; justify-content: flex-end; padding: 5px; height: 100%;">
                  <div class="grid-container" style="display: flex; align-items: center; padding-right: 20px;">
                      <!-- <span style="display: inline-block; margin-right: 15px;">
                      <span style="display: inline-block; margin-right: 15px; font-size: 30px; color: #F56C6C;">{{倒计时显示}}</span>
                      <span style="display: inline-block; margin-right: 15px;">
                          <img @click="dingshiShow" :src="dingshi" alt="Image 1">
                      </span> -->
                      </span>
                      <span style="display: inline-block;">
                          <img @click="centerDialogVisible=true" :src="shezhi" alt="Image 2">
                      </span>
@@ -235,7 +236,7 @@
                              <span class="text-group_3">人工肾</span>
                            </div>
                          </div>
                          <div style="height: 75%; text-align: center;font-weight: 600;font-size: 50px;color: #8079CB;" class="grid-container" >
                          <div style="height: 85%; font-weight: 600;font-size: 50px;color: #8079CB;" class="scrollable-text" >
                            {{deviceData.透析器}}
                          </div>
                        </div>
@@ -287,7 +288,7 @@
                              <span class="text-group_3">时间进度</span>
                            </div>
                          </div>
                          <div style="height: 90%; text-align: center;font-weight: 600;font-size: 50px;color: #333333;" class="grid-container" >
                          <div style="height: 90%; text-align: center;font-weight: 600;font-size: 38px;color: #333333;" class="grid-container" >
                          <div>
                            <span style="color: #303133">{{
                            jgTime4(deviceData.iot_透析时间)
@@ -301,7 +302,7 @@
                          <div>
                            <el-progress
                              :text-inside="true"
                              :stroke-width="25"
                              :stroke-width="15"
                              :show-text="false"
                              color="#70A3DD"
                              :percentage="(Number(deviceData.iot_透析时间)/(Number(deviceData.透析处方的时长)*60))*100"
@@ -318,7 +319,7 @@
                              <span class="text-group_3">超滤进度</span>
                            </div>
                          </div>
                          <div style="height: 90%; text-align: center;font-weight: 600;font-size: 50px;color: #8079CB;" class="grid-container" >
                          <div style="height: 90%; text-align: center;font-weight: 600;font-size: 38px;color: #8079CB;" class="grid-container" >
                            <div>
                              <span style="color: #303133">{{
                                  Number(deviceData.iot_当前脱水量).toFixed(1)
@@ -333,7 +334,7 @@
                            <div>
                              <el-progress
                                :text-inside="true"
                                :stroke-width="25"
                                :stroke-width="15"
                                :show-text="false"
                                color="#70CAAE"
                                :percentage=" Number(deviceData.iot_当前脱水量)/Number(deviceData.处方脱水量)*100"
@@ -601,18 +602,25 @@
                  font-size: 300%;
                  height: 100%
                ">
                <span class="grid-container"
                  style="height: 100%;color: #303133;padding-right: 20px;"
                  >
                  <el-image @click="centerDialogVisible=true" :src="shezhi"></el-image>
                  </span>
                  <div style="position: absolute; top: 0; right: 0; display: flex;  align-items: center; justify-content: flex-end; padding: 5px; height: 100%;">
                    <div class="grid-container" style="display: flex; align-items: center; padding-right: 20px;">
                        <span style="display: inline-block; margin-right: 15px; font-size: 30px; color: #F56C6C;">{{倒计时显示}}</span>
                        <span style="display: inline-block; margin-right: 15px;">
                            <img @click="dingshiShow" :src="dingshi" alt="Image 1">
                        </span>
                        <span style="display: inline-block;">
                            <img @click="centerDialogVisible=true" :src="shezhi" alt="Image 2">
                        </span>
                    </div>
                </div>
              </div>
            </el-row>
        </div>
        <template v-if="!ispaiban">
          <div  class="chongjian" style="height: 50%;">
            <el-row :gutter="20" style="height: 100%; padding: 20px;">
              <el-col :span="7" style="height: 100%;">
            <el-row :gutter="10" style="height: 100%; padding:10px 20px 0px 20px;">
              <el-col :span="7" style="height: 100%;" ref="targetDiv">
                <div  class="container-weiqiandao" style="height: 100%">
                  <div class="item-weiqiandao" style="background: #FFEDD2;border-radius: 8px;height: 100%;">
                    <div class="container-cord" style="height: 30px;">
@@ -633,8 +641,59 @@
                  </div>
                </div>
              </el-col>
              <el-col :span="10">
                <div class="container-weiqiandao" >
              <el-col :span="10" style="height: 100%;">
                <div class="cont_parent">
                  <div class="cont_child" style="background: #E5EEFF;border-radius: 8px;">
                    <div class="container-cord" style="height: 30px;">
                      <img style="width: 25px;" referrerpolicy="no-referrer" :src="tsl"
                      />
                      <span class="text-group_3">透析方案</span>
                    </div>
                    <div class="grid-container" style="height: calc(100% - 30px);width: 100%;">
                      <div class="container-body-text" style="color: #3A75B8;">
                        <template v-for="(item,index) in 当前客户耗材集合.透析模式" :key="index">
                          <span> {{item}}</span><template v-if="当前客户耗材集合.透析模式.length>index+1">,</template>
                        </template>
                      </div>
                    </div>
                  </div>
                  <div class="cont_child" style="background: #D9F0E2;border-radius: 8px;">
                    <div class="container-cord" style="height: 30px;">
                      <img style="width: 25px;" referrerpolicy="no-referrer" :src="tsl"
                      />
                      <span class="text-group_3">一次性血液透析体外循环管路</span>
                    </div>
                    <div class="grid-container" style="height: calc(100% - 30px);width: 100%;">
                        <div class="scrollable-container"   style="height: 100%;color: #3AB859;">
                          <ul>
                            <li v-for="(item,index) in 当前客户耗材集合.管路" :key="index">
                              {{item}}
                            </li>
                          </ul>
                        </div>
                    </div>
                  </div>
                  <div class="cont_child" style="background: #F9DEDE;border-radius: 8px;">
                    <div class="container-cord" style="height: 30px;">
                      <img style="width: 25px;" referrerpolicy="no-referrer" :src="tsl"
                      />
                      <span class="text-group_3">一次性使用透析护理包</span>
                    </div>
                    <div class="grid-container" style="height: calc(100% - 30px);width: 100%;">
                      <div class="scrollable-container"  style="height: 100%;color: #902D2D;">
                          <ul>
                            <li v-for="(item,index) in 当前客户耗材集合.护理包" :key="index">
                              {{item}}
                            </li>
                          </ul>
                        </div>
                    </div>
                  </div>
                </div>
                <!-- <div class="container-weiqiandao" >
                  <div class="item-weiqiandao" style="background: #E5EEFF;border-radius: 8px;height: 100%;">
                    <div class="container-cord" style="height: 30px;">
                      <img style="width: 25px;" referrerpolicy="no-referrer" :src="tsl"
@@ -684,7 +743,7 @@
                        </div>
                    </div>
                  </div>
                </div>
                </div> -->
              </el-col>
              <el-col :span="7" style="height: 100%;">
                <div  class="container-weiqiandao" style="height: 100%">
@@ -710,7 +769,7 @@
            </el-row>
          </div>
          <div  class="mowei" style="height: 39%;">
            <el-row :gutter="20" style="height: 100%;padding:10px 20px 20px 20px;">
            <el-row :gutter="20" style="height: 100%;padding:10px 20px 10px 20px;">
              <el-col :span="12" style="height: 100%">
                <div  class="container-weiqiandao" style="height: 100%">
                  <div class="item-weiqiandao" style="background: #F6F5FA;border-radius: 8px;height: 100%;">
@@ -802,16 +861,24 @@
          <el-button type="primary" @click="saveSet">
            确认
          </el-button>
          <el-button type="success" @click="shuaxin">
            刷新
          </el-button>
        </div>
      </template>
      </el-dialog>
      <el-dialog v-model="centerDialogVisible2" title="定时任务设置" width="600" center>
      <el-dialog v-model="centerDialogVisible2" custom-class="custom-dialog" :show-close="false" width="600" center>
        <template #header="{ titleId, titleClass }">
          <div class="my-header">
            <h4 style="color: white;" :id="titleId" :class="titleClass">定时任务设置</h4>
          </div>
        </template>
        <span>
            <div>
              <el-form  :model="formInline"  label-width="100px">
                <el-form-item label="时间设定:">
                  <el-col :span="10">
                    <el-input-number style="width: 100%;" v-model="formInline.xiaoshi" :min="1" :max="10" />
                    <el-input-number style="width: 100%;" v-model="formInline.xiaoshi" :min="0" :max="10" />
                  </el-col>
                  <el-col :span="2" class="text-center">
                    <span class="text-gray-500">小时 </span>
@@ -857,6 +924,26 @@
          </div>
        </template>
      </el-dialog>
      <el-dialog v-model="centerDialogVisible3" custom-class="custom-dialog" :show-close="false" width="700" center>
        <template #header="{ titleId, titleClass }">
          <div class="my-header">
            <h4 style="color: white;" :id="titleId" :class="titleClass">定时任务提醒</h4>
          </div>
        </template>
        <span>
            <div style="text-align: center;font-size: 30px">
              <h3>{{倒计时告警文本}}</h3>
            </div>
        </span>
        <template #footer>
          <div class="dialog-footer">
            <el-button type="" @click="centerDialogVisible3=false">取消</el-button>
            <el-button type="primary"  @click="centerDialogVisible3=false">
              确定
            </el-button>
          </div>
        </template>
      </el-dialog>
    </div>  
    
    
@@ -876,7 +963,7 @@
  import cljd from '../img/cljd.png'
  import tizhong from '../img/tizhong.png'
  import {EventSourcePolyfill} from 'event-source-polyfill';
  import { computed, getCurrentInstance, onBeforeMount, onMounted, ref, watch, watchEffect } from "vue";
  import { computed, getCurrentInstance, onBeforeMount, onMounted, ref, watch, onUnmounted, onBeforeUnmount  } from "vue";
  import { Local } from '../utils/storage';
  import * as echarts from "echarts";
  import { jgTime4 } from "../utils/formatTime";
@@ -892,6 +979,8 @@
  const sseData = ref({});
   // sse状态
  const readyState = ref({ key: 0, value: "正在链接中" });
  const deviceCode=ref('')
  const shishiTime=ref(new Date())
  //有没有推送过血压如果有 就一直会显示血压数据
@@ -1080,6 +1169,7 @@
  // 识别数据流
  let stream: MediaStream | null = null;
  const centerDialogVisible2=ref(false)
  const centerDialogVisible3=ref(false)
  const centerDialogVisible = ref(false);
  const background = ref("");
  const txztText = ref("");
@@ -1139,6 +1229,13 @@
    }
    setTimeoutAlert({deviceCode:deviceCode.value,minutes:minutes,alertText:alertText}).then(res=>{
      console.log(res.data)
      if(res.data==='OK'){
        倒计时.value=minutes*60
        centerDialogVisible2.value=false
      }else{
        ElMessage.warning(res.message)
      }
    })
    // centerDialogVisible2.value=false
  })
@@ -1280,6 +1377,33 @@
      deep: true,
    }
  );
  const formatSecondsToTime=(totalSeconds)=> {
  // 向下取整
  let hours = Math.floor(totalSeconds / 3600);
  let minutes = Math.floor((totalSeconds % 3600) / 60);
  let seconds = totalSeconds % 60;
  // 补零函数
  const pad = (num) => String(num).padStart(2, '0');
  return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
}
  const 倒计时=ref(0)
  const 倒计时显示=ref('00:00:00')
  const 倒计时告警文本=ref('')
  // 定时器回调函数
  const updateTime = () => {
    if(倒计时.value>0){
      倒计时显示.value = formatSecondsToTime(倒计时.value)
      倒计时.value--
    }else{
      倒计时显示.value = ''
    }
  };
  let intervalId = null;
  onMounted(() => {
    let devcieCode=Local.get('devcieCode')
    if(devcieCode){
@@ -1288,7 +1412,17 @@
    }else{
      centerDialogVisible.value=true
    }
    intervalId = setInterval(updateTime, 1000);
  });
  // 在组件卸载前清除定时器,防止内存泄漏
  onBeforeUnmount(() => {
    if (intervalId) {
      clearInterval(intervalId);
    }
  });
  const saveSet=()=>{
    if(deviceCode.value){
      centerDialogVisible.value=false
@@ -1298,6 +1432,13 @@
    }else{
      ElMessage.warning('请先输入设备编号')
    }
  }
  /**
   * 刷新页面
   */
  const shuaxin=()=>{
    window.location.reload();
  }
  const onFileChange=async(event: Event)=> {
    const inputElement = event.target as HTMLInputElement;
@@ -1351,20 +1492,6 @@
    // http://testbs.ihemodialysis.com/sse/sseEvent
    // const test='http://testbs.ihemodialysis.com/sse/sseEvent/'
    数据初始化.value=true
      // const loading = ElLoading.service({
      //   lock: true,
      //   text: '数据初始化中。。。',
      //   background: 'rgba(0, 0, 0, 0.7)',
      //   svg:`<path class="path" d="
      //     M 30 15
      //     L 28 17
      //     M 25.61 25.61
      //     A 15 15, 0, 0, 1, 15 30
      //     A 15 15, 0, 1, 1, 27.99 7.5
      //     L 15 15
      //   " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      //   `
      // })
      const test='https://backend.ihemodialysis.com/sse/sseEvent/'
      const stateArr = [
      { key: 0, value: "正在链接中" },
@@ -1399,6 +1526,17 @@
                const dataBody=JSON.parse(datax)
                console.log(dataBody) 
                console.log(dataBody) 
                if(dataBody.倒计时?.提醒文本){
                  倒计时.value=dataBody.倒计时?.设定提醒倒计时
                  console.log('设置了倒计时值',倒计时.value)
                  if(倒计时.value<=0&&倒计时.value>=-60){
                    centerDialogVisible3.value=true
                    倒计时告警文本.value=dataBody.倒计时?.提醒文本
                    关闭弹框警告()
                  }else if(倒计时.value<=-60){
                    centerDialogVisible3.value=false
                  }
                }
                if(dataBody.推送类型==='床旁血压计'){
                  isinitXy.value=true
                  let date = new Date();
@@ -1456,6 +1594,13 @@
    setTimeout(()=>{
      initTupiao()
    },500)
  }
  const 关闭弹框警告=()=>{
    setTimeout(function() {
        console.log("30秒已过,关闭报警设置弹框。");
        centerDialogVisible3.value=false
    }, 30000); // 30000 毫秒 = 30 秒
  }
  //初始化
  const sourceInit = () => {
@@ -2061,6 +2206,7 @@
  flex: 1; /* 确保每个子 div 占据相同的高度 */
  background-color: lightblue; /* 可以根据需要调整背景颜色 */
  padding: 10px; /* 添加内边距以美化显示 */
}
.container-body{
    display: flex;
@@ -2113,9 +2259,49 @@
}
.scrollable-container li {
  padding: 4px;
  // padding: 4px;
  font-weight: 600;
  // border-bottom: 1px solid #ddd;
}
  </style>
.cont_parent {
  height: 100%;
  display: grid;
  grid-template-rows: repeat(3, 1fr); /* 将容器划分为3行,每行占1份 */
  gap: 5px; /* 子元素之间的间隙(可选) */
}
.cont_child {
  border: 1px solid #ccc;
  padding: 10px;
  overflow-y: auto; /* 当内容超出时显示垂直滚动条 */
  box-sizing: border-box; /* 确保 padding 和 border 不增加实际高度 */
}
.scrollable-text{
    white-space: nowrap;
    overflow-x: auto;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    // border: 1px solid #e4e4e4;
    // font-size: 16px;
}
.custom-dialog {
  border-radius: 10px;
}
.my-header {
  background-color: #ff6b6b; /* 标题背景颜色 */
  color: white; /* 标题文字颜色 */
  font-size: 18px; /* 标题字体大小 */
  padding-top: 1px; /* 内边距 */
  padding-bottom: 1px; /* 内边距 */
  text-align: center; /* 文字居中 */
  border-top-left-radius: 10px; /* 左上角圆角 */
  border-top-right-radius: 10px; /* 右上角圆角 */
}
.el-dialog {
  padding: 0;
  padding-bottom:10px ;
}
  </style>