<template>
  <div class="tree-with-line">
    <a-tree v-bind="$attrs" :defaultExpandAll="true">
      <template slot="switcherIcon">
        <div></div>
      </template>
    </a-tree>
  </div>
</template>
<script>
export default {}
</script>
<style lang="less" scoped>
.tree-with-line {
  @borderColor: #0a544e;
  @bgColor: #022024;
  ::v-deep .ant-tree {
    border-left: 1px dotted @borderColor;
    &-switcher {
      background: transparent !important;
      width: 17px;
      height: 17px;
      &-noop {
        display: none;
      }
      &-icon {
        margin-top: 3px;
        background: url(~@/assets/images/global/switcher.png) center center no-repeat;
        position: relative;
        z-index: 1;
        width: 100%;
        height: 100%;
        transform: none;
      }
      &_open {
        .ant-tree-switcher-icon {
          background-image: url(~@/assets/images/global/switcher-open.png);
        }
      }
    }

    &-treenode-switcher {
      &-open,
      &-close {
        &::before {
          content: '';
          border-top: 1px dotted @borderColor;
          width: 19px;
          display: inline-block;
          vertical-align: middle;
        }
      }
    }

    li ul {
      padding-left: 28px;
    }

    &-child-tree {
      position: relative;
      &::after {
        content: '';
        position: absolute;
        border-left: 1px dotted @borderColor;
        top: -14px;
        height: 100%;
        z-index: 0;
      }
      li {
        &:last-child {
          position: relative;
          padding-top: 4px;
          &::after {
            content: '';
            background-color: @bgColor;
            position: absolute;
            top: 16px;
            left: -1;
            height: calc(100% - 14px);
            width: 3px;
            z-index: 1;
          }
        }
      }
    }

    > li:last-child {
      position: relative;
      &::after {
        content: '';
        background-color: @bgColor;
        width: 3px;
        height: 100%;
        position: absolute;
        top: 16px;
        left: -1px;
        z-index: 1;
      }
    }
  }
}
</style>
