<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="emits('onClick', item.prsnId)" />
        </van-pull-refresh>
    </div>
</template>
<script setup>
import { ref, defineEmits, watch } from "vue";
import GwSelect from "@/components/GwSelect.vue";
import card01 from '@/components/card01.vue';
import { getCurrGroup } from '@/api/inspect.js';

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>