<template>
  <div class="test-item" v-if="item.typeMasgeLx == '02'" @click="goDetail(item.id, item.typeMasgeLx)">
    <div class="item-header">
      <div class="item-title">{{ item.qbmc || '' }}</div>
      <div class="item-type">{{ informationMap[item.typeMasgeLx] }}</div>
    </div>
    <div class="item-message">{{ item.qbnr }}</div>
    <div class="item-time">{{ item.xtCjsj || '' }}</div>
  </div>
  <div class="test-item" v-if="item.typeMasgeLx == '03'" @click="goDetail(item.id, item.typeMasgeLx)">
    <div class="item-header">
      <div class="item-title">{{ item.bgmc || '' }}</div>
      <div class="item-type">{{ informationMap[item.typeMasgeLx] }}</div>
    </div>
    <div class="item-message" v-html="item.bgnr"></div>
    <div class="item-time">{{ item.xtCjsj || '' }}</div>
  </div>
  <div class="test-item" v-if="item.typeMasgeLx == '04'" @click="goDetail(item.id, item.typeMasgeLx)">
    <div class="item-header">
      <div class="item-title">{{ item.zlbt || '' }}</div>
      <div class="item-type">{{ informationMap[item.typeMasgeLx] }}</div>
    </div>
    <div class="item-message" v-html="item.zlnr"></div>
    <div class="item-time">{{ item.xtCjsj || '' }}</div>
  </div>
  <div class="test-item" v-if="item.typeMasgeLx == '05'" @click="goDetail(item.id, item.typeMasgeLx)">
    <div class="item-header">
      <div class="item-title">{{ item.zlbt || '' }}</div>
      <div class="item-type">{{ informationMap[item.typeMasgeLx] }}</div>
    </div>
    <div class="item-message" v-html="item.zlnr"></div>
    <div class="item-time">{{ item.xtCjsj || '' }}</div>
  </div>
</template>
<script setup>

import { useRouter } from 'vue-router'
const router = useRouter()
const props = defineProps({
  item: {
    type: Object,
    default: () => ({})
  }
})
const informationMap = {
  '01': '报警信息',
  '02': '信息上报',
  '03': '研判审批',
  '04': '研判指令',
  '05': '线索下发',
}
const emit=defineEmits(['goDetail'])
const goDetail = (id, lx) => {
  let path = ''
  switch (lx) {
    case '02':
      path = '/InfoCollection'
      break;
    case '03':
      path = '/strategicResearchs'
      break;
    default:
    case '04':
      path = '/judgmentCommand'
      break;
      case '05':
        path = '/InstructionInformation'
        break;
  }
  router.push({
    path: path,
    query: {
      id: id
    }
  })
}
</script>
<style lang="scss" scoped>
.test-item {
  background: rgba(10, 59, 109, 0.8);
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 255, 255, 0.2);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.4);
    border-color: rgba(0, 255, 255, 0.6);
  }

  &:last-child {
    margin-bottom: 0;
  }
}

.item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.item-title {
  font-size: 14px;
  font-weight: 500;
  color: #00ffff;
  flex: 0 0 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.item-type {
  font-size: 12px;
  font-weight: bold;
  color: #00ffff;
  background: linear-gradient(135deg, #00ffff 0%, #00aaff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex: 1;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.7);
}

.item-message {
  font-size: 14px;
  color: #cceeff;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  margin: 4px 0;
}

.item-time {
  font-size: 12px;
  color: #66ccff;
  text-align: right;
  margin-top: 4px;
  text-shadow: 0 0 3px rgba(0, 255, 255, 0.3);
}
</style>
