From 8cc26dd54779273f895a3cbc3f84c8933a02a0dc Mon Sep 17 00:00:00 2001
From: wuyouming666 <2265557248@qq.com>
Date: 星期三, 10 七月 2024 14:44:47 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes

---
 UI-Project/src/views/User/rolelist.vue |  160 ++++++++--------------------------------------------
 1 files changed, 26 insertions(+), 134 deletions(-)

diff --git a/UI-Project/src/views/User/rolelist.vue b/UI-Project/src/views/User/rolelist.vue
index d5fd898..78dfa0f 100644
--- a/UI-Project/src/views/User/rolelist.vue
+++ b/UI-Project/src/views/User/rolelist.vue
@@ -140,143 +140,25 @@
   if (selectedOptions.value !== topLevelItems) {  
     selectedOptions.value = topLevelItems;  
   }  
-
-  const topLevelItemsWithChildren = topLevelItems; // 鍖呭惈椤剁骇鑿滃崟椤瑰強鍏跺瓙鑿滃崟椤圭殑鏁扮粍  
-  let selectedPath = [];
-
+  console.log(topLevelItems);
+  // selectedOptions.value = topLevelItems;
+const topLevelItemsWithChildren = topLevelItems; // 鍖呭惈椤剁骇鑿滃崟椤瑰強鍏跺瓙鑿滃崟椤圭殑鏁扮粍 聽
+ let selectedPath = [];
 // 寰幆閬嶅巻 topLevelItemsWithChildren 鏁扮粍
 for (let i = 0; i < topLevelItemsWithChildren.length; i++) {
-    // 娣诲姞椤剁骇鑿滃崟椤圭殑 id
-    selectedPath.push(topLevelItemsWithChildren[i].id);
-
-    // 閬嶅巻璇ラ《绾ц彍鍗曢」鐨勫瓙鑿滃崟椤�
-    if (topLevelItemsWithChildren[i].children && topLevelItemsWithChildren[i].children.length > 0) {
-        for (let j = 0; j < topLevelItemsWithChildren[i].children.length; j++) {
-            // 娣诲姞姣忎釜瀛愯彍鍗曢」鐨� id
-            selectedPath.push(topLevelItemsWithChildren[i].children[j].id);
-        }
-    }
+ // 娣诲姞椤剁骇鑿滃崟椤圭殑 id
+ selectedPath.push(topLevelItemsWithChildren[i].id);
+ // 濡傛灉鏈夊瓙鑿滃崟椤癸紝娣诲姞绗竴涓瓙鑿滃崟椤圭殑 id
+ if (topLevelItemsWithChildren[i].children && topLevelItemsWithChildren[i].children.length > 0) {
+  for (let j = 0; j < topLevelItemsWithChildren[i].children.length; j++) {  
+            // 灏嗘瘡涓瓙鑿滃崟椤圭殑 id 娣诲姞鍒� selectedPath 涓�  
+            selectedPath.push(topLevelItemsWithChildren[i].children[j].id);  
+        }  
+    }  
 }
-
-  console.log(selectedPath);
+ console.log(selectedPath);
 selectedOptions.value = selectedPath;
 }
-// function handleEdit(row) {  
-//   name.value = row.name;  
-//   adda.value = true;  
-//   window.localStorage.setItem('ids', row.id);  
-//   // 鏋勫缓鑿滃崟鏍�  
-//   const buildMenuTree = (menuList) => {  
-//     const parentIdMap = {};  
-//     const menuItemsById = {};  
-//     menuList.forEach(item => {  
-//       const parentId = item.parentId === 0 ? null : item.parentId;  
-//       const menuItem = {  
-//         id: item.id,  
-//         parentId: parentId,  
-//         menuName: item.menuName,  
-//         children: []  
-//       };  
-//       menuItemsById[item.id] = menuItem;  
-  
-//       if (!parentIdMap[parentId]) {  
-//         parentIdMap[parentId] = [];  
-//       }  
-//       parentIdMap[parentId].push(menuItem);  
-//     });  
-//     // 鏋勫缓鐖跺瓙鍏崇郴  
-//     for (const parentId in parentIdMap) {  
-//       if (parentId !== 'null') {  
-//         parentIdMap[parentId].forEach(child => {  
-//           if (menuItemsById[parentId]) {  
-//             menuItemsById[parentId].children.push(child);  
-//           }  
-//         });  
-//       }  
-//     }   
-//     return parentIdMap[null] || [];  
-//   };  
-//   const options = buildMenuTree(row.menuList);  
-//   const selectedIds = row.menuList.filter(item => item.parentId === 0).map(item => item.id);  
-//   selectedOptions.value = selectedIds; 
-//   console.log(options); // 杈撳嚭鏁翠釜鑿滃崟鏍�  
-//   console.log(selectedIds); // 杈撳嚭搴旈粯璁ら�変腑鐨勮妭鐐笽D鏁扮粍  
-// }  
-// function handleEdit(row) {  
-//   name.value = row.name;  
-//   adda.value = true;
-//   window.localStorage.setItem('ids', row.id);
-//   // 鍒濆鍖� parentIdMap 鍜� menuItemsById  
-//   const parentIdMap = {};  
-//   const menuItemsById = {};  
-//   let topLevelItems = [];  
-  
-//   // 鏋勫缓鏍戝舰缁撴瀯  
-//   row.menuList.forEach(item => {  
-//     const parentId = item.parentId === 0 ? null : item.parentId;  
-//     const menuItem = {  
-//       id: item.id,  
-//       parentId: parentId,  
-//       label: item.menuName, // 娉ㄦ剰锛歟l-cascader 浣跨敤 label 鑰屼笉鏄� menuName  
-//       value: item.id, // 閫氬父 value 鏄敮涓�鏍囪瘑绗�  
-//       children: []  
-//     };  
-//     menuItemsById[item.id] = menuItem;  
-  
-//     if (!parentIdMap[parentId]) {  
-//       parentIdMap[parentId] = [];  
-//     }  
-  
-//     if (parentId === null) {  
-//       topLevelItems.push(menuItem);  
-//     } else {  
-//       parentIdMap[parentId].push(menuItem);  
-//     }  
-//   });  
-  
-//   // 鏋勫缓鐖跺瓙鍏崇郴  
-//   for (const parentId in parentIdMap) {  
-//     if (parentId !== 'null') {  
-//       parentIdMap[parentId].forEach(child => {  
-//         if (menuItemsById[parentId]) {  
-//           menuItemsById[parentId].children.push(child);  
-//         }  
-//       });  
-//     }  
-//   }  
-  
-//   // 璁剧疆 options  
-//   options.value = topLevelItems;  
-  
-//   // 鏋勫缓 selectedOptions  
-//   let selected = [];  
-//   // 鍋囪浣犳兂閫変腑鎵�鏈夎妭鐐癸紝浣犲彲浠ラ亶鍘� row.menuList 骞舵瀯寤鸿矾寰�  
-//   row.menuList.forEach(item => {  
-//     let path = [];  
-//     let currentParentId = item.parentId;  
-//     while (currentParentId !== null) {  
-//       const parentItem = menuItemsById[currentParentId];  
-//       if (parentItem) {  
-//         path.unshift(parentItem.value); // 浠庣埗鑺傜偣鍒板瓙鑺傜偣  
-//         currentParentId = parentItem.parentId;  
-//       } else {  
-//         break; // 濡傛灉鎵句笉鍒扮埗鑺傜偣锛屽垯鍋滄  
-//       }  
-//     }  
-//     // 娣诲姞褰撳墠鑺傜偣鐨� ID 鍒拌矾寰勬湯灏�  
-//     path.push(item.id);  
-//     // 濡傛灉璺緞涓嶄负绌猴紝鍒欐坊鍔犲埌 selectedOptions  
-//     if (path.length > 0) {  
-//       selected.push(path);  
-//     }  
-//   });  
-  
-//   // 鏇存柊 selectedOptions  
-//   selectedOptions.value = selected;  
-//   console.log(selected);
-//   console.log(topLevelItems);
-//   // 娉ㄦ剰锛氱‘淇� selectedOptions 鍜� options 鏄搷搴斿紡鐨�  
-// }
 // 缂栬緫
 const getTableRowa = async () => {
   let ids = window.localStorage.getItem('ids')
@@ -325,6 +207,16 @@
     console.error(error);
   }
 };
+function closeDialog(row) {
+     add.value = false;
+      name.value = '';
+      selectedOptions.value = '';
+}
+function closeDialoga(row) {
+     adda.value = false;
+      name.value = '';
+      selectedOptions.value = '';
+}
 // 鍒犻櫎 
  const opena = async(row) => {  
   try {
@@ -420,7 +312,7 @@
         <el-button type="primary" @click="getTableRow">
           {{ $t('delivery.sure') }}
         </el-button>
-        <el-button @click="add = false"> {{ $t('delivery.cancel') }}</el-button>
+        <el-button @click="closeDialog"> {{ $t('delivery.cancel') }}</el-button>
       </div>
     </template>
   </el-dialog> 
@@ -460,7 +352,7 @@
         <el-button type="primary" @click="getTableRowa">
           {{ $t('delivery.sure') }}
         </el-button>
-        <el-button @click="adda = false">{{ $t('delivery.cancel') }}</el-button>
+        <el-button @click="closeDialoga">{{ $t('delivery.cancel') }}</el-button>
       </div>
     </template>
   </el-dialog> 

--
Gitblit v1.8.0