<template>
    高校列表页
    <el-table :data="tableData">
        <el-table-column label="地区" align="center" key="areaname" prop="areaname"/>
        <el-table-column label="名称" align="center" key="name" prop="name"/>
        <el-table-column label="隶属" align="center" key="subjection" prop="subjection"/>
        <el-table-column label="创建时间" align="center" key="ctime" prop="ctime"/>
        <el-table-column label="详情">
            <template #default="scope">
                <el-tooltip content="详情>>" placement="top">
                    <el-button link type="primary" icon="Edit" @click="handleDetail(scope.row)"></el-button>
                </el-tooltip>
            </template>
        </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
                v-model:limit="queryParams.pageSize" @pagination="getList"/>
</template>

<script setup>
    import {universityList} from '@/api/xjc-integratedmachine/environment/university.js'
    const router = useRouter()
    const route = useRoute()

    const params = route.query

    const total = ref(0)
    const tableData = ref(null)


    // const queryParams = ref({
    //     pageNum: 1,
    //     pageSize: 10,
    //     areaid: params.areaid,
    //     educationlevel: params.educationlevel,
    //     characteristic: params.characteristic,
    // })

    const data = reactive({
        queryParams: {
            pageNum: 1,
            pageSize: 10,
            areaid: params.areaid,
            educationlevel: params.educationlevel,
            characteristic: params.characteristic,
        },
    })
    const {proxy} = getCurrentInstance()
    const {queryParams} = toRefs(data)




    function getList() {
        universityList(proxy.addDateRange(queryParams.value)).then(resp => {
            tableData.value = resp.data.rows
            total.value = resp.data.total
        })
    }

    function handleDetail(row) {
        router.push({
            path : '/xjc-integratedmachine/environment/university_details_video',
            query : {
                id : row.id,
                name : row.name,
                oldid : row.oldid,
            }
        })

    }

    getList()


</script>

<style scoped>

</style>
