zhongxiaoyu 3 жил өмнө
parent
commit
61114ab85d

+ 21 - 10
src/utils/validate.js

@@ -1,7 +1,7 @@
 /*
 /*
  * @Author: your name
  * @Author: your name
  * @Date: 2021-12-13 09:43:22
  * @Date: 2021-12-13 09:43:22
- * @LastEditTime: 2022-03-16 16:51:25
+ * @LastEditTime: 2022-03-17 09:41:18
  * @LastEditors: your name
  * @LastEditors: your name
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \Foshan4A2.0\src\utils\validate.js
  * @FilePath: \Foshan4A2.0\src\utils\validate.js
@@ -45,16 +45,27 @@ export function translateDataToTreeAll(data, parentKey, parentIDKey) {
   let translator = (parent, children) => {
   let translator = (parent, children) => {
     parent.forEach((parent) => {
     parent.forEach((parent) => {
       parent.children = [];
       parent.children = [];
-      children.forEach((current, index) => {
-        if (current[parentKey] === parent[parentIDKey]) {
-          const temp = JSON.parse(JSON.stringify(children));
-          temp.splice(index, 1);
-          translator([current], temp);
-          typeof parent.children !== "undefined"
-            ? parent.children.push(current)
-            : (parent.children = [current]);
+      // children.forEach((current, index) => {
+      //   if (current[parentKey] === parent[parentIDKey]) {
+      //     const temp = JSON.parse(JSON.stringify(children));
+      //     temp.splice(index, 1);
+      //     translator([current], temp);
+      //     typeof parent.children !== "undefined"
+      //       ? parent.children.push(current)
+      //       : (parent.children = [current]);
+      //   }
+      // });
+      for (let i = 0; i < children.length;) {
+        if (children[i][parentKey] === parent[parentIDKey]) {
+          const temp = children.splice(i, 1)
+          typeof parent.children !== 'undefined'
+            ? parent.children.push(...temp)
+            : (parent.children = temp)
+          translator(temp, children)
+        } else {
+          i++
         }
         }
-      });
+      }
     });
     });
   };
   };
   translator(parent, children);
   translator(parent, children);

+ 2 - 2
src/views/accountGroupManagement/components/accountGroupHome.vue

@@ -1,7 +1,7 @@
 <!--
 <!--
  * @Author: your name
  * @Author: your name
  * @Date: 2022-01-08 09:27:43
  * @Date: 2022-01-08 09:27:43
- * @LastEditTime: 2022-03-16 21:06:14
+ * @LastEditTime: 2022-03-17 09:46:23
  * @LastEditors: your name
  * @LastEditors: your name
  * @Description: 用户组管理
  * @Description: 用户组管理
  * @FilePath: \Foshan4A2.0\src\views\accountGroupManagement\components\home.vue
  * @FilePath: \Foshan4A2.0\src\views\accountGroupManagement\components\home.vue
@@ -391,7 +391,7 @@ export default {
     renderChange(data) {
     renderChange(data) {
       const { GroupId, flag } = data
       const { GroupId, flag } = data
       const Status = flag ? 1 : 0
       const Status = flag ? 1 : 0
-      this.handleChange(GroupId, Status, index)
+      this.handleChange(GroupId, Status)
     },
     },
     // 下级切换状态
     // 下级切换状态
     async childrenRenderChange(data, index) {
     async childrenRenderChange(data, index) {