<template>
  <div style="height: 100%;">
    <van-pull-refresh class="inspect-object-wrapper" v-model="loading" @refresh="getData()">
      <card01 v-for="item in list" :key="item" :title="item.ojbNm + ''" icon="notes"
        :description="renderData(item, objectConfig.description)"
        @click="jumpPage(`/inspect/${item.groupId}/object/${item.id}/problems`, { inspectType, object: JSON.stringify(item) })" />
    </van-pull-refresh>
  </div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import card01 from '@/components/card01.vue';
import { getObjectList } from "@/api/inspect";
import { getBaseByInspectType } from "@/assets/js/base";
import { renderData } from "@/utils/template";
import { jumpPage } from "@/utils/page";

const route = useRoute();
const list = ref([]);
const loading = ref(false);
const inspectType = route.query.inspectType;
const objectConfig = ref(getBaseByInspectType(inspectType));


function getData() {
  getObjectList(route.params.id).then(res => {
    list.value = res.data;
    loading.value = false;
  })
}


onMounted(() => {
  getData();
})
</script>
<style lang="scss" scoped>
.inspect-object-wrapper {
  width: 100%;
  height: 100%;
  overflow: auto;
}
</style>
