haoxuan
2023-12-26 eed27d3000e127c433fd45609d0d5e5d06b7868c
src/components/layout/components/appsidebar/index.vue
@@ -36,12 +36,12 @@
          <el-menu-item index="/backgroundConfig/rolePermssion">角色权限</el-menu-item>
        </el-submenu> -->
      </el-menu>
      <el-empty v-if="this.menus===null||this.menus===undefined||this.menus.length===0" :image-size="130" description="没有侧栏菜单"></el-empty>
    </div>
  </div>
</template>
<script>
import {getMenuTreeByRole} from "@/api/menus/index"
export default {
  name: "AppSidebar",
  props: {},
@@ -62,28 +62,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() {
@@ -100,4 +94,11 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
@import "./index.scss";
::v-deep .el-empty{
  .el-empty__description{
    p{
      color: #dddd;
    }
  }
}
</style>