<style scoped lang="less">
.layout {
  background: #f5f7f9;
  position: relative;
  overflow: hidden;
}
.layout-header-bar {
  background: #fff;
  text-align: left;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.layout-logo-left {
  width: 90%;
  height: 30px;
  background: #5b6270;
  border-radius: 3px;
  margin: 15px auto;
}
.menu-icon {
  transition: all 0.3s;
  // background: url("../../assets/img/home-nav.png") no-repeat center center;
  // background-size: 20px 20px;
  // width: 20px;
  // height: 20px;
}
.rotate-icon {
  transform: rotate(-90deg);
}
.menu-item {
  background: #000d44;
}
.ivu-menu-item span,
.menu-item span {
  display: inline-block;
  overflow: hidden;
  width: 69px;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  transition: width 0.2s ease 0.2s;
  color: #fff;
  opacity: 0.65;
}

.menu-item i {
  transform: translateX(0px);
  transition: font-size 0.2s ease, transform 0.2s ease;
  vertical-align: middle;
  font-size: 16px;
}
.collapsed-menu span {
  width: 0px;
  transition: width 0.2s ease;
}
.collapsed-menu i {
  transform: translateX(5px);
  transition: font-size 0.2s ease 0.2s, transform 0.2s ease 0.2s;
  vertical-align: middle;
  font-size: 22px;
}

.nav-icon {
  width: 20px;
  height: 20px;
  position: relative;
  top: 4px;
}
.leftcollapsedH {
  height: 30px;
  line-height: 30px;
  margin-right: 25px;
  position: absolute;
  bottom: 20px;
  right: 0;
}
.main-content {
  width: 100%;
  height: 100%;
}
.content {
  background: "#FFF" !important;
  height: "calc(100vh - 45px)" !important;
}
.data-content {
  background: "#1d2033" !important;
  height: "calc(100vh - 23px)" !important;
}
.lefttopLogo {
  display: flex;
  height: 60px;
  background: #000d44;
  align-items: center;
  justify-content: center;
}
.systemName {
  color: #fff;
  height: 32px;
  font-size: 14px;
  line-height: 16px;
  width: 116px;
  word-wrap: break-word;
}
.retract {
  font-size: 14px;
  color: #b6d7d9;
  opacity: 0.65;
}
.imgSize {
  display: inline-block;
  width: 30px;
  height: 30px;
}
.main-icon {
  cursor: pointer;
}
.main-menu {
  height: 54px;
  line-height: 54px;
}
/*
侧边栏修改
 */
.left-sider {
  /deep/ .ivu-layout-sider-children {
    overflow-y: scroll;
    margin-right: -18px;
    height: calc(~"100vh - 60px");
  }
}
</style>
<template>
  <Layout class="layout" style="height:100%">
    <Layout>
      <Content>
        <Layout>
          <Content
            :style="
              databoardFlag
                ? {
                    background: '#1d2033',
                    height: '100vh',
                    width: '100%',
                    'overflow-y': 'auto',
                    'overflow-x': 'hidden'
                  }
                : {
                    background: '#FFF',
                    height: 'calc(100vh)',
                    overflow: 'auto'
                  }
            "
          >
            <transition name="fade-transform" mode="out-in">
              <router-view></router-view>
            </transition>
          </Content>
        </Layout>
      </Content>
    </Layout>
  </Layout>
</template>
<script>
export default {
  data() {
    return {
      currentIndex: "1",
      isCollapsed: false,
      imgUrl: "data:image/png;base64,",
      flagLogo: true,
      databoardFlag: false
    }
  },
  components: {},
  computed: {
    menulist() {
      return this.$store.getters.menuList
    },
    rotateIcon() {
      return ["menu-icon", this.isCollapsed ? "rotate-icon" : ""]
    },
    menuitemClasses() {
      return ["menu-item", this.isCollapsed ? "collapsed-menu" : ""]
    }
  },
  watch: {
    $route: {
      handler: function(route) {
        if (route.name == "databoard") {
          this.databoardFlag = true
        } else {
          this.databoardFlag = false
        }
      },
      immediate: true
    }
  },
  methods: {
    collapsedSider() {
      this.$refs.side.toggleCollapse()
      this.$forceUpdate()
      this.flagLogo ? (this.flagLogo = false) : (this.flagLogo = true)
    },
    jumpPage(data, index) {
      // this.currentIndex = index;
      this.$router.push(data)
      //处理草稿箱处tab页问题
      sessionStorage.setItem("ifDraft", "")
      sessionStorage.setItem("referForm", "")
    },
    turnToPage(route) {
      let { name, params, query } = {}
      if (typeof route === "string") name = route
      else {
        name = route.name
        params = route.params
        query = route.query
      }
      this.$router.push({
        name,
        params,
        query
      })
      //处理草稿箱处tab页问题
      sessionStorage.setItem("ifDraft", "")
      sessionStorage.setItem("referForm-hospital", null)
      sessionStorage.setItem("referForm-doctor", null)
      sessionStorage.setItem("referForm-group", null)
      sessionStorage.setItem("screen-tab", null)
      sessionStorage.setItem("random-status", null)
      sessionStorage.setItem("referForm-alliance", null)
      //人群页签初始化
      sessionStorage.setItem("screen-status", "")
      sessionStorage.setItem("audit-tab", 0)
      sessionStorage.setItem("confirm-tab", "")
    },
    handleScroll() {
      //窗口滚要做的操作写这里
    }
  },
  created() {
    this.$store.dispatch("getDict")
    //监听页面滚动事件
    // window.addEventListener("scroll", this.handleScroll);
  }
}
</script>
