ソースを参照

驾驶舱组件管理页面新加预览功能,并新加预览页面路由

wyn 2 ヶ月 前
コミット
33f1f3cae5

+ 75 - 0
src/router/modules/remaining.ts

@@ -154,6 +154,81 @@ const remainingRouter: AppRouteRecordRaw[] = [
       // },
     ]
   },
+  {
+    path: '/uiCom',
+    component: Layout,
+    name: 'uiCom',
+    meta: {
+      hidden: true,
+    },
+    children: [
+      {
+        path: 'welcomeBar',
+        component: () => import('@/views/UiCom/welcomeBar.vue'),
+        name: 'welcomeBar',
+        meta: {
+          title: '欢迎问候组件',
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:view',
+          activeMenu: '/uiCom/welcomeBar'
+        }
+      },
+      {
+        path: 'myTodo',
+        component: () => import('@/views/UiCom/myTodo.vue'),
+        name: 'myTodo',
+        meta: {
+          title: '我的待办',
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:view',
+          activeMenu: '/uiCom/myTodo'
+        }
+      },
+      {
+        path: 'unreadMessage',
+        component: () => import('@/views/UiCom/unreadMessage.vue'),
+        name: 'unreadMessage',
+        meta: {
+          title: '未读消息',
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:view',
+          activeMenu: '/uiCom/unreadMessage'
+        }
+      },
+      {
+        path: 'doingJob',
+        component: () => import('@/views/UiCom/doingJob.vue'),
+        name: 'doingJob',
+        meta: {
+          title: '进行中的作业',
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:view',
+          activeMenu: '/uiCom/doingJob'
+        }
+      },
+      {
+        path: 'chartView',
+        component: () => import('@/views/UiCom/chartView.vue'),
+        name: 'chartView',
+        meta: {
+          title: '领取归还图表',
+          noCache: false,
+          hidden: true,
+          canTo: true,
+          icon: 'ep:view',
+          activeMenu: '/uiCom/chartView'
+        }
+      },
+    ]
+  },
   {
     path: '/CustomWorkflow',
     component: Layout,

+ 2 - 4
src/views/Home/Index.vue

@@ -16,7 +16,6 @@
         <component :is="loadComponent(item.componentFilePath)" />
       </el-card>
     </div>
-<!--<ChartView/>-->
 
   </div>
 </template>
@@ -24,7 +23,6 @@
 <script lang="ts" setup>
 import { ref, onMounted, defineAsyncComponent, computed } from "vue"
 import { getInfo } from "@/api/login"
-// import ChartView from "./chartView.vue";
 
 interface ComponentItem {
   id: number
@@ -41,11 +39,11 @@ defineOptions({ name: "Index" })
 const componentDetail = ref<ComponentItem[]>([])
 
 // 获取 views/Home 下的所有 vue 文件
-const modules = import.meta.glob("/src/views/Home/**/*.vue")
+const modules = import.meta.glob("/src/views/UiCom/**/*.vue")
 
 // 动态加载组件
 const loadComponent = (path: string) => {
-  const filePath = `/src/views/Home${path}.vue`
+  const filePath = `/src/views/UiCom${path}.vue`
   if (modules[filePath]) {
     return defineAsyncComponent(modules[filePath] as any)
   }

+ 20 - 1
src/views/system/cockpitComponent/index.vue

@@ -97,6 +97,14 @@
           >
             编辑
           </el-button>
+          <el-button
+            link
+            type="primary"
+            @click="goView(scope.row.id)"
+            v-hasPermi="['iscs:map:update']"
+          >
+            预览
+          </el-button>
           <el-button
             link
             type="danger"
@@ -125,7 +133,9 @@
 import * as cockpitApi from '@/api/system/cockpitComponent/index'
 import ComponentForm from './componentForm.vue'
 import {DICT_TYPE} from "@/utils/dict";
+import { useRouter } from "vue-router"
 
+const router = useRouter()
 const message = useMessage() // 消息弹窗
 const { t } = useI18n() // 国际化
 const loading = ref(true) // 列表的加载中
@@ -158,7 +168,6 @@ const data=await cockpitApi.getUiComponentPage(queryParams)
 }
 }
 
-
 // 搜索按钮
 const handleQuery=()=>{
   queryParams.pageNo=1;
@@ -177,6 +186,16 @@ const handleSelectionChange=(selection:any[])=>{
   multiple.value=!selection.length
 }
 
+// 预览
+const goView=async(id:number)=>{
+  console.log(id)
+  const pathData = await cockpitApi.selectUiComponentById(id)
+  console.log(pathData,'路径')
+  if (pathData && pathData.componentFilePath) {
+    const fullPath = `/uiCom${pathData.componentFilePath}`
+    router.push(fullPath)
+  }
+}
 
 // 新增/修改
 const openForm = (type: string, id?: number) => {