From 0c4bdf3dca76f9b8c348f2f7e48f9a6319dee4e1 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 17 四月 2026 17:09:22 +0800
Subject: [PATCH] 进销存升级 1.销售台账不能删除和编辑别人维护的数据 2.产品维护固定产品大类为:成品、半成品、原材料。

---
 src/store/modules/permission.js |   44 +++++++++++++++++++-------------------------
 1 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
index c1c862b..911a0f4 100644
--- a/src/store/modules/permission.js
+++ b/src/store/modules/permission.js
@@ -1,5 +1,5 @@
 import auth from '@/plugins/auth'
-import router, { constantRoutes, dynamicRoutes } from '@/router'
+import router, { constantRoutes, dynamicRoutes, financialRoutes } from '@/router'
 import { getRouters } from '@/api/menu'
 import Layout from '@/layout/index'
 import ParentView from '@/components/ParentView'
@@ -45,9 +45,14 @@
             const asyncRoutes = filterDynamicRoutes(dynamicRoutes)
             asyncRoutes.forEach(route => { router.addRoute(route) })
             this.setRoutes(rewriteRoutes)
-            this.setSidebarRouters(constantRoutes.concat(sidebarRoutes))
-            this.setDefaultRoutes(sidebarRoutes)
-            this.setTopbarRoutes(defaultRoutes)
+            // 灏嗚储鍔$鐞嗚矾鐢卞悎骞跺埌渚ц竟鏍�
+            this.setSidebarRouters(constantRoutes.concat(sidebarRoutes).concat(financialRoutes))
+            this.setDefaultRoutes(sidebarRoutes.concat(financialRoutes))
+            this.setTopbarRoutes(defaultRoutes.concat(financialRoutes))
+            // 娣诲姞璐㈠姟绠$悊妯″潡璺敱
+            financialRoutes.forEach(route => {
+              router.addRoute(route)
+            })
             resolve(rewriteRoutes)
           })
         })
@@ -85,24 +90,13 @@
 
 function filterChildren(childrenMap, lastRouter = false) {
   var children = []
-  childrenMap.forEach((el, index) => {
-    if (el.children && el.children.length) {
-      if (el.component === 'ParentView' && !lastRouter) {
-        el.children.forEach(c => {
-          c.path = el.path + '/' + c.path
-          if (c.children && c.children.length) {
-            children = children.concat(filterChildren(c.children, c))
-            return
-          }
-          children.push(c)
-        })
-        return
-      }
+  childrenMap.forEach(el => {
+    el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path
+    if (el.children && el.children.length && el.component === 'ParentView') {
+      children = children.concat(filterChildren(el.children, el))
+    } else {
+      children.push(el)
     }
-    if (lastRouter) {
-      el.path = lastRouter.path + '/' + el.path
-    }
-    children = children.concat(el)
   })
   return children
 }
@@ -125,14 +119,14 @@
 }
 
 export const loadView = (view) => {
-  let res;
+  let res
   for (const path in modules) {
-    const dir = path.split('views/')[1].split('.vue')[0];
+    const dir = path.split('views/')[1].split('.vue')[0]
     if (dir === view) {
-      res = () => modules[path]();
+      res = () => modules[path]()
     }
   }
-  return res;
+  return res
 }
 
 export default usePermissionStore

--
Gitblit v1.9.3