zuozhengqing
2023-12-20 a4ad4789a091367fc2d63e0a6250a816335ea501
src/components/layout/components/appsidebar/index.vue
@@ -41,7 +41,6 @@
</template>
<script>
import {getMenuTreeByRole} from "@/api/menus/index"
export default {
  name: "AppSidebar",
  props: {},
@@ -62,28 +61,22 @@
  },
  methods: {
    getMenuTreeByRole(){
      getMenuTreeByRole().then((res)=>{
        console.log(res.data.list,"crm菜单")
        res.data.list.map((item)=>{
          if(item.systemType===2){
            let newList= JSON.parse(JSON.stringify([...item.menus]))
            // 隐藏了 生成计划 和 服务收费管理模块
            if(newList[1]){
              const found = newList[1].children.find(obj => obj.title === "生成计划")
              if(found){
                newList[1].children=[...newList[1].children.slice(0, -1)];
              }
            }
            if(newList[2]){
              const found1 = newList[2].children.find(obj => obj.title === "服务收费管理")
              if(found1){
                newList[2].children=[...newList[2].children.slice(0, -1)];
              }
            }
            this.menus=newList
          }
        })
      })
      let newList=this.$store.state.menus
      console.log(newList,"newList")
      // 隐藏了 生成计划 和 服务收费管理模块
      if(newList[1]){
        const found = newList[1].children.find(obj => obj.title === "生成计划")
        if(found){
          newList[1].children=[...newList[1].children.slice(0, -1)];
        }
      }
      if(newList[2]){
        const found1 = newList[2].children.find(obj => obj.title === "服务收费管理")
        if(found1){
          newList[2].children=[...newList[2].children.slice(0, -1)];
        }
      }
      this.menus=newList
    },
    // 监听路由
    initNavMenu() {