<template>
    <el-card style="margin-top:12px" class="simulation-add-add-step2">
        <template #header>模型列表</template>

        <el-table v-loading="loading" :data="tableData" stripe @row-click="doRowClick">
            <el-table-column align="center" width="55" label="选择">
                <template #default="scope">
                    <el-radio v-model="modelSelection" :label="scope.row.id + ''"
                        @change="handleChange(scope.row)">&nbsp;</el-radio>
                </template>
            </el-table-column>
            <el-table-column label="模型名称" align="left" prop="name" />
            <el-table-column label="模型类型" align="left" prop="modelType" />
            <el-table-column label="模型说明" align="left" prop="netName" width="120" />

            <el-table-column label="版本" align="left" prop="ver" />
            <el-table-column label="互联名称" align="left" prop="netName" width="120" />
            <el-table-column label="互联说明" align="left" prop="desc" />
            <el-table-column label="互联创建时间" width="120" align="left" prop="upTime" />

        </el-table>
        <pagination v-if="total > 0" v-model:total="total" v-model:page="queryParams.pageNum"
            v-model:limit="queryParams.pageSize" @pagination="handleQuery" />
    </el-card>
</template>

<script setup>

const modelSelection = ref("")//单选id
const queryParams = reactive({
  pageNum: 1,
  pageSize: 10,
});
const total=ref(100)

const handleChange = (row) => {
    modelSelection.value = row.id + "";
}
const doRowClick=(row)=>{
    modelSelection.value=row.id+"";
}
/** 查询 */
function handleQuery(a) {
  queryParams.pageSize=a.limit;  
  ElMessage.success("查询成功");
  loading.value = false;
  
}
const tableData = [
    {
        id: "1",
        name: "模型名称模型名称模型名称查看1",
        modelType: "图像分类",
        ver: "1.0",
        netName: '我的互联名称',
        desc: '进行10种类型 的目标分类模型查看',
        upTime: "2024-02-02",
        upUser: 'USER',
        state: '1'
    },
    {
        id: "2",
        name: "模型名称模型名称模型名称查看2",
        modelType: "图像分类",
        ver: "1.0",
        netName: '我的互联名称',
        desc: '进行10种类型 的目标分类模型查看',
        upTime: "2024-02-02",
        upUser: 'USER',
        state: '1'
    },
    {
        id: "3",
        name: "模型名称模型名称模型名称查看3",
        modelType: "图像分类",
        ver: "1.0",
        netName: '我的互联名称',
        desc: '进行人员检测的模型',
        upTime: "2024-02-02",
        upUser: 'USER',
        state: '1'
    },
    {
        id: "4",
        name: "模型名称模型名称模型名称查看4",
        modelType: "图像分类",
        ver: "1.0",
        netName: '我的互联名称',
        desc: '进行10种类型 的目标分类模型查看',
        upTime: "2024-02-02",
        upUser: 'USER',
        state: '0'
    },
    {
        id: "5",
        name: "模型名称模型名称模型名称查看5",
        modelType: "图像分类",
        ver: "1.0",
        netName: '我的互联名称',
        desc: '进行人员检测的模型',
        upTime: "2024-02-02",
        upUser: 'USER',
        state: '0'
    }
];
const checkForm=()=>{
    if(modelSelection.value){
        let tmps=tableData.filter(d=>d.id==modelSelection.value);
        return tmps.length>0?tmps[0]:null;
    }
    return null;
};
defineExpose({
    checkForm
})

</script>
<style lang='scss'></style>