gaoshp
2024-04-16 5ce658c5cf97b40cc0d84d8bfb37f96053ea8ef1
src/views/login/components/passwordForm.vue
@@ -81,6 +81,7 @@
                    });
               }
            })
            //获取菜单
            await this.$HTTP.get("/api/blade-system/menu/routes?" + this.$TOOL.qsStringify({"appCode": "CPS"})).then(res=> {
               if(res.data.length==0){
                  this.islogin = false
@@ -103,49 +104,58 @@
                     } else {  
                        // 如果没有 children 属性,说明是最后一级,添加 component 对象  
                        var len = clonedItem.path.length;
                        clonedItem.component = clonedItem.path.substring(1,len);
                        if(item.name == "任务调度") {
                           //clonedItem.component = clonedItem.path;   //有component不可以使用iframe
                        }else {
                           clonedItem.component = clonedItem.path.substring(1,len);
                        }
                     } 
                     //console.log(clonedItem.source)
                     clonedItem.meta = {title: clonedItem.name,icon: "el-icon-takeaway-box", type: "menu"}
                     if(item.name == "任务调度") {
                        clonedItem.meta = {title: clonedItem.name,icon: "el-icon-takeaway-box", type: "iframe"}
                     }else {
                        clonedItem.meta = {title: clonedItem.name,icon: "el-icon-takeaway-box", type: "menu"}
                     }
                     return clonedItem;
                  });  
               }   
               var transformedArray = addComponentToLastLevel(res.data); 
               transformedArray[0].path = "/home";
               transformedArray[0].children = [{
                  component: "home",
                  meta: {title: "工作台", icon: 'el-icon-menu', affix: true},
                  name: "工作台",
                  path: "/dashboard"
               }]
               //结束
               var obj = {
                  dashboardGrid: ["welcome", "ver", "time", "progress", "echarts", "about"],
                  menu: transformedArray,
                  permissions: ["list.add", "list.edit", "list.delete", "user.add", "user.edit", "user.delete"]
               }
               console.log(obj.menu)
               // this.$API.system.menu.myMenus.get().then(resp=> {
               //    Object.assign({},transformedArray,resp.data.menu);
               //    this.$TOOL.data.set("MENU", obj.menu)
               //    this.$TOOL.data.set("PERMISSIONS", obj.permissions)
               //    this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
               // });
               this.$TOOL.data.set("MENU", obj.menu)
               this.$TOOL.data.set("PERMISSIONS", obj.permissions)
               this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
               //获取多个工作台
               this.$HTTP.get("/api/blade-system/workbench/list?status=1").then(resp=> {
                  if(resp.data.length) {
                     //console.log(resp.data,resp.data[0].name,333);
                     resp.data.forEach((item,index)=> {
                        item.component = "home";
                        item.meta = {title: item.name, icon: 'el-icon-menu', affix: true};
                        item.path = "/dashboard";
                        item.parentId = item.id;
                     })
                     transformedArray[0].path = "/home";
                     transformedArray[0].children = resp.data;
                     var obj = {
                        dashboardGrid: ["welcome", "ver", "time", "progress", "echarts", "about"],
                        menu: transformedArray,
                        permissions: ["list.add", "list.edit", "list.delete", "user.add", "user.edit", "user.delete"]
                     }
                     this.$TOOL.data.set("MENU", obj.menu)
                     this.$TOOL.data.set("PERMISSIONS", obj.permissions)
                     this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
                     console.log(transformedArray,222)
                     this.$router.replace({
                        path: '/'
                     })
                     this.$message.success("Login Success 登录成功")
                     this.islogin = false;
                  }
               })
            })
            this.$router.replace({
               path: '/'
            })
            this.$message.success("Login Success 登录成功")
            this.islogin = false;
         }
      }
   }
</script>
<style>
.login-form {margin: 0 auto;margin-top: 46px;width: 354px;}
.inputHeight {height: 60px;line-height: 60px;}
.login-form {margin: 0 auto;margin-top: 46px;width: 294px;}
.inputHeight {height: 40px;line-height: 40px;}
</style>