<template>
  <van-swipe-cell>
    <div class="XFItem-box">
      <div class="time"><van-icon name="clock-o" />{{props.data.xfsj}}</div>
      <div class="text">巡防主责人：<span class="mess">{{props.data.xfzzXm}}</span></div>
      <div class="text">巡防商铺：
        <span class="mess">
          <span class="tag" v-for="it in props.data.xfdw" :key="it.id" style="margin:0 4px;">{{it.dwmc}}</span>
        </span>
      </div>
      <div class="text">巡防类型：
        <span class="mess">{{ setDict(props.data.xflx, props.dic.D_BZ_XFLX) }}</span></div>
      <div class="text text_detail">
        巡防内容：<span class="mess">{{props.data.xfnr}}</span>
      </div>
    </div>
    <template #right>
        <van-button style="height:100%;width:60px;" type="primary" @click="gotoEdit">编辑</van-button>
        <van-button style="height:100%;width:60px;" type="danger" @click="deleteItem">删除</van-button>
    </template>
  </van-swipe-cell>
</template>

<script setup>
import { setDict } from "../../../../utils/dict";
import { useRouter } from "vue-router";
import { ref, onMounted, reactive, defineEmits,defineProps } from "vue";
const emits = defineEmits(['deletedata'])
const router = useRouter();
const props = defineProps({
  data:{
    type:Object,
    default:{}
  },
  dic:{
    type:Object,
    default:{}
  }
});

// 编辑
function gotoEdit(){
  localStorage.setItem('XF_Active',2)
  router.push({path: "/Declaration/addEditRw", query: {id:props.data.id}});
}
// 删除
function deleteItem(){
  emits('deletedata',props.data.id)
}
</script>

<style lang="scss" scoped>
.XFItem-box {
  padding: 3vw 4vw;
  box-sizing: border-box;
  background-color: #f6fafd;
  position: relative;
  .time {
    font-size: 16px;
    line-height: 5vw;
    .van-icon-clock-o {
      margin-right: 2vw;
      font-size: 16px;
    }
  }
  .text {
    color: #9f9f9f;
    line-height: 6vw;
    .mess {
      color: #000;
    }
  }
}
.tag{
  border: 1px solid #5e9fdd;
  border-radius: 4px;
  font-size: 14px;
  color: #409eff;
  padding: 1px 4px;
}
</style>