<template>
  <div style="height: 100%;">
    <van-pull-refresh class="inspect-object-question-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.plnaId}/object/${item.id}/question/`)" />
    </van-pull-refresh>
  </div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import card01 from '@/components/card01.vue';
import { getTacQuestionList } 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() {
  getTacQuestionList(route.params.objId).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>
