lph 1 tahun lalu
induk
melakukan
6771cb7480

+ 0 - 2
ruoyi-ui/src/views/system/fromModel/index.vue

@@ -74,7 +74,6 @@ export default {
   methods: {
     handleSave(values) {
       var jsonData = JSON.parse(values);
-      console.log(jsonData);
       //
       var editorHtmlJson =
         codeHtmlFront + JSON.stringify(jsonData) + codeHtmlLast;
@@ -86,7 +85,6 @@ export default {
         formSQL,
         formNodeId,
       } = jsonData.config;
-      // console.log(this.fid)
       if (!this.fid) {
         addForm({
           dfName: formName,

+ 19 - 7
ruoyi-ui/src/views/tableMange/index.vue

@@ -1334,6 +1334,7 @@ export default {
           isAsc,
           primaryKey,
         });
+        console.log(this.menus);
         this.formData.routePath = this.getParentMenuId(
           res.data.menuId,
           this.menus,
@@ -1355,16 +1356,27 @@ export default {
       }
     },
     // 获取父级menuId
-    getParentMenuId(menuId, menus, parentItem) {
-      if (!menus.length) return undefined;
+    getParentMenuId(menuId, menus) {
       let res;
-      for (var i = 0; i < menus.length; i++) {
+      for (let i = 0; i < menus.length; i++) {
+        // console.log(menus[i]);
         let item = menus[i];
+        console.log(item.menuId, menuId);
         if (item.menuId == menuId) {
-          res = parentItem?.menuId;
-        }
-        if (item.children?.length) {
-          res = this.getParentMenuId(menuId, item.children, item);
+          res = item.parentId;
+          break;
+        } else if (item.children?.length) {
+          if (
+            this.getParentMenuId(
+              menuId,
+              JSON.parse(JSON.stringify(item.children))
+            )
+          ) {
+            res = this.getParentMenuId(
+              menuId,
+              JSON.parse(JSON.stringify(item.children))
+            );
+          }
         }
       }
       return res;