From e3edb24ee6b15cb7e67abf6c0ebfe731fbcb4a4c Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期六, 22 四月 2023 09:50:49 +0800
Subject: [PATCH] 1.采购收货单新增查看详情功能

---
 src/store/modules/permission.js |   40 +++++++++++++++++++++++++++++-----------
 1 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index 2b74277..291aa11 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -13,28 +13,37 @@
 /**
  * 鎶婂悗鍙拌繑鍥炶彍鍗曠粍瑁呮垚routes瑕佹眰鐨勬牸寮�
  * @param {*} routes
+ * @param {*} menu
  */
-export function getAsyncRoutes(routes2, menu) {
+export function getAsyncRoutes(routes, menu) {
+  // menu  涓璮lag  "0" 琛ㄧず true  "1"琛ㄧずfalse
   const menuCode = []// 灏嗗悗绔痗ode鍙栧嚭瀛樻垚鏁扮粍褰㈠紡
+  const menuNameAndCode = []// 灏嗗悗绔痗ode涓巒ame鍙栧嚭瀛樻垚鏁扮粍褰㈠紡
   menu.forEach(item => {
-    menuCode.push(item.code)
-    if (item.children && item.children.length > 0) {
-      item.children.forEach(it => {
-        menuCode.push(it.code)
-      })
+    if (item.flag === '0') {
+      menuCode.push(item.code)
+      menuNameAndCode.push({ code: item.code, name: item.name })
+      if (item.children && item.children.length > 0) {
+        item.children.forEach(it => {
+          if (it.flag === '0') {
+            menuCode.push(it.code)
+            menuNameAndCode.push({ code: it.code, name: it.name })
+          }
+        })
+      }
     }
   })
 
-  const routes = routes2
-  const newRoutes = []
+  const newRoutes = [] // 鏂拌矾鐢�
 
   routes.forEach(item => {
     if (menuCode.includes(item.code) && item.children && item.children.length > 0) {
-      console.log(item)
+      item.meta.title = menuNameAndCode.find(item2 => item2.code === item.code).name
       const children = []
       let flag = false// 鍒ゆ柇鏄惁鏈塩hildren瀛樿繘鍘�
       item.children.forEach(it => {
         if (menuCode.includes(it.code)) {
+          it.meta.title = menuNameAndCode.find(item2 => item2.code === it.code).name
           children.push(it)
           flag = true
         }
@@ -89,8 +98,17 @@
 const actions = {
   generateRoutes({ commit }, menu) {
     return new Promise(resolve => {
-      const newRoutes = getAsyncRoutes(asyncRoutes, menu)
-      console.log(newRoutes, 2)
+      // console.log(menu, 'menu')
+      // const newRoutes = getAsyncRoutes(asyncRoutes, menu)
+      // const arr = ['1001', '1002', '1004']
+      // const newRoutes = asyncRoutes.filter(i => {
+      //   if (arr.includes(i.code)) {
+      //     return i
+      //   }
+      // })
+
+      const newRoutes = asyncRoutes
+
       commit('SET_ROUTES', newRoutes)
       resolve(newRoutes)
     })

--
Gitblit v1.9.3