<template>
    <div class="content-wrapper">
        <div class="filter-wrapper">
            <gw-select :columns="inspectTypes" v-model:value="inspectType" />
        </div>
        <van-pull-refresh class="inspect-group-wrapper" v-model="loading" @refresh="onLoad()">
            <card01 v-for="item in list" :key="item" :title="item.prsnTitle + ''" icon="notes"
                :description="`时间：${item.sttm} 至 ${item.entm}`"
                @click="jumpPage(`/inspect/${item.plnaId}/objects`, { inspectType })" />
        </van-pull-refresh>
    </div>
</template>
<script setup>
import {defineEmits, ref, watch} from "vue";
import GwSelect from "@/components/GwSelect.vue";
import card01 from '@/components/card01.vue';
import {getCurrGroup} from '@/api/inspect.js';
import {jumpPage} from "@/utils/page";

const emits = defineEmits(['onClick']);

const inspectTypes = [
  {text: '稽察工作', value: '008'},
];
const inspectType = ref('008');
const list = ref([]);
const loading = ref(false);
const finished = ref(false);

function onLoad() {
    getCurrGroup(inspectType.value).then(res => {
        list.value = res.data;
        loading.value = false;
        finished.value = true;
    })
}

watch(() => inspectType, inspectType => {
    if (inspectType.value) {
        onLoad()
    }
})
</script>
<style lang="scss" scoped>
@import '@/assets/styles/filter.scss';

.content-wrapper {
    padding-top: 8px;
    height: 100%;
    overflow: auto;

    .inspect-group-wrapper {
        height: calc(100% - 35px);
        overflow: auto;
    }

}
</style>
