<template>
  <ul class="timeline-wrapper">
    <li class="timeline-item" style="margin-top: 10px;">
      <div class="timeline-box">
        <div class="out-circle">
          <div class="in-circle"></div>
        </div>
        <div class="long-line"></div>
      </div>
      <div class="timeline-content">
        <div class="timeline-title" style="font-weight: bolder">事件发布：</div>
        <div class="timeline-date el-form-div">
          <div style="margin-left: 32px">时间：{{nowItem.createTime}}</div>
          <!--<div class="classType">事件发布</div>-->
        </div>
        <div class="timeline-title">事件名称：<span style="color: red">{{ nowItem.eventName}}</span></div>
        <div class="timeline-title" style="margin-left: 32px" >位置：{{ nowItem.address}}</div>
      </div>
    </li>
    <li class="timeline-item" v-for="t in timelineList" :key="t.id">
      <div class="timeline-box">
        <div class="out-circle">
          <div class="in-circle"></div>
        </div>
        <div class="long-line"></div>
      </div>
      <div class="timeline-content">
        <div  v-if="t.eventType==2" class="timeline-title" style="font-weight: bolder">预案指引：</div>
        <div  v-if="t.eventType==1" class="timeline-title" style="font-weight: bolder">信息处置：</div>
        <div class="timeline-date el-form-div">
          <div style="margin-left: 32px">时间：{{t.createTime}}</div>
          <!--<div class="classType"  v-if="t.eventType==2">预案指引</div>-->
          <!--<div class="classType" v-if="t.eventType==1">信息处置</div>-->
        </div>
        <div class="timeline-title" style="margin-left: 32px">内容：{{ t.management}}</div>
        <div class="timeline-desc" style="margin-left: 32px">
            <span
              class="dbtn"
              @click="checkFile(t.managementEvent)"
              v-if="t.managementEvent != null && t.managementEvent!=''"
            >
              <i class="el-icon el-icon-view"></i>查看/下载
            </span>
            <span v-else>-</span>
        </div>
      </div>
    </li>
  </ul>

</template>

<script type="text/babel">
  import Vue from 'vue'
  export default Vue.component('Timeline',{
    name: "Timeline",
    props: {
      timelineList: {
        type: Array,
        default: () => {
          return []
        }
      },
      nowItem:{}
    },
    methods: {
      checkFile(url) {
        window.open(url,'_blank');
      },
    }
  })
</script>

<style scoped lang="scss">
  ul.timeline-wrapper {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .el-form-div{
    display:flex;
    flex-direction:row;
    justify-content:flex-start;
    width: 100%;
  }
  /* 时间线 */
  .timeline-item {
    position: relative;
    min-height: 10px;

    .timeline-box {
      text-align: center;
      position: absolute;

      .out-circle {
        width: 18px;
        height: 18px;
        background: rgba(14, 116, 218, 0.1);
        box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.1);
        /*opacity: 0.1;*/
        border-radius: 50%;
        display: flex;
        align-items: center;

        .in-circle {
          width: 5px;
          height: 5px;
          margin: 0 auto;
          background: rgba(14, 116, 218, 1);
          border-radius: 50%;
          box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.1);
        }
      }

      .long-line {
        width: 1px;
        min-height: 98px;
        background: #20ffff;
        box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.1);
        opacity: 0.5;
        margin-left: 8px;
      }
    }

    .timeline-content {
      box-sizing: border-box;
      min-height: 86px;
      padding: 0 0 0 20px;
      text-align: left;
      margin-bottom: 10px;
      margin-left: 5px;

      .timeline-title {
        font-size: 15px;
        word-break: break-all;
        margin-bottom: 5px;
        color: #000000;
        font-weight: 500;
        /*display: inline;*/
      }

      .timeline-date {
        font-size: 14px;
        color: #000000;
        font-weight: 500;
        margin-bottom: 5px;
      }
      .timeline-desc {
        font-size: 14px;
        color: #000000;
      }
    }

  }

  .dbtn {
    display: inline-block;
    line-height: normal;
    padding-left: 2px;
    padding-right: 2px;
    cursor: pointer;
    border-radius: 3px;
    border-style: solid;
    border-width: 0;
    color: #20FFFF;
  }
  .timeline-item:last-of-type .timeline-content {
    margin-bottom: 0;
  }
  .classType{
    border: 1px solid #1c84c6;
    background: #1c84c6;
    color: white;
    border-radius: 3px;
  }
</style>
