<template>
  <div class="app-container">
    <div class="back-btn" @click="handleBack">
      <el-icon><Back /></el-icon>
      返回上一级
    </div>
    <div class="line">
      <div class="title">xxx公交站西侧出现积水倒灌情况</div>
      <div class="flex">
        <el-button type="primary">编辑</el-button>
        <el-button type="primary">开始指挥</el-button>
        <el-button type="danger">关闭事件</el-button>
        <el-button type="danger">删除事件</el-button>
      </div>
    </div>
    <div class="sub-title">基础信息</div>
    <div class="line2">
      <div class="line-item">
        <div class="item-label">事件编号：</div>
        <div class="item-value">YJSJ00000000001</div>
      </div>
      <div class="line-item">
        <div class="item-label">事件类型：</div>
        <div class="item-value">自然灾害</div>
      </div>
      <div class="line-item">
        <div class="item-label">事件等级：</div>
        <div class="item-value">
          特别重大
          <el-icon style="cursor: pointer" @click="handleEventLevelOpen"><Fold /></el-icon>
        </div>
      </div>
      <div class="line-item">
        <div class="item-label">事件状态：</div>
        <div class="item-value">已登记</div>
      </div>
    </div>
    <div class="line2">
      <div class="line-item">
        <div class="item-label">事发地点：</div>
        <div class="item-value link">茂名市茂南区xxxx路道路左侧路面</div>
      </div>
      <div class="line-item">
        <div class="item-label">事发时间：</div>
        <div class="item-value">2024-08-18 17:18</div>
      </div>
      <div class="line-item">
        <div class="item-label">上报时间：</div>
        <div class="item-value">2024-08-18 17:25</div>
      </div>
      <div class="line-item">
        <div class="item-label">伤亡情况：</div>
        <div class="flex">
          <span>未上报</span>
          <span class="link" style="margin-left: 20px">去上报</span>
        </div>
      </div>
    </div>
    <div class="line2">
      <div class="line-item">
        <div class="item-label">登记人：</div>
        <div class="item-value">张三</div>
      </div>
      <div class="line-item">
        <div class="item-label">登记时间：</div>
        <div class="item-value">2024-08-18 17:30</div>
      </div>
      <div class="line-item">
        <div class="item-label">联系方式：</div>
        <div class="item-value">18688888888</div>
      </div>
      <div class="line-item">
        <div class="item-label">事件来源：</div>
        <div class="item-value">110报送</div>
      </div>
    </div>
    <div class="sub-title">事件概要</div>
    <div class="textarea">2024年7月29日14时52分，接xxx报，7月29日12时02分，茂名市xxx公交站西侧出现积水倒灌情况。</div>
    <div class="sub-title">事件跟踪</div>
    <el-steps :active="eventTrackState.active" :align-center="true" style="width: 100%">
      <el-step v-for="(item, index) in eventTrackState.listData" :key="index" :title="item.title" :description="item.description"></el-step>
    </el-steps>
    <div class="sub-title">指挥记录</div>
    <div class="list">
      <div class="list-item">
        <i class="img"></i>
        <div class="item-title">大屏指挥记录</div>
      </div>
      <div class="list-item">
        <i class="img"></i>
        <div class="item-title">中屏指挥记录</div>
      </div>
    </div>
    <div class="sub-title">匹配预案</div>
    <div class="list">
      <div class="list-item2">预案名称11111111</div>
    </div>
    <div class="sub-title">事件总结报告</div>
    <div class="list2">
      <div class="list-item">
        <div class="link">关于X市X镇XXX公交站西侧出现积水倒灌事故报告.pdf</div>
        <el-icon class="icon"><Download /></el-icon>
      </div>
    </div>
    <el-dialog v-model="eventLevelState.show" title="事件等级" width="500" :before-close="handleEventLevelClose">
      <el-timeline>
        <el-timeline-item
          v-for="(item, index) in eventLevelState.data"
          :key="index"
          :timestamp="item.timestamp + '&nbsp;&nbsp;&nbsp;&nbsp;' + item.name"
          placement="top"
        >
          <div>
            <dict-tag :options="mm_event_level" :value="item.levelStatus" />
          </div>
        </el-timeline-item>
      </el-timeline>
    </el-dialog>
  </div>
</template>

<script lang="ts" setup>
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { mm_event_level } = toRefs<any>(proxy?.useDict('mm_event_level'));
// 事件等级数据
const eventLevelState = reactive({
  show: false,
  data: []
});
const handleEventLevelOpen = () => {
  eventLevelState.show = true;
  eventLevelState.data = [
    {
      timestamp: '2024/7/1 09:00:09',
      name: '张佳佳',
      levelStatus: '4'
    },
    {
      timestamp: '2024/7/1 09:00:09',
      name: '张佳佳',
      levelStatus: '3'
    },
    {
      timestamp: '2024/7/1 09:00:09',
      name: '张佳佳',
      levelStatus: '2'
    },
    {
      timestamp: '2024/7/1 09:00:09',
      name: '张佳佳',
      levelStatus: '1'
    }
  ];
};
const handleEventLevelClose = () => {
  eventLevelState.show = false;
};

// 事件跟踪数据
const eventTrackState = reactive({
  active: 2,
  listData: [
    {
      title: '事件登记',
      description: '3月01日17：30'
    },
    {
      title: '进入指挥',
      description: '3月01日17：30'
    },
    {
      title: '结束指挥',
      description: ''
    },
    {
      title: '关闭事件',
      description: ''
    }
  ]
});
// 返回上一级
const handleBack = () => {
  router.go(-1);
};
</script>

<style lang="scss" scoped>
.app-container {
  .line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 15px;
    .title {
      font-weight: bold;
      font-size: 24px;
    }
  }
  .sub-title {
    font-size: 18px;
    font-weight: bold;
    line-height: 35px;
    margin-top: 20px;
  }
  .line2 {
    display: flex;
    align-content: center;
    .line-item {
      flex: 1;
      font-size: 16px;
      line-height: 35px;
      display: flex;
      .item-label {
        width: 80px;
      }
    }
  }
  .textarea {
    background-color: #f2f2f2;
    padding: 10px;
    width: 100%;
    min-height: 83px;
  }
  .list {
    display: flex;
    .list-item {
      display: flex;
      flex-direction: column;
      align-content: center;
      justify-content: center;
      margin-right: 40px;
      cursor: pointer;
      .img {
        width: 180px;
        height: 90px;
        background-color: #cccccc;
      }
      .item-title {
        text-align: center;
        margin-top: 6px;
      }
      &:last-child {
        margin-right: 0;
      }
    }
    .list-item2 {
      margin-right: 40px;
      cursor: pointer;
      &:last-child {
        margin-right: 0;
      }
    }
  }
  .list2 {
    .list-item {
      display: flex;
      align-items: center;
      .icon {
        margin-left: 10px;
        cursor: pointer;
      }
    }
  }
  .link {
    color: #2598ff;
    cursor: pointer;
  }
}
:deep(.warning2) {
  background-color: #fdfbe2;
  border-color: #fad400 !important;
  color: #fad400;
}
.back-btn {
  cursor: pointer;
}
</style>
