Browse Source

mod:重新监测功能

panqiuyao 8 tháng trước cách đây
mục cha
commit
873033acc4

+ 14 - 1
frontend/src/components/check/index.vue

@@ -54,7 +54,7 @@
             <div class="check-btn cu-p" @click="reCheck">重新监测</div>
             <div class="check-btn cu-p" @click="reCheck">重新监测</div>
         </div>
         </div>
         <div class="flex" v-else>
         <div class="flex" v-else>
-            <div class="check-btn cu-p" style="width: 180px" @click="confirm()">正常,开始下一步</div>
+            <div class="check-btn cu-p" style="width: 180px" @click="confirm()"> {{ checkInfoStore.isFirstCheck ? '正常,开始下一步' : '检测成功,继续操作'}}</div>
         </div>
         </div>
     </template>
     </template>
   </el-dialog>
   </el-dialog>
@@ -148,6 +148,18 @@ watchEffect(async ()=>{
   }
   }
 })
 })
 
 
+
+
+watchEffect(async ()=>{
+  if( checkCount.value >= 1 && checkInfoStore.getProgress !== 100 && !checkInfoStore.isFirstCheck.value){
+    visible.value = true
+    checkLoading.value = false;
+    checkSuccess.value = false;
+  }
+})
+
+
+
 watchEffect(async ()=>{
 watchEffect(async ()=>{
   if(checkInfoStore.getProgress === 100 ){
   if(checkInfoStore.getProgress === 100 ){
     checkLoading.value = false;
     checkLoading.value = false;
@@ -175,6 +187,7 @@ watchEffect(async ()=>{
 
 
 function confirm(){
 function confirm(){
   visible.value = false;
   visible.value = false;
+  checkInfoStore.set_isFirstCheck(false);
   emit('confirm')
   emit('confirm')
 }
 }
 
 

+ 25 - 0
frontend/src/composables/userCheck.ts

@@ -0,0 +1,25 @@
+import { watchEffect } from 'vue';
+import { ElMessageBox  } from 'element-plus';
+import checkInfo from "../stores/modules/check";
+import {fa} from "element-plus/es/locale";
+
+const checkInfoStore = checkInfo()
+export function useCheckInfo() {
+
+    watchEffect(async ()=>{
+        if( checkInfoStore.getProgress !== 100 && !checkInfoStore.isFirstCheck.value){
+            ElMessageBox({
+                title:"链接出错!",
+                message:'设备连接出错,请在主窗口中重新连接设备后,在重新打开此窗口后进行操作',
+                showCancelButton:false,
+                showConfirmButton:false,
+                closeOnClickModal:false,
+                closeOnPressEscape:false,
+                closeOnHashChange:false,
+                showClose:false
+            })
+            return
+        }
+    })
+
+}

+ 1 - 1
frontend/src/router/index.ts

@@ -5,7 +5,7 @@ import { authGuard } from './plugins/authGuard'
 const routes: RouteRecordRaw[] = [
 const routes: RouteRecordRaw[] = [
     {
     {
         path: "/",
         path: "/",
-        redirect: "/photography/check"
+        redirect: "/home"
     },
     },
     {
     {
         path: "/home",
         path: "/home",

+ 14 - 2
frontend/src/stores/modules/check.ts

@@ -36,7 +36,15 @@ export const checkInfo = defineStore('checkInfo', () => {
     const blue_tooth_scan_NO = ref('')
     const blue_tooth_scan_NO = ref('')
     const checkTime = ref(0)
     const checkTime = ref(0)
     let CKTimerInterval:any = null
     let CKTimerInterval:any = null
-
+    let CKCamControlInterval:any = null
+    const isFirstCheck = ref(true)
+    const set_isFirstCheck = ()=>{
+        isFirstCheck.value = false
+        //开始监听相机软件连接状态
+        CKCamControlInterval =   setInterval(()=>{
+            checkcamControl()
+        },3000)
+    }
     //mcu 初始化
     //mcu 初始化
     const mcu = reactive({
     const mcu = reactive({
         isInitSend:false,
         isInitSend:false,
@@ -49,7 +57,8 @@ export const checkInfo = defineStore('checkInfo', () => {
         for (const device of Object.values(devices)) {
         for (const device of Object.values(devices)) {
             if (device.status === 2) completed++;
             if (device.status === 2) completed++;
         }
         }
-        return parseFloat((completed / total * 100).toFixed(2));
+        let value = parseFloat((completed / total * 100).toFixed(2));
+        return value
     });
     });
 
 
     // 获取错误信息
     // 获取错误信息
@@ -164,6 +173,7 @@ export const checkInfo = defineStore('checkInfo', () => {
         for (const deviceName of Object.keys(devices)) {
         for (const deviceName of Object.keys(devices)) {
             switch (deviceName){
             switch (deviceName){
                 case 'cam_control':
                 case 'cam_control':
+                    if(CKCamControlInterval) clearInterval(CKCamControlInterval)
                     await checkcamControl();
                     await checkcamControl();
                     break;
                     break;
                 case 'camera':
                 case 'camera':
@@ -215,6 +225,8 @@ export const checkInfo = defineStore('checkInfo', () => {
         blueTooth: devices.blueTooth,
         blueTooth: devices.blueTooth,
         camControl: devices.camControl,
         camControl: devices.camControl,
         camera: devices.camera,
         camera: devices.camera,
+        isFirstCheck,
+        set_isFirstCheck,
         blue_tooth_scan_NO,
         blue_tooth_scan_NO,
         set_blue_tooth_scan_NO,
         set_blue_tooth_scan_NO,
         checkAction,
         checkAction,

+ 11 - 3
frontend/src/views/Photography/detail.vue

@@ -9,6 +9,10 @@
       click: openPhotographySeniorDetail
       click: openPhotographySeniorDetail
     }
     }
   ]" />
   ]" />
+
+
+  <hardware-check/>
+
   <div class="detail-container">
   <div class="detail-container">
     <div>
     <div>
       <!-- 主图LOGO部分 -->
       <!-- 主图LOGO部分 -->
@@ -210,6 +214,10 @@ import { getRouterUrl } from '@/utils/appfun'
 
 
 import { Close, Warning } from '@element-plus/icons-vue'
 import { Close, Warning } from '@element-plus/icons-vue'
 import LoadingDialog from '@/views/Photography/components/LoadingDialog.vue'
 import LoadingDialog from '@/views/Photography/components/LoadingDialog.vue'
+import HardwareCheck from '@/components/check/index.vue'
+
+import { useCheckInfo } from '@/composables/useCheckInfo';
+useCheckInfo();
 
 
 const showTips = ref(true)
 const showTips = ref(true)
 
 
@@ -252,7 +260,7 @@ const queryParams = reactive({ // 分页查询参数
   current: 1,
   current: 1,
 })
 })
 const form = reactive({
 const form = reactive({
-  selectTemplate: {}, //选中的模板 
+  selectTemplate: {}, //选中的模板
   dataType: '1', // 1: 选择excel文件 2: 系统对接
   dataType: '1', // 1: 选择excel文件 2: 系统对接
   logo_path: '', // 主图LOGO
   logo_path: '', // 主图LOGO
   excelFilePath: 'D:\\MyDocuments\\PythonCode\\MyPython\\red_dragonfly\\deal_pics\\auto_capture_V2\\auto_photo', // 商品基础资料EXCEL文件选择
   excelFilePath: 'D:\\MyDocuments\\PythonCode\\MyPython\\red_dragonfly\\deal_pics\\auto_capture_V2\\auto_photo', // 商品基础资料EXCEL文件选择
@@ -386,10 +394,10 @@ const generate = async function () {
       message.value = loadingMsg
       message.value = loadingMsg
     }
     }
   });
   });
-} 
+}
 const openLoadingDialog = (timer: number) => {
 const openLoadingDialog = (timer: number) => {
   loadingDialogVisible.value = true
   loadingDialogVisible.value = true
- 
+
   showButton.value = true
   showButton.value = true
   // 根据传入的秒数计算每次增加的进度值
   // 根据传入的秒数计算每次增加的进度值
   const step = 100 / timer
   const step = 100 / timer

+ 3 - 0
frontend/src/views/Setting/index.vue

@@ -340,6 +340,8 @@ import icpList from '@/utils/ipc';
 const clientStore = client();
 const clientStore = client();
 import { ElMessage, ElMessageBox } from 'element-plus';
 import { ElMessage, ElMessageBox } from 'element-plus';
 
 
+import { useCheckInfo } from '@/composables/useCheckInfo';
+useCheckInfo();
 // 路由和状态管理初始化
 // 路由和状态管理初始化
 const route = useRoute();
 const route = useRoute();
 const router = useRouter();
 const router = useRouter();
@@ -807,6 +809,7 @@ async function changeNum(type, min, max) {
     });
     });
   }
   }
 }
 }
+
 </script>
 </script>