<template>
    <album-carousel-item v-if="images" :images="images"></album-carousel-item>
</template>

<script setup>
import { ref, computed, onMounted, onUnmounted } from "vue";
import AlbumDrawBoxItem from "./albumCarouselItem";
import "./cacheImg.js"
import AlbumCarouselItem from "./albumCarouselItem";
import {dateFormat} from "@/utils/date_util.js"

const props =defineProps({
  sampleId:{
    type: [Number, String],
    required: false
  },
  farmId:{
    type: [Number, String],
    required: true
  },
  farmWork:{
    type: Object,
    required: false
  }
})
const images = ref(null);

onMounted(() => {
  let params = {sampleId: props.sampleId,farmId: props.farmId}
  if(props.farmWork?.executeDate){
    let execcuteDate = new Date(props.farmWork.executeDate)
    let beforeExecuteDate = new Date(props.farmWork.beforeExecuteDate)
    const pastDate = new Date(beforeExecuteDate);
    const futureDate = new Date(execcuteDate);
    params.startDate = dateFormat(pastDate, "YY-mm-dd");
    params.endDate = dateFormat(futureDate, "YY-mm-dd");
  }
  VE_API.mini_farm.farmImgList(params).then(res => {
    if(res.code === 0){
      images.value = res.data
    }
  })
});

</script>

<style lang="scss" scoped>
@import "src/styles/index";
</style>
