<template>
  <div class="stepBox">
    <div class="line">
      <span class="before circle" />
      <div v-for="item in data" :key="item.parentTemplateId" class="subTitle" @click="$emit('goto', `s${item.parentTemplateId}`)">
        <i class="el-icon-success icon" :class="getclass(item.parentTemplateId)" />
        {{ item.name }}
      </div>
      <span class="after circle" />
    </div>
  </div>
</template>
<script>
export default {
  props: {
    data: {
      type: Array,
      default: () => [],
      required: false
    },
    typeList: {
      type: Array,
      default: () => [],
      required: false
    }
  },
  methods: {
    getclass(id) {
      let type = 'el-icon-question'
      this.typeList.map(t => {
        if (t.parentTemplateId === id && t.isCheck) {
          type = 'el-icon-success'
        }
      })
      return type
    }
  }
}
</script>
<style scoped lang="scss">
.line {
  border-right: 2px solid #D1D1D1;
  position: relative;
  padding: 2px 0;
  .circle {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid #666;
    background-color: #fff;
    position: absolute;
    left: calc(100% - 2px);
  }
  .subTitle {
    width: 130px;
    text-align: center;
    margin: 16px 0px 16px 50%;
    padding-left: 16px;
    background: #fff;
    cursor: pointer;
    position: relative;
    .icon {
      position: absolute;
      left: 0px;
      top: 4px;
      font-size: 14px;
    }
    .el-icon-success {
      color: #1890FF;
    }
    .el-icon-question {
      color: #999;
    }
  }
  .before {
    top: 0px;
    margin-bottom: 8px;
  }
  .after {
    bottom: 0px;
  }
}
</style>
