<template>
  <div class="demo">
    <div class="demo-start">
      <i class="li-line"><b></b></i>
      <span>网关开始</span>
      <i class="li-line"><b></b></i>
    </div>
    <ul class="demo-ul">
      <li v-for="(item, index) in data" :key="index">
        <i class="left-line" :class="{'first-line': index == 0, 'end-line': index == data.length-1}"></i>
        <i class="right-line" :class="{'first-line': index == 0, 'end-line': index == data.length-1}"></i>
        <div v-for="(subItem, subIndex) in item.children" :key="subIndex">
          <!-- 用户任务 -->
          <div v-if="subItem.key == 'user'" class="li-normal">
            <div class="li-normal_top">
              <i class="li-line"><b></b></i>
              <div>
                {{ subItem.text }}
              </div>
            </div>
          </div>
        </div>
        <i class="li-line" style="flex: 1;"><b></b></i>
        <!-- <demo-2 :data="item.children"></demo-2> -->
      </li>
    </ul>
    <div>
      <i class="li-line"><b></b></i>
      网关结束
    </div>
  </div>
</template>
<script>
  export default {
    name: 'demo2',
    props: {
      data: Array,
    },
    data() {
      return {}
    },
    methods: {},
  }
</script>

<style lang="scss" scoped>
  .demo {
    display: flex;
    align-items: center;
    .li-line {
      display: inline-block;
      width: 90px;
      height: 2px;
      background: #999;
      position: relative;
      b {
        position: absolute;
        width: 10px;
        height: 2px;
        background: #999;
        transform: rotate(45deg);
        right: 0;
        top: -4px;
      }
    }
    .li-normal {
      .li-normal_top {
        display: flex;
        align-items: center;
        > div {
          border: 1px solid #999;
          border-radius: 5px;
          text-align: center;
          font-size: 18px;
          color: #333;
          width: 150px;
          padding: 7px 0;
        }
      }
      .li-normal_card {
        background-color: #f5f7f9;
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
        width: 150px;
        padding: 10px;
        margin-top: 10px;
        .li-normal_card_top {
          font-weight: bold;
          color: #333;
        }
        .li-normal_card_users {
          label {
            font-weight: bold;
            color: #333;
          }
          > div {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
          }
          .li-normal_card_users_btn {
            text-align: right;
          }
        }
      }
      &.li-unable {
        .li-normal_top {
          > div {
            border: 1px dashed #999;
          }
        }
      }
    }
    .demo-ul {
      position: relative;
      > li {
        padding: 10px 0;
        position: relative;
        display: flex;
        align-items: center;
      }
      // > li:last-child {
      //   margin-bottom: 0;
      // }
      .left-line {
        height: 100%;
        position: absolute;
        width: 1px;
        background: #999;
        left: -1px;
        top: 0;
        &.first-line {
          height: 50%;
          top: 50%;
        }
        &.end-line {
          height: 50%;
        }
      }
      .right-line {
        height: 100%;
        position: absolute;
        width: 1px;
        background: #999;
        right: -1px;
        top: 0;
        &.first-line {
          height: 50%;
          top: 50%;
        }
        &.end-line {
          height: 50%;
        }
      }
    }
   
  }
</style>
