<template>
  <div class="list_box">
    <div class="time_box">
      <span>
        <van-icon name="clock-o" />
        &ensp;{{ item.pcsj }}
      </span>
      <span v-if="item.pcclJg">
        <van-tag type="danger" style="padding: 0.3vw 5vw; border-radius: 3vw" v-if="item.pcclJg == '9'">盘查</van-tag>
        <van-tag type="warning" style="padding: 0.3vw 5vw; border-radius: 3vw" v-else-if="item.pcclJg == '2'">移交
        </van-tag>
        <van-tag color="#ffcc40" style="padding: 0.3vw 5vw; border-radius: 3vw" v-else-if="item.pcclJg == '1'">放行
        </van-tag>
      </span>
    </div>
    <div class="detail_box">
      <van-image width="80px" :src="baseUrl" @click="onClickImg(baseUrl)" style="flex: 1" v-if="baseUrl && item.sfzh">
        <template v-slot:loading>
          <van-loading type="spinner" size="20" />
        </template>
      </van-image>
      <div class="detail_item">
        <div class="item user_info">
          <span v-if="item.yjClcph">{{ item.yjClcph }}</span>
          <span>{{ item.xm }}</span>
          <span v-if="item.mz">{{ item.mz }}</span>
          <span>{{ item.sfzh }}</span>
        </div>
        <div class="item" v-if="item.bqmc || item.bqxxsj">
          <van-tag type="primary" style="padding: 0 2vw; margin-right: 2vw" plain>
            {{ item.bqmc == "" ? "无标签人员" : item.bqxxsj }}
          </van-tag>
        </div>
        <div class="item">{{ item.pcmjXm }}</div>
        <div class="item">管辖派出所：{{ item.ssbm }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import router from "../router/index.js";
import { getBase64 } from "../utils/tools.js";
import { defineProps, ref, watch } from "vue";
import { getDictList, setDict } from "../utils/dict";
import { ImagePreview } from "vant";
const props = defineProps({
  item: Object, //列表内容
  path: String, //跳转详情的路由
  dict: {
    type: Object,
    default: {
      D_BZ_YJLX: [],
      D_BZ_TYJB: [],
      D_BZ_PCCLJG: [],
    },
  },
});
const baseUrl = ref("");
watch(
  () => props.item,
  (newValue) => {
    if (Object.keys(newValue).length > 0) _getBase64(newValue);
  },
  { immediate: true, deep: true }
);
//预览图片
function onClickImg(url) {
  ImagePreview([url]);
}
//获取base64地址
function _getBase64(item) {
  getBase64((res) => {
    baseUrl.value = res;
  }, `http://10.64.201.128:2366/xlpcAdminNew/requestservice/czrk/ryxp.jpg?sfzh=${item.sfzh}`);
}
</script>
<style lang="scss" scoped>
@import "../assets/styles/mixin.scss";

.list_box {
  @include font_size($font_medium_s);
  @include font_color($font-color-theme);
  margin: 0vw 2vw 2vw 2vw;
  padding: 2vw 1vw;
  @include item_bottom_color($bottom-border-top-clore-theme);

  .time_box {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .count_size {
      font-size: 5vw;
      display: inline-block;
      margin: 0 1vw;
      color: red;
    }
  }
}

.list_box:nth-child(1) {
  border-top: none !important;
}

.detail_box {
  margin-top: 1vw;
  display: flex;
  position: relative;

  .detail_item {
    flex: 3.5;
    margin-left: 2vw;

    .user_info {
      @include font_size($font_medium);
      font-weight: 600;
      color: #507ce9;

      &>span {
        display: inline-block;
        margin-right: 2vw;
      }
    }

    .item {
      line-height: 6vw;
    }
  }
}

::v-deep .van-image__img {
  height: auto;
  max-height: 101px;
}
</style>
