From 0f9b3d3417d1b9f9d1db6e818cd02b4de2867987 Mon Sep 17 00:00:00 2001
From: zhangxiaoxu <819527061@qq.com>
Date: 星期二, 25 十一月 2025 15:59:03 +0800
Subject: [PATCH] 批量通过和批量驳回bug修改

---
 store/index.js |   51 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/store/index.js b/store/index.js
index 0b0a277..8041058 100644
--- a/store/index.js
+++ b/store/index.js
@@ -4,11 +4,24 @@
 
 // 璇锋眰鐩稿叧
 import { reqAll, reqGet, reqPost } from '../utils/index.js';
-
+const findNodeByNme = (arr) => {
+	for (let i = 0; i < arr.length; i++) {
+		let node = arr[i];
+		if (node.name === '姹借溅鏃ュ彂杩愯鍒掔鐞�') return node;
+		if (node.children && node.children.length > 0) {
+			// 濡傛灉褰撳墠鑺傜偣鏈夊瓙鑺傜偣锛屽垯閫掑綊鏌ユ壘瀛愯妭鐐�
+			let foundNode = findNodeByNme(node.children);
+			if (foundNode) return foundNode;
+		}
+	}
+	// 娌℃湁鎵惧埌鐩爣鑺傜偣锛岃繑鍥� null
+	return null;
+}
 const store = new Vuex.Store({
 	state: {
-		shenqingMenu: uni.getStorageSync('shenqingMenu') || false,  //鐢宠鑿滃崟
+		shenqingMenu: uni.getStorageSync('shenqingMenu') || false, //鐢宠鑿滃崟
 		rijihuaMenu: uni.getStorageSync('rijihuaMenu') || false, //鏃ヨ鍒掕彍鍗�
+		permissions: uni.getStorageSync('permissions') || [] //鏉冮檺淇℃伅
 	},
 	mutations: {
 		ISHAS_SHENQING: (state, data) => {
@@ -31,21 +44,17 @@
 				state.shenqingMenu = false
 				uni.setStorageSync('shenqingMenu',state.shenqingMenu)
 			}
-			
+
 		},
+
 		ISHAS_RIJIHUA: (state, data) => {
+			console.log(data,'data-----',state)
 			let labelArry = []
-			let newObj = data.filter(e => e.label == '鍦伴攢璁¢噺')
-			newObj && newObj.forEach(e => {
-				if(e.children.length > 0) {
-					e.children.forEach(item => {
-						labelArry.push(item.label)
-					})
-				}else{
-					state.rijihuaMenu = false
-					uni.setStorageSync('rijihuaMenu',state.rijihuaMenu)
-				}
-			})
+			// let newObj = data.filter(e => e.label == '姹借溅鏃ュ彂杩愯鍒掔鐞�')
+			let newObj = findNodeByNme(data)  //鎵� 姹借溅鏃ュ彂杩愯鍒掔鐞�
+			if(newObj && newObj.label) {
+				labelArry.push(newObj.label)
+			}
 			if(labelArry.indexOf('姹借溅鏃ュ彂杩愯鍒掔鐞�') > -1) {
 				state.rijihuaMenu = true
 				uni.setStorageSync('rijihuaMenu',state.rijihuaMenu)
@@ -53,6 +62,15 @@
 				state.rijihuaMenu = false
 				uni.setStorageSync('rijihuaMenu',state.rijihuaMenu)
 			}
+		},
+		SET_PERMISSIONS: (state,permissions) => {
+			let list = {}
+			for(let i=0;i<permissions.length;i++) {
+				list[permissions[i]] = true
+			}
+			state.permissions = list
+			console.log(list,'list======----')
+			uni.setStorageSync('permissions', list);
 		}
 	},
 	actions: {
@@ -63,7 +81,10 @@
 				commit('ISHAS_RIJIHUA',response.data)
 			})
 		}
+	},
+	getters: {
+		permissions:state => state.permissions
 	}
 })
 
-export default store
\ No newline at end of file
+export default store

--
Gitblit v1.9.1