<template>
  <div style="background-color: #1461cc">
    <el-menu
      style="border: 0;text-align: left"
      background-color="#1461cc"
      text-color="rgba(255, 255, 255, 1)"
      active-text-color="white"
      :collapse="isCollapse"
      :collapse-transition="false"
      router
      mode="vertical"
      :unique-opened="true"
    >
      <template v-for="(menu, index) in menus" >
        <el-submenu :index="menu.path" v-if="menu.submenus != null" :key="menu.path">
          <template slot="title">
            <el-avatar :src="menu.url" :size="25" shape="square" style="background-color: transparent;margin-right: 12px" ></el-avatar>
            <span>{{ menu.name }}</span>
          </template>
          <el-menu-item
              v-for="submenu in menu.submenus"
              :index="submenu.path"
              :key="submenu.path"
          >
            <span style="margin-left: 40px">{{ submenu.name }}</span>
          </el-menu-item>
        </el-submenu>
        <el-menu-item
            v-if="menu.submenus == null"
            :key="menu.path"
            :index="menu.path"
        >
          <el-avatar :src="menu.url" :size="25" shape="square" style="background-color: transparent;margin-right: 6px" ></el-avatar>
          <span slot="title">
          {{ menu.name }}
        </span>
        </el-menu-item>
      </template>
    </el-menu>
  </div>
</template>

<script>
export default {
  props: {
    isCollapse: Boolean,
  },
  data() {
    return {
      menus: [
        {
          url: require("@/assets/menu/userManagement@3x.png"),
          name: "用户管理",
          submenus: [
            {
              name: "人员管理",
              path: "/home/user/person",
            },
            {
              name: "组织管理",
              path: "/home/user/group",
            },
          ],
        },
        {
          url: require("@/assets/menu/roleManagement@3x.png"),
          name: "角色管理",
          path: "/home/role",
        },
        {
          url: require("@/assets/menu/systemConfiguration@3x.png"),
          name: "系统配置",
          path: "/home/system",
          submenus: [
            {
              name: "策略配置",
              path: "/home/system/strategy",
            },
            {
              name: "消息配置",
              path: "/home/system/message",
            },
            {
              name: "信息配置",
              path: "/home/system/info",
            },
            {
              name: "指标配置",
              path: "/home/system/index",
            },
          ],
        },
        {
          url: require("@/assets/menu/deviceManagement@3x.png"),
          name: "设备管理",
          path: "/home/device",
          submenus: [
            {
              name: "设备配置",
              path: "/home/device/config",
            },
            {
              name: "设备告警",
              path: "/home/device/warning",
            },
          ],
        },
        {
          url: require("@/assets/menu/dataManagement@3x.png"),
          name: "数据管理",
          path: "/home/data",
          submenus: [
            {
              name: "报表配置",
              path: "/home/data/statement",
            },
            {
              name: "报告配置",
              path: "/home/data/report",
            },
            {
              name: "基础信息",
              path: "/home/data/basicInfo",
            },
          ],
        },
        {
          url: require("@/assets/menu/serviceManagement@3x.png"),
          name: "服务管理",
          path: "/home/service",
        },
        {
          url: require("@/assets/menu/securityManagement@3x.png"),
          name: "安全管理",
          path: "/home/security",
          submenus: [
            {
              name: "日志监控",
              path: "/home/security/logMonitor",
            },
            {
              name: "系统监控",
              path: "/home/security/systemMonitor",
            },
          ],
        },
      ],
    };
  },
};
</script>

<style lang="less" scoped>
/deep/ .el-menu-item.is-active {
  background-color: #409EFF !important;
}


/deep/.el-submenu__icon-arrow {
  display: none;
}

.el-image {
  position: relative;
  overflow: auto;
  float: left;
}

/deep/.el-image__inner {
  vertical-align: middle;
  width: 30px;
  height: 30px;
}

/deep/.el-menu-item-group__title {
  padding: 0;
}

.el-menu-item-group > .span {
  margin-left: 70px;
}

/deep/.el-menu--inline > {
  border: none;
  text-align: -webkit-right;
}
/deep/ .el-submenu .el-menu-item {
  padding: 0 0 0 25px !important;
  text-align: left;
}

.el-menu-item {
  font-size: 16px;
  padding: 0 40px;
  cursor: pointer;
}

/deep/.el-submenu__title {
  font-size: 16px;
}
</style>
