Selaa lähdekoodia

refactor(photography): 重构检查页面的菜单结构和功能实现

- 移除未使用的 reactive 变量声明
- 调整 useUserInfoStore 初始化位置
- 将静态 menu 数组重构为动态计算属性
- 添加输出目录打开功能和快捷操作菜单
- 实现带层级结构的下拉菜单支持
- 优化菜单项按权限和调试状态显示逻辑
- 添加生成图目录、一键释放等快捷操作功能
panqiuyao 6 päivää sitten
vanhempi
commit
56684ba7b6
1 muutettua tiedostoa jossa 75 lisäystä ja 22 poistoa
  1. 75 22
      frontend/src/views/Photography/check.vue

+ 75 - 22
frontend/src/views/Photography/check.vue

@@ -85,7 +85,7 @@
   />
 </template>
 <script setup lang="ts">
-import {watchEffect, ref, reactive, defineEmits, defineProps, computed, onBeforeUnmount, onMounted} from 'vue'
+import {watchEffect, ref, defineEmits, defineProps, computed, onBeforeUnmount, onMounted} from 'vue'
 import client from "@/stores/modules/client";
 import socket from "@/stores/modules/socket";
 import icpList from '@/utils/ipc'
@@ -100,6 +100,7 @@ const emit = defineEmits([ 'confirm','onClose']);
 
 import  configInfo  from '@/stores/modules/config';
 const configInfoStore = configInfo();
+const useUserInfoStore = useUserInfo();
 
 const confirm = async () => {
   console.log('confirm');
@@ -128,19 +129,19 @@ const props = defineProps({
     }
   }
 })
-const menu = reactive([])
+
 const show = ref(true)
 
+const previewKey = ref(0)
+
 const isSetting = computed(()=>{
   return props.id || props.addRowData.mode_type
 })
 
-const useUserInfoStore = useUserInfo()
 import HardwareCheck from '@/components/check/index.vue'
 import { digiCamControlWEB } from  '@/utils/appconfig'
 import { getFilePath } from '@/utils/appfun'
 import {ElMessage} from "element-plus";
-const previewKey = ref(0)
 
 const preview = ref(digiCamControlWEB+'liveview.jpg')
 
@@ -153,30 +154,82 @@ const previewSrc = computed(()=>{
 const step = ref(1)
 async function checkConfirm(init){
   step.value =1
-  if(menu.length === 0){
-    menu.push({
-      type:'developer'
-    })
-/*    menu.push({
-      type:'toggleModel'
-    })*/
-
-    menu.push({
-      type:'setting'
-    })
-
-    menu.push({
-      type:'OneClickRelease'
-    })
-
-
-  }
   if(!init) previewKey.value++;
 
   showrEditRow.value = true
   loading.value = false;
 }
 
+// 打开输出目录:appConfig.appPath + '/build/extraResources/py/output'
+const openOutputDir = () => {
+  try {
+    const appPath = configInfoStore?.appConfig?.appPath || ''
+    if (!appPath) {
+      ElMessage.error('未获取到应用目录 appPath')
+      return
+    }
+    const fullPath = `${appPath}\\output`
+    clientStore.ipc.removeAllListeners(icpList.utils.shellFun);
+    clientStore.ipc.send(icpList.utils.shellFun, {
+      action: 'openMkPath',
+      params: fullPath.replace(/\//g, '\\')
+    });
+  } catch (e) {
+    console.error(e)
+    ElMessage.error('打开目录失败')
+  }
+}
+
+// 快捷操作菜单子项
+const quickActionsChildren = [
+  {
+    name: '生成图目录',
+    click() {
+      openOutputDir()
+    }
+  },
+  {
+    type: 'OneClickRelease'
+  },
+  {
+    type: 'OneKeyDown'
+  }
+]
+
+// 重构 menu 为带快捷操作和开发工具的下拉菜单结构
+const menu = computed(() => {
+  // 一级导航:设置 + 快捷操作下拉(含一键释放/一键回落/生成图目录)
+  if (useUserInfoStore.userInfo.brand_company_code === '1300' || configInfoStore.appConfig.debug) {
+    return [
+      {
+        type: 'setting'
+      },
+      {
+        name: '快捷操作',
+        children: quickActionsChildren
+      },
+      {
+        name: '开发工具',
+        children: [
+          {
+            type: 'developer'
+          }
+        ]
+      }
+    ]
+  }
+
+  return [
+    {
+      type: 'setting'
+    },
+    {
+      name: '快捷操作',
+      children: quickActionsChildren
+    }
+  ]
+})
+
 // editRow 数据加载完成后调用,仅记录点位,首次不打开预览
 function onEditRowReady(point_name) {
   console.log('onEditRowReady,记录点位:' + point_name)