<template>
  <div class="tableLayout2">
    <iov-breadcrumb ></iov-breadcrumb>
    <div class="layoutContainer">
      <div class="right">
        <slot name="rightbox"></slot>
      </div>
      <div class="bottom">
        <slot name="bottomtbox"></slot>
      </div>
      <div class="layoutContainerFlex">
        <div class="layoutFlex" id="layoutFlex">
          <div  class="treeContainer" :class="{ collapsed: collapsed }">
            <div class="tapContainer">
              <!-- <div class="tap" @click="clickCollapsed" ></div> -->
              <img class="lefttap" v-if="!this.collapsed" @click="clickCollapsed" src="/cdn/icon/resources/arrowleft.svg" />
              <img class="lefttap" v-else @click="clickCollapsed" src="/cdn/icon/resources/arrowright.svg" />
            </div>
            <div v-show="collapsed==false" >
              <form>
                <slot name="form"></slot>
              </form>
              <table>
                <slot name="table"></slot>
              </table>
              <slot></slot>
            </div>
          </div>
        </div>
        <div class="tableContainer"  >
          <div class="tableContainerFlex" :style="{ width: getWidth + 'px' }">
              <slot name="container"></slot>
          </div>
          <div style="position: absolute;right:0px;bottom:0px; z-index:2;">
            <slot name="containerPopup" v-show="isContainerPopup"></slot>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
  },
  data() {
    return {
      collapsed: true,
      isContainerPopup:true,
      getWidth:"",
      hidden:"hidden",
      loading:null
    };
  },
  created() {
    this.collapsed = false;
    // this.getWidthFun();
  },
  watch:{
    getWidth: {
      handler(newVal) {
        // console.log("newval", newVal)
        // console.log("this.collapsed", this.collapsed)
        // console.log("this.getWidth", this.getWidth)
      },
      deep: true
    }
  },
  methods: {
    openLoading(){
       this.loading = this.$loading({
            lock: true,//lock的修改符--默认是false
            text: 'Loading',//显示在加载图标下方的加载文案
            spinner: 'el-icon-loading',//自定义加载图标类名
            background: 'rgba(255, 255, 255, 1)',//遮罩层颜色
            target: document.querySelector('#layoutFlex')//loadin覆盖的dom元素节点
       })
    },
    closeLoading(){
      this.loading.close()
    },
    treeClick(data, node) {
      this.$emit("tree-click", data, node);
    },
    search(data) {
      this.$emit("tree-search", data);
    },
    setFirstTreeNode() {
      return this.treeData[0];
    },
    getTreeObj() {
      return this.$refs.tree.getTreeObj();
    },
    clickCollapsed() {
      this.collapsed = !this.collapsed
      this.$emit("getCollapsedVal",this.collapsed)
      // this.getWidthFun()
    }
  }
};
</script>

<style  lang="less">
.edit_mapbox .mapabcgl-ctrl-top-right .mapabcgl-ctrl{
  margin-top:60px;
}
.area_mapbox .mapabcgl-ctrl-top-right .mapabcgl-ctrl{
  margin-top:60px;
}
.wizard_mapbox .mapabcgl-ctrl-top-right .mapabcgl-ctrl{
  margin-top:60px;
}
.high_map_load{
  position: absolute;
  width: 100%;
  height: 32px;
  top: 10px;
  right: 0;
  z-index: 50;
  color: #333;
  text-align: right;
  .map-buttons {
    // width: 500px;
    height: 28px;
    position: absolute;
    top: 1px;
    right: 0px;
    z-index: 10;
  }
}
.layoutFlex{
  display: flex;
  justify-content: flex-start;
  position: relative;
  z-index: 100;
  background: #fff;
}
.marginTop{
    clear: both;
    width: calc(100% - 20px);
    margin-top: 10px;
    margin-left: 10px;
}
.tableLayout2 {
  height: 100%;
  width: 100%;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  .layoutContainer {
    height: 0;
    flex: auto;
    position: relative;
    .layoutContainerFlex {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      display: flex;
      .treeContainer {
        height: 100%;
        width: 360px;
        position: relative;
        transition: all 0.1s linear;
        border-right: 1px solid #dcdcdc;
        .tapContainer {
          position: absolute;
          top: calc(50% - 20px);
          right: -17px;
          height: 40px;
          width: 18px;
          z-index: 999;
          overflow: hidden;
          .lefttap{
            height: 100%;
            width: 100%;
            cursor: pointer;
          }
          .tap {
            height: 100%;
            width: 100%;
            color: #ddd;
            box-shadow: 0 0 8px #ddd;
            border: 1px solid #ddd;
            cursor: pointer;
            position: relative;
            opacity: 0.2;
            transition: all linear 0.1s;
            background: #666;
          }
          .tap:after,
          .tap:before {
            content: "";
            display: block;
            height: 3px;
            width: 10px;
            background: #ddd;
            position: absolute;
            left: 3px;
          }
          .tap:before {
            top: 14px;
            transform: rotate(-45deg);
          }
          .tap:after {
            bottom: 15px;
            transform: rotate(45deg);
          }
        }
        .tapContainer:hover {
          .tap {
            opacity: 1;
          }
        }
      }
      .treeContainer.collapsed {
        width: 0;
        .stms-tree {
          display: none;
        }
        .tapContainer {
          right: -17px;
          .tap {
            right: 0;
          }
          .tap:before {
            transform: rotate(45deg);
          }
          .tap:after {
            transform: rotate(-45deg);
          }
        }
      }
      .tableContainer {
         position: absolute;
          top: 0;
          right: 0;
          bottom: 0;
          left: 0;
          z-index: 2;
        .tableContainerFlex {
          width: 100%;
          height: 100%
        }
      }
    }
  }
  .iov-content {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    .iov-tool {
      padding: 10px 20px 0;
      .el-button {
        i {
          margin-left: 5px;
        }
      }
      .split {
        float: left;
        height: 100%;
        width: 1px;
        background: #eee;
        margin: 0 25px;
      }
      .el-input {
        width: 250px;
        float: right;
      }
      .template-tab {
        margin-top: -10px;
      }
    }
    .iov-table {
      flex: auto;
      position: relative;
      padding: 10px 20px;
      .stms-scrollbar {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
      }
    }
  }
}
</style>
