<template>
  <van-swipe-cell>
    <div class="XFItem-box">
      <!-- <div class="item-tip" :class="changeBq(props.data.lx)">{{props.data.ztmc}}</div> -->
      <div class="time"><van-icon name="clock-o" />{{props.data.sbsj}}</div>
      <div class="text">申报类型：<span class="mess">{{ setDict(props.data.sblx, props.dic.D_SB_SBLX) }}</span></div>
      <div class="text text_detail">
        申报内容：<span class="mess">{{props.data.sbyy}}</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 { useRouter } from "vue-router";
import { setDict } from "../../../../utils/dict";
import { ref, onMounted, reactive, defineEmits,defineProps } from "vue";
const emits = defineEmits(['deletedata'])
const router = useRouter();
const props = defineProps({
   data:{
       type:Object,
       default:{lx:0}
   } ,
   dic:{
     type:Object,
     default:{}
   }
});
// 标签
function changeBq(val){
    switch(val){
        case 0:
            return 'orange';
        break;
        case 1:
            return 'green';
        break;
        case 2:
            return 'red';
        break;
        case 3:
            return 'blue';
        break;
        default:
            return 'blue';
    }

}
// 编辑
function gotoEdit(){
  localStorage.setItem('XF_Active',3)
  router.push({path: "/Declaration/addEdit", 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;
    }
  }
  .item-tip {
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 26px;
    color: #fff;
    text-align: center;
    line-height: 26px;
    font-size: 14px;
  }
  .red {
    background: url("../../../../assets/images/red.png") no-repeat;
  }
  .green {
    background: url("../../../../assets/images/green.png") no-repeat;
  }
  .blue {
    background: url("../../../../assets/images/blue.png") no-repeat;
  }
  .orange {
    background: url("../../../../assets/images/orange.png") no-repeat;
  }
}
</style>