<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="140px">
            <el-form-item label="临时学号" prop="临时学号报到后给新的">
                <el-input v-model="queryParams.临时学号报到后给新的" placeholder="请输入临时学号" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="教务系统班级编号" prop="教务系统班级编号">
                <el-input v-model="queryParams.教务系统班级编号" placeholder="请输入教务系统班级编号" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>

            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>

                <el-button type="success" icon="el-icon-sort" size="mini" @click="syncClassCode">同步班级代码到新生信息</el-button>
            </el-form-item>
        </el-form>

        <el-table :data="tableData" border style="width: 100%"
            :header-cell-style="{ background: '#f5f7fa', fontWeight: 'bold' }">
            <el-table-column prop="临时学号报到后给新的" label="临时学号(报到后给新的)" width="180"></el-table-column>
            <el-table-column prop="姓名" label="姓名" width="120"></el-table-column>
            <el-table-column prop="性别" label="性别" width="80"></el-table-column>
            <el-table-column prop="出生日期字符串" label="出生日期" width="140"></el-table-column>
            <el-table-column prop="民族代码" label="民族代码" width="120"></el-table-column>
            <el-table-column prop="民族名称" label="民族名称" width="120"></el-table-column>
            <el-table-column prop="政治面貌代码" label="政治面貌代码" width="140"></el-table-column>
            <el-table-column prop="政治面貌名称" label="政治面貌名称" width="140"></el-table-column>
            <el-table-column prop="教务系统所属院系" label="所属院系" width="160"></el-table-column>
            <el-table-column prop="教务系统年度专业代码" label="年度专业代码" width="160"></el-table-column>
            <el-table-column prop="教务系统专业名称" label="专业名称" width="160"></el-table-column>
            <el-table-column prop="教务系统班级编号" label="班级编号" width="140"></el-table-column>
            <el-table-column prop="班级名称" label="班级名称" width="180"></el-table-column>
            <el-table-column prop="班级简称" label="班级简称" width="100"></el-table-column>
            <el-table-column prop="是否报到核验" label="是否报到核验" width="140"></el-table-column>
            <el-table-column prop="报到核验时间" label="报到核验时间" width="160"></el-table-column>
            <el-table-column prop="学号" label="学号" width="140"></el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getList" />
    </div>
</template>
<script>

import { listXsxxTemp, syncClassCode } from "@/api/stureg/temp";
import { fullLoading } from "@/api/helpFunc/index";

export default {
    name: "Temp",
    data() {
        return {
            total: 0,
            tableData: [],
            queryParams: {
                pageNum: 1,
                pageSize: 10,

            },
        };
    },
    created() {
        this.getList();
    },
    mounted() { },
    methods: {
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
        async getList() {
            let loading = fullLoading(this);
            let res = await listXsxxTemp(this.queryParams);
            loading.close();
            if (res.code == 200) {
                this.tableData = [...res.rows];
                this.total = res.total;
            }
        },

        async syncClassCode() {
            let loading = fullLoading(this);
            let res = await syncClassCode();
            loading.close();
            if (res.code == 200) {
                this.$message.success("同步成功");
            } else {
                this.$message.error(res.msg);
            }
        }
    },
};

</script>