Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master'

Hwf 7 mesiacov pred
rodič
commit
bb1a7e47ac

+ 1 - 1
src/api/onlineRollCall/index.ts

@@ -105,4 +105,4 @@ export function getCallSummary(params) {
         method: 'get',
         params: params
     });
-}
+}

+ 192 - 0
src/components/OnlineRollCall/index.vue

@@ -0,0 +1,192 @@
+<template>
+    <van-dialog
+      v-model:show="show"
+      class="custom-dialog"
+      title="在线点名提醒"
+      confirmButtonText="确认点名"
+      @confirm="handleToRollCall"
+    >
+      <div class="btn" @click="handleHideDialog">浮窗显示</div>
+      <div class="line">
+        <i class="icon-tip" />
+        <div class="text1">{{ durationTime }}</div>
+      </div>
+    </van-dialog>
+    <van-dialog
+      v-model:show="show2"
+      class="custom-dialog2"
+      title="在线点名提醒"
+      :showConfirmButton="false"
+    >
+      <div class="dialog-content">
+        <div class="img-box" />
+        <div v-show="!img" class="text1">即将通过摄像头捕捉画面</div>
+        <div v-show="!img" class="text2">请稍等</div>
+        <div v-show="img" class="btn" @click="handleToRollCall2">
+          上传视频截图
+        </div>
+        <div v-show="img" class="text3">已完成</div>
+      </div>
+    </van-dialog>
+    <div v-if="!!rollCallData.id" class="float-box" @click="show = true" />
+</template>
+
+<script lang="ts" setup name="OnlineRollCall">
+import { ref, onUnmounted, nextTick } from "vue";
+import { useRouter } from "vue-router";
+import { hasMyCall } from "@/api/onlineRollCall";
+
+const router = useRouter();
+
+// 在线点名弹窗
+let timer;
+let show = ref(false);
+let durationTime = ref("");
+let rollCallData = ref({
+  id: 0,
+  time1: ""
+});
+// 在线点名
+let show2 = ref();
+let img = ref("");
+const handleToRollCall = () => {
+  show.value = false;
+  show2.value = true;
+  setTimeout(() => {
+    img.value = "2";
+  }, 3000);
+};
+const handleToRollCall2 = () => {
+  router.push({
+    name: "RollCallDetails",
+    query: { id: rollCallData.value.id }
+  });
+};
+const calculateDuration = startTimeStr => {
+  // 将起始时间字符串转换为日期对象
+  const startTime = new Date(startTimeStr);
+
+  // 获取当前时间作为结束时间
+  const endTime = new Date();
+
+  // 确保起始时间在结束时间之前(可选,用于验证输入)
+  if (startTime > endTime) {
+    return "";
+  }
+
+  // 计算时间差(以毫秒为单位)
+  let timeDifference = endTime - startTime;
+
+  // 将毫秒转换为秒、分钟和小时
+  const seconds = Math.floor((timeDifference / 1000) % 60);
+  const minutes = Math.floor((timeDifference / (1000 * 60)) % 60);
+  const hours = Math.floor(timeDifference / (1000 * 60 * 60));
+
+  // 格式化时间为 HH:MM:SS
+  const formattedDuration = `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
+
+  // 返回格式化的持续时间
+  return formattedDuration;
+};
+const updateTime = () => {
+  durationTime.value = calculateDuration(rollCallData.value.time1);
+};
+const handleHideDialog = () => {
+  show.value = false;
+};
+nextTick(() => {
+  const env = import.meta.env.VITE_APP_ENV
+  if (env != 'development') {
+    hasMyCall({}).then((res)=>{
+      if(res.data && res.data.length > 0) {
+        rollCallData.value = res.data[0];
+        show.value = true;
+        if (!timer && !!rollCallData.value.time1) {
+          timer = setInterval(updateTime, 1000);
+        }
+      }
+    })
+  }
+});
+onUnmounted(() => {
+  if (!!timer) {
+    clearInterval(timer);
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+
+.custom-dialog {
+  position: relative;
+  .btn {
+    position: absolute;
+    top: 10px;
+    right: 6px;
+    font-size: 12px;
+    color: #2c81ff;
+  }
+  .line {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    height: 70px;
+    .icon-tip {
+      width: 30px;
+      height: 31px;
+      background: url("@/assets/images/onlineRollCall/tip.png") no-repeat;
+      background-size: 100% 100%;
+    }
+    .text1 {
+      font-size: 24px;
+      color: #2c81ff;
+    }
+  }
+}
+.float-box {
+  position: fixed;
+  right: 10px;
+  bottom: 70px;
+  width: 86px;
+  height: 77px;
+  background: url("@/assets/images/onlineRollCall/float.png") no-repeat;
+  background-size: 100% 100%;
+}
+.custom-dialog2 {
+  .dialog-content {
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    margin-top: 16px;
+  }
+  .img-box {
+    width: 267px;
+    height: 284px;
+    background-color: #ededed;
+    margin-bottom: 16px;
+  }
+  .text1 {
+    font-size: 14px;
+    color: #2c81ff;
+    line-height: 26px;
+  }
+  .text2 {
+    font-size: 12px;
+    color: #ffaf00;
+    line-height: 26px;
+  }
+  .text3 {
+    font-size: 12px;
+    color: #40c75f;
+    line-height: 26px;
+  }
+  .btn {
+    background: #2c81ff;
+    border-radius: 2px;
+    font-size: 12px;
+    color: #ffffff;
+    padding: 3px 14px;
+  }
+}
+</style>

+ 17 - 7
src/views/leader/index.vue

@@ -79,6 +79,7 @@
         </div>
       </div>
     </div>
+    <!--
     <van-dialog
       v-model:show="show"
       class="custom-dialog"
@@ -109,6 +110,8 @@
       </div>
     </van-dialog>
     <div v-if="!!rollCallData.id" class="float-box" @click="show = true" />
+    -->
+    <OnlineRollCall />
   </dic>
 </template>
 
@@ -121,6 +124,7 @@ import searchImg from "@/assets/images/search.png";
 import { useRouter } from "vue-router";
 import closeImg from "@/assets/images/close.png";
 import { getPointInfoComprehensiveSearch } from "@/api/globalMap";
+import OnlineRollCall from "@/components/OnlineRollCall/index.vue";
 
 const router = useRouter();
 const noticeBarState = reactive({
@@ -245,9 +249,10 @@ const handleClickItem = item => {
   finished.value = false;
   searchList.value = [];
 };
+/*
 // 在线点名弹窗
 let timer;
-let show = ref();
+let show = ref(false);
 let durationTime = ref("");
 let rollCallData = ref({
   id: "",
@@ -301,6 +306,8 @@ const updateTime = () => {
 const handleHideDialog = () => {
   show.value = false;
 };
+*/
+
 onMounted(() => {
   initData();
   // rollCallData.value = {
@@ -308,14 +315,14 @@ onMounted(() => {
   //   time1: '2024-10-22 12:00:00'
   // };
   // show.value = true;
-  if (!timer && !!rollCallData.value.time1) {
-    timer = setInterval(updateTime, 1000);
-  }
+  //if (!timer && !!rollCallData.value.time1) {
+  //  timer = setInterval(updateTime, 1000);
+  //}
 });
 onUnmounted(() => {
-  if (!!timer) {
-    clearInterval(timer);
-  }
+  //if (!!timer) {
+  //  clearInterval(timer);
+  //}
 });
 </script>
 
@@ -506,6 +513,8 @@ onUnmounted(() => {
     }
   }
 }
+
+/*
 .custom-dialog {
   position: relative;
   .btn {
@@ -578,4 +587,5 @@ onUnmounted(() => {
     padding: 3px 14px;
   }
 }
+*/
 </style>

+ 12 - 1
src/views/onlineRollCall/rollCallDetails.vue

@@ -16,7 +16,7 @@
       </div>
       <div class="box-item3">
         <i class="icon-download"/>
-        <div class="label">下载</div>
+        <div class="label" @click="handleExport">下载</div>
       </div>
     </div>
     <div v-else class="box">
@@ -106,6 +106,7 @@ import {onMounted, onUnmounted, ref} from "vue";
 import {parseTime} from "../../utils/ruoyi";
 import {showConfirmDialog, showToast, showSuccessToast} from "vant";
 import {getCallDetail, endCall} from "@/api/onlineRollCall";
+import {download2} from "@/utils/request";
 
 const route = useRoute();
 let id = ref();
@@ -199,6 +200,16 @@ const handleEnd = () => {
   });
 };
 
+const handleExport = async() => {
+  showConfirmDialog({
+    title: '提示',
+    message: '是否下载点名明细 ?',
+  }).then(() => {
+    const baseUrl = import.meta.env.VITE_BASE_API;
+    download2(baseUrl+"/api/online_roll_call/call/export?call_id="+id.value, "点名明细.xlsx");
+  });
+}
+
 const handleVideo = (url) => {
   showToast("对接融合通信后发起视频 video:"+url);
 }

+ 2 - 0
src/views/worker/index.vue

@@ -104,6 +104,7 @@
       </div>
     </div>
   </dic>
+  <OnlineRollCall />
 </template>
 
 <script lang="ts" setup>
@@ -114,6 +115,7 @@ import searchImg from "@/assets/images/search.png";
 import { useRouter } from "vue-router";
 import closeImg from "@/assets/images/close.png";
 import { getPointInfoComprehensiveSearch } from "@/api/globalMap";
+import OnlineRollCall from "@/components/OnlineRollCall/index.vue";
 
 const router = useRouter();
 const noticeBarState = reactive({