Jelajahi Sumber

路由和代码层级优化

liucong 4 tahun lalu
induk
melakukan
84a9f529c8

+ 34 - 0
src/layout/main.vue

@@ -0,0 +1,34 @@
+<template>
+    <!-- 采购 -->
+    <div class="exposure">
+        <firstMenu :list="list" :value="'title'" @selectMenu="selectMenu" />
+        <router-view />
+    </div>
+</template>
+
+<script lang="ts">
+    import { defineComponent } from 'vue';
+    import firstMenu from '@/common/components/firstMenu/index.vue';
+    import { handleRouterMenu } from '@/common/setup/router/index';
+    import { initData } from '@/common/methods';
+
+    export default defineComponent({
+        name: 'exposure',
+        components: {
+            firstMenu,
+        },
+        setup() {
+            const { list, selectMenu, getMenuList } = handleRouterMenu();
+            initData(() => {
+                getMenuList();
+                console.log('list', list);
+            });
+            return { list, selectMenu };
+        },
+    });
+</script>
+
+<style lang="less">
+    .sexposure {
+    }</style
+>;

+ 3 - 0
src/layout/top.vue

@@ -60,6 +60,7 @@
             </a-layout-sider>
             <a-layout-content :style="{ background: '#0E0E0F', flex: 1 }">
                 <Drawer :title="'挂牌'" :visible="visible"></Drawer>
+                <!-- <Main /> -->
                 <router-view />
             </a-layout-content>
         </a-layout>
@@ -76,6 +77,7 @@
     import { useRouter } from 'vue-router';
     import { openModal } from '@/common/setup/modal/index';
     import Drawer from '@/common/components/drawer/index.vue';
+    import Main from './main.vue';
 
     // 菜单栏
     const handleMenu = () => {
@@ -229,6 +231,7 @@
             CapitalInfo,
             SecondMenu,
             Drawer,
+            Main,
         },
         setup(props, context) {
             const { collapsed, selectedKeys, openKeys, menuList, collapse, menuClick, setShowBottomPart, fontIcon } = handleMenu();

+ 21 - 20
src/router/index.ts

@@ -1,5 +1,6 @@
 import * as EnumType from '@/common/constants/routerName';
 import Layout from '@/layout/index.vue';
+import Main from '@/layout/main.vue';
 import { isLogin } from '@/services/bus/login';
 import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
 import eventBus from '../utils/eventBus';
@@ -44,7 +45,7 @@ const routes: Array<RouteRecordRaw> = [
             {
                 path: 'custom_info',
                 name: 'custom_info',
-                component: () => import('@/views/information/custom/index.vue'),
+                component: Main,
                 meta: {
                     requireAuth: true,
                 },
@@ -73,7 +74,7 @@ const routes: Array<RouteRecordRaw> = [
             {
                 path: 'goods_info',
                 name: 'goods_info',
-                component: () => import('@/views/information/goods/index.vue'),
+                component: Main,
                 meta: {
                     requireAuth: true,
                 },
@@ -100,25 +101,9 @@ const routes: Array<RouteRecordRaw> = [
                 ],
             },
             {
-                path: '/outaccount_status',
-                name: 'outaccount_status',
-                component: () => import('@/views/search/outaccount_status/index.vue'),
-                meta: {
-                    requireAuth: true,
-                },
-            },
-            {
-                path: '/inventory',
-                name: 'inventory',
-                component: () => import('@/views/search/inventory/index.vue'),
-                meta: {
-                    requireAuth: true,
-                },
-            },
-            {
                 path: '/spot_contract',
                 name: 'spot_contract',
-                component: () => import('@/views/information/spot-contract/index.vue'),
+                component: Main,
                 meta: {
                     requireAuth: true,
                 },
@@ -163,7 +148,7 @@ const routes: Array<RouteRecordRaw> = [
             {
                 path: '/warehouse_info',
                 name: 'warehouse_info',
-                component: () => import('@/views/information/warehouse-info/index.vue'),
+                component: Main,
                 meta: {
                     requireAuth: true,
                 },
@@ -189,6 +174,22 @@ const routes: Array<RouteRecordRaw> = [
                     },
                 ],
             },
+            {
+                path: '/outaccount_status',
+                name: 'outaccount_status',
+                component: () => import('@/views/search/outaccount_status/index.vue'),
+                meta: {
+                    requireAuth: true,
+                },
+            },
+            {
+                path: '/inventory',
+                name: 'inventory',
+                component: () => import('@/views/search/inventory/index.vue'),
+                meta: {
+                    requireAuth: true,
+                },
+            },
 
             {
                 path: '/purchase',

+ 26 - 15
src/views/business/exposure/index.vue

@@ -1,23 +1,34 @@
 <template>
-  <!-- 敞口 -->
-  <div class="exposure">
-    敞口
-  </div>
+    <!-- 采购 -->
+    <div class="exposure">
+        <firstMenu :list="list" :value="'title'" @selectMenu="selectMenu" />
+        <router-view />
+    </div>
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
+    import { defineComponent } from 'vue';
+    import firstMenu from '@/common/components/firstMenu/index.vue';
+    import { handleRouterMenu } from '@/common/setup/router/index';
+    import { initData } from '@/common/methods';
 
-export default defineComponent({
-    name: 'exposure',
-    components: {},
-    setup() {
-        return {};
-    },
-});
+    export default defineComponent({
+        name: 'exposure',
+        components: {
+            firstMenu,
+        },
+        setup() {
+            const { list, selectMenu, getMenuList } = handleRouterMenu();
+            initData(() => {
+                getMenuList();
+                console.log('list', list);
+            });
+            return { list, selectMenu };
+        },
+    });
 </script>
 
 <style lang="less">
-.exposure {
-}
-</style>;
+    .sexposure {
+    }</style
+>;

+ 16 - 5
src/views/business/plan/index.vue

@@ -1,23 +1,34 @@
 <template>
-    <!-- 计划 -->
+    <!-- 采购 -->
     <div class="plan">
-        计划
+        <firstMenu :list="list" :value="'title'" @selectMenu="selectMenu" />
+        <router-view />
     </div>
 </template>
 
 <script lang="ts">
     import { defineComponent } from 'vue';
+    import firstMenu from '@/common/components/firstMenu/index.vue';
+    import { handleRouterMenu } from '@/common/setup/router/index';
+    import { initData } from '@/common/methods';
 
     export default defineComponent({
         name: 'plan',
-        components: {},
+        components: {
+            firstMenu,
+        },
         setup() {
-            return {};
+            const { list, selectMenu, getMenuList } = handleRouterMenu();
+            initData(() => {
+                getMenuList();
+                console.log('list', list);
+            });
+            return { list, selectMenu };
         },
     });
 </script>
 
 <style lang="less">
-    .plan {
+    .splan {
     }</style
 >;