<template>
    <div class="app-container">
        <el-dialog title="查询" :visible.sync="query" width="50%" append-to-body>
            <el-form ref="queryParams" :model="queryParams" label-width="96px" class="search">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="任教学科" prop="teachingSubject">
                            <el-select v-model="queryParams.teachingSubject" clearable placeholder="请选择"
                                style="width: 100%">
                                <el-option v-for="dict in dict.type.teaching_subjects" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="姓名" prop="name">
                            <el-input v-model="queryParams.name" placeholder="请输入姓名" clearable
                                @keyup.enter.native="handleQuery" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="性别" prop="sex">
                            <el-select v-model="queryParams.sex" placeholder="请选择" clearable style="width: 100%">
                                <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
                                    :value="dict.value" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="出生年月" prop="birthDate">
                            <el-input v-model="queryParams.birthDate" clearable placeholder="请输入"></el-input>

                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row>
                    <el-col :span="12">
                        <el-form-item label="政治面貌" prop="politicalLandscape">
                            <el-select v-model="queryParams.politicalLandscape" clearable placeholder="请选择政治面貌"
                                style="width: 100%">
                                <el-option v-for="dict in dict.type.politics_tatusls" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="参加工作时间" prop="workingHours">
                            <el-date-picker clearable v-model="queryParams.workingHours" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="现职称" prop="currentProfessionalTitle">
                            <el-select v-model="queryParams.currentProfessionalTitle" clearable placeholder="请选择"
                                style="width: 100%">
                                <el-option v-for="dict in dict.type.current_professional" :key="dict.value"
                                    :label="dict.label" :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="在岗情况" prop="onDutySituation">
                            <el-select v-model="queryParams.onDutySituation" clearable placeholder="请选择"
                                style="width: 100%">
                                <el-option v-for="dict in dict.type.duty_situation" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="毕业院校" prop="graduationInstitution1">
                            <el-input v-model="queryParams.graduationInstitution1" placeholder="请输入毕业院校" clearable
                                @keyup.enter.native="handleQuery" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="学历" prop="firstDegree">
                            <el-input v-model="queryParams.firstDegree" placeholder="请输入学历" clearable
                                @keyup.enter.native="handleQuery" />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer" style="display: flex; justify-content: center; align-items: center">
                <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>
            </div>
        </el-dialog>
        <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-search" size="mini" @click="handleQuerycx">查询</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
                    v-hasPermi="['system:student:add']">新增
                </el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="single" @click="handleDelete"
                    v-hasPermi="['system:student:remove']">删除
                </el-button>
            </el-col>
            <el-col :offset="1" :span="1.5">
                <el-button type="success" plain icon="el-icon-upload" size="mini" @click="handleImport"
                    v-hasPermi="['system:student:import']">导入
                </el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['system:student:export']">导出
                </el-button>
            </el-col>
            <el-col :span="1.5">
                <el-upload v-loading="uploadFileLoading" class="upload-demo" action="#" :show-file-list="false"
                    :before-upload="beforeFileUpload" :http-request="uploadFiles" accept=".zip">
                    <el-button size="mini" type="success" plain icon="el-icon-upload">照片导入</el-button>
                </el-upload>
            </el-col>
        </el-row>
        <el-table :data="informationList" @selection-change="handleSelectionChange"
            :default-sort="{ prop: 'toSecondMiddleSchoolTime', order: 'descending' }" :row-style="{ height: '1px' }"
            :cell-style="{ padding: '0px' }" :header-cell-style="{ height: '0px', fontSize: '12px', padding: '0 0' }">
            <el-table-column type="selection" width="30" align="center" />
            <el-table-column type="index" label="序号" width="30" align="center" fixed="left" />
            <el-table-column label="姓名" align="center" prop="name" width="100" sortable fixed="left"
                show-overflow-tooltip />
            <el-table-column label="性别" width="55" align="center" prop="sex" sortable fixed="left" show-overflow-tooltip>
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />
                </template>
            </el-table-column>
            <el-table-column label="年龄" width="55" align="center" prop="age" sortable fixed="left" show-overflow-tooltip />
            <el-table-column label="档案年龄" align="center" prop="fileAge" sortable />
            <el-table-column label="政治面貌" align="center" prop="politicalLandscape" sortable show-overflow-tooltip>
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.politics_tatusls" :value="scope.row.politicalLandscape" />
                </template>
            </el-table-column>
            <el-table-column label="档案生日" align="center" prop="fileBirthDate" sortable show-overflow-tooltip>
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.fileBirthDate, "{y}-{m}-{d}") }}</span>
                </template>
            </el-table-column>
            <el-table-column label="到市二中工作时间" width="80" align="center" prop="toSecondMiddleSchoolTime" sortable
                show-overflow-tooltip />
            <el-table-column label="到市二中工作年限" width="70" align="center" prop="toSecondAge" sortable show-overflow-tooltip />
            <el-table-column label="现职称" align="center" prop="currentHiringProfessionalTitle" sortable
                show-overflow-tooltip>
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.current_professional" :value="scope.row.currentHiringProfessionalTitle" />
                </template>
            </el-table-column>
            <el-table-column label="毕业院校" align="center" prop="graduationInstitution3" sortable show-overflow-tooltip />
            <el-table-column label="学历" width="75px" align="center" prop="lastDegree" sortable show-overflow-tooltip />
            <el-table-column label="在岗情况" align="center" prop="onDutySituation" sortable show-overflow-tooltip
                width="100px">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.duty_situation" :value="scope.row.onDutySituation" />
                </template>
            </el-table-column>
            <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="120px">
                <template slot-scope="scope">
                    <el-button v-hasPermi="['system:student:edit']" size="mini" type="text"
                        @click="handleUpdate(scope.row)">修改</el-button>
                    <el-button v-hasPermi="['system:student:look']" size="mini" type="text"
                        @click="handleLook(scope.row)">详情</el-button>
                    <el-button v-hasPermi="['system:student:remove']" size="mini" type="text"
                        @click="handleDelete(scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />
        <!-- 导入对话框 -->
        <el-dialog :title="title" :visible.sync="uploadOpen" width="520px" append-to-body inline @close="cancel">
            <el-form ref="uploadForm" :model="uploadForm" :rules="rules" label-width="70px">
                <el-form-item prop="dataUrl">
                    <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
                        :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
                        :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
                        <i class="el-icon-upload"></i>
                        <div class="el-upload__text">
                            将文件拖到此处，或<em>点击上传</em>
                        </div>
                        <div class="el-upload__tip text-center" slot="tip">
                            <span>仅允许导入xls、xlsx格式文件。</span>
                            <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
                                @click="importTemplate">下载模板
                            </el-link>
                        </div>
                    </el-upload>
                </el-form-item>
            </el-form>
            <div class="mask" v-if="importing">
                <div class="mask-content">
                    <i class="el-icon-loading"></i>
                    <span>正在导入，请稍候...</span>
                </div>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitFileForm">确 定</el-button>
                <el-button @click="cancelFile">取 消</el-button>
            </div>
        </el-dialog>
        <!-- 添加对话框 -->
        <el-dialog class="addForm" :title="title" :visible.sync="open" width="80%">
            <el-form ref="form" :model="form" :rules="rules" label-width="138px">
                <el-row type="flex" justify="space-between">
                    <el-col :span="16">
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="姓名" prop="name">
                                <el-input v-model="form.name" placeholder="请输入姓名" clearable></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="身份证号" prop="idCard">
                                <el-input v-model="form.idCard" @blur="handleIdCardBlur" maxlength="18" placeholder="请输入"
                                    clearable style="width: 190px;"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="档案出生日期" prop="fileBirthDate">
                                <el-date-picker v-model="form.fileBirthDate" placeholder="选择日期" style="width: 100%;"
                                    clearable type="month" value-format="yyyy-MM"></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="籍贯" prop="hometown">
                                <el-input v-model="form.hometown" placeholder="请输入籍贯" clearable
                                    style="width: 190px;"></el-input>
                            </el-form-item>
                        </el-col>
                        <!-- <el-col :span=" 12" class="custom-margin"> -->
                        <!-- <el-form-item label="出生年月" prop="birthDate">
                                <el-date-picker clearable v-model="form.birthDate" type="date" value-format="yyyy-MM-dd"
                                    placeholder="请选择" :style="{ width: '100%' }">
                                </el-date-picker>
                            </el-form-item> -->
                        <!-- </el-col> -->
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="民族" prop="nation">
                                <el-input v-model="form.nation" placeholder="请输入民族" clearable></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="政治面貌" prop="politicalLandscape">
                                <el-select v-model="form.politicalLandscape" style="width: 190px;" placeholder="请选择">
                                    <el-option v-for="dict in dict.type.politics_tatusls" clearable :key="dict.value"
                                        :label="dict.label" :value="dict.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="入党时间" prop="partyMembershipTime">
                                <el-date-picker clearable v-model="form.partyMembershipTime" type="month"
                                    value-format="yyyy-MM" placeholder="请选择" :style="{ width: '100%' }">
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="任教学科" prop="teachingSubject">
                                <el-select v-model="form.teachingSubject" style="width: 190px;" placeholder="请选择" clearable>
                                    <el-option v-for="dict in dict.type.teaching_subjects" :key="dict.value"
                                        :label="dict.label" :value="dict.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col><el-col :span="12" class="custom-margin">
                            <el-form-item label="现职称" prop="currentProfessionalTitle">
                                <el-select v-model="form.currentProfessionalTitle" style="width: 100%" placeholder="请选择"
                                    clearable>
                                    <el-option v-for="dict in dict.type.current_professional" :key="dict.value"
                                        :label="dict.label" :value="dict.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col><el-col :span="12" class="custom-margin">
                            <el-form-item label="现职称取得资格时间" prop="currentProfessionalTitleTime">
                                <el-date-picker clearable v-model="form.currentProfessionalTitleTime" type="date"
                                    value-format="yyyy-MM-dd" placeholder="请选择" style="width: 190px;">
                                </el-date-picker>
                            </el-form-item>
                        </el-col>

                    </el-col>
                    <el-col :span="6" class="custom-margin">
                        <el-card style="
                height: 180px;
                width: 200px;
                display: flex;
                align-items: center;
                justify-content: center;
                margin-bottom: 10px;
              ">
                            <el-upload v-loading="uploadLoading" class="avatar-uploader" action="#" accept="image/*"
                                :show-file-list="false" :on-success="handleAvatarSuccess"
                                :before-upload="beforeAvatarUpload" :http-request="uploadImage">
                                <img v-if="form.photoUrl" :src="baseUrl + form.photoUrl"
                                    style="max-width: 100%; max-height: 100%" class="avatar" alt="" />
                                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                            </el-upload>
                        </el-card>
                    </el-col>
                </el-row>
                <el-row :gutter="6" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现聘职称" prop="currentHiringProfessionalTitle">
                            <el-select clearable v-model="form.currentHiringProfessionalTitle" style="width: 100%"
                                placeholder="请选择">
                                <el-option v-for="dict in dict.type.current_professional" :key="dict.value"
                                    :label="dict.label" :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现职称聘任时间" prop="currentHiringProfessionalTitleTime">
                            <el-date-picker clearable v-model="form.currentHiringProfessionalTitleTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" style="width: 190px;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">

                    </el-col>
                </el-row>
                <el-row :gutter="6" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现聘岗位" prop="currentPosition">
                            <el-select v-model="form.currentPosition" style="width:100%;" placeholder="请选择" clearable>
                                <el-option v-for="dict in dict.type.current_position" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现岗位等级" prop="currentJobLevel">
                            <el-select v-model="form.currentJobLevel" style="width: 190px;" placeholder="请选择" clearable>
                                <el-option v-for="level in filteredJobLevels" :key="level.value" :label="level.label"
                                    :value="level.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现岗位等级聘任时间" prop="currentJobLevelAppointmentTime">
                            <el-date-picker clearable v-model="form.currentJobLevelAppointmentTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="6" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="职务" prop="duties">
                            <el-input v-model="form.duties" clearable placeholder="请输入" style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="教师资格种类" prop="teacherQualificationType">
                            <el-input v-model="form.teacherQualificationType" clearable placeholder="请输入"
                                style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="教师资格证号码" prop="teacherQualificationCertificateNum">
                            <el-input v-model="form.teacherQualificationCertificateNum" clearable placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="6" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="参加工作时间" prop="workingHours">
                            <el-date-picker clearable v-model="form.workingHours" type="date" value-format="yyyy-MM-dd"
                                placeholder="请选择" style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="到二中工作时间" prop="toSecondMiddleSchoolTime">
                            <el-date-picker clearable v-model="form.toSecondMiddleSchoolTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" style="width: 190px;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="教龄起算时间" prop="lengthOfTeacherTime">
                            <el-date-picker clearable v-model="form.lengthOfTeacherTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="工龄起算时间" prop="lengthOfServiceTime">
                            <el-date-picker clearable v-model="form.lengthOfServiceTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="在岗情况" prop="onDutySituation">
                            <el-select v-model="form.onDutySituation" clearable style="width: 190px;" placeholder="请选择">
                                <el-option v-for="dict in dict.type.duty_situation" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="在编情况" prop="currentSituation">
                            <el-select v-model="form.currentSituation" clearable style="width: 100%" placeholder="请选择">
                                <el-option v-for="dict in dict.type.current_situation" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业院校1" prop="graduationInstitution1">
                            <el-input v-model="form.graduationInstitution1" clearable placeholder="请输入"
                                style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="专业1" prop="major1">
                            <el-input v-model="form.major1" placeholder="请输入" clearable style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业时间1" prop="graduationTime1">
                            <el-date-picker clearable v-model="form.graduationTime1" type="month" value-format="yyyy-MM"
                                placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业院校2" prop="graduationInstitution2">
                            <el-input v-model="form.graduationInstitution2" placeholder="请输入" clearable
                                style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="专业2" prop="major2">
                            <el-input v-model="form.major2" placeholder="请输入" clearable style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业时间2" prop="graduationTime2">
                            <el-date-picker clearable v-model="form.graduationTime2" type="month" value-format="yyyy-MM"
                                placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业院校3" prop="graduationInstitution3">
                            <el-input v-model="form.graduationInstitution3" placeholder="请输入" clearable
                                style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="专业3" prop="major3">
                            <el-input v-model="form.major3" placeholder="请输入" clearable style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业时间3" prop="graduationTime3">
                            <el-date-picker clearable v-model="form.graduationTime3" type="month" value-format="yyyy-MM"
                                placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="第一学历" prop="firstDegree">
                            <el-input v-model="form.firstDegree" placeholder="请输入" clearable style="width: 100%;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="最后学历" prop="lastDegree">
                            <el-input v-model="form.lastDegree" placeholder="请输入" clearable style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="学位" prop="degree">
                            <el-input v-model="form.degree" placeholder="请输入" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="工作经历" prop="workExperience">
                            <el-input v-model="form.workExperience" placeholder="请输入" clearable style="width: 100%" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="钉钉手机号" prop="ddPhone">
                            <el-input v-model="form.ddPhone" placeholder="请输入" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="24" class="custom-margin">
                        <el-form-item label="备注" prop="remark">
                            <el-input v-model="form.remark" placeholder="请输入" clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer custom-evenly">
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
        </el-dialog>
        <!-- 查看对话框 -->
        <el-dialog class="editForm" title="详细信息" :visible.sync="look" width="80%" append-to-body>
            <el-form ref="form" :model="form" :rules="rules" label-width="138px">
                <el-row type="flex" justify="space-between">
                    <el-col :span="16">
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="姓名" prop="name">
                                <el-input v-model="form.name" placeholder="请输入"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="身份证号" prop="idCard">
                                <el-input v-model="form.idCard" @blur="handleIdCardBlur" maxlength="18" placeholder="请输入"
                                    clearable style="width: 190px;"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="年龄" prop="age">
                                <el-input v-model="form.age" placeholder="请输入" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="性别" prop="sex">
                                <el-select v-model="form.sex" placeholder="请选择" style="width: 190px;">
                                    <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
                                        :value="dict.value"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>

                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="档案出生日期" prop="fileBirthDate">
                                <el-date-picker v-model="form.fileBirthDate" placeholder="请选择" style="width: 100%"
                                    type="month" value-format="yyyy-MM"></el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="档案年龄" prop="fileAge">
                                <el-input v-model="form.fileAge" placeholder="请输入" style="width: 190px;"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="出生年月" prop="birthDate">
                                <el-date-picker clearable v-model="form.birthDate" type="date" value-format="yyyy-MM-dd"
                                    placeholder="请选择" :style="{ width: '100%' }">
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="籍贯" prop="hometown">
                                <el-input v-model="form.hometown" placeholder="请输入" style="width: 190px;"></el-input>
                            </el-form-item>
                        </el-col>

                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="民族" prop="nation">
                                <el-input v-model="form.nation" placeholder="请输入"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="政治面貌" prop="politicalLandscape">
                                <el-select v-model="form.politicalLandscape" style="width: 190px;" placeholder="请选择">
                                    <el-option v-for="dict in dict.type.politics_tatusls" :key="dict.value"
                                        :label="dict.label" :value="dict.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>

                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="入党时间" prop="partyMembershipTime">
                                <el-date-picker clearable v-model="form.partyMembershipTime" type="date"
                                    value-format="yyyy-MM-dd" placeholder="请选择" :style="{ width: '100%' }">
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" class="custom-margin">
                            <el-form-item label="任教学科" prop="teachingSubject">
                                <el-select v-model="form.teachingSubject" style="width: 190px;" placeholder="请选择">
                                    <el-option v-for="dict in dict.type.teaching_subjects" :key="dict.value"
                                        :label="dict.label" :value="dict.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-col>
                    <el-col :span="6">
                        <el-col :span="6" class="custom-margin">
                            <el-card
                                style="height: 200px;width: 220px; display: flex; align-items: center; justify-content: center; ">
                                <el-upload v-loading="uploadLoading" class="avatar-uploader" action="#" accept="image/*"
                                    :show-file-list="false" :on-success="handleAvatarSuccess"
                                    :before-upload="beforeAvatarUpload" :http-request="uploadImage">
                                    <img v-if="form.photoUrl" :src="baseUrl + form.photoUrl"
                                        style="max-width: 100%; max-height: 100%" class="avatar" alt="" />
                                    <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                                </el-upload>
                            </el-card>
                        </el-col>
                    </el-col>
                </el-row>
                <el-row :gutter="6" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现职称" prop="currentProfessionalTitle">
                            <el-select v-model="form.currentProfessionalTitle" style="width: 100%" placeholder="请选择">
                                <el-option v-for="dict in dict.type.current_professional" :key="dict.value"
                                    :label="dict.label" :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现职称取得资格时间" prop="currentProfessionalTitleTime">
                            <el-date-picker clearable v-model="form.currentProfessionalTitleTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" style="width: 190px;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现聘职称" prop="currentHiringProfessionalTitle">
                            <el-select v-model="form.currentHiringProfessionalTitle" style="width: 100%" placeholder="请选择">
                                <el-option v-for="dict in dict.type.current_professional" :key="dict.value"
                                    :label="dict.label" :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="6" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现职称聘任时间" prop="currentHiringProfessionalTitleTime">
                            <el-date-picker clearable v-model="form.currentHiringProfessionalTitleTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现聘岗位" prop="currentPosition">
                            <el-select v-model="form.currentPosition" style="width: 190px;" placeholder="请选择">
                                <el-option v-for="dict in dict.type.current_position" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现岗位等级" prop="currentJobLevel">
                            <el-select v-model="form.currentJobLevel" style="width: 100%" placeholder="请选择">
                                <el-option v-for="level in filteredJobLevels" :key="level.value" :label="level.label"
                                    :value="level.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="6" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="现岗位等级聘任时间" prop="currentJobLevelAppointmentTime">
                            <el-date-picker clearable v-model="form.currentJobLevelAppointmentTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="职务" prop="duties">
                            <el-input v-model="form.duties" placeholder="请输入" style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="教师资格种类" prop="teacherQualificationType">
                            <el-input v-model="form.teacherQualificationType" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="6" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="教师资格证号码" prop="teacherQualificationCertificateNum">
                            <el-input v-model="form.teacherQualificationCertificateNum" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="参加工作时间" prop="workingHours">
                            <el-date-picker clearable v-model="form.workingHours" type="date" value-format="yyyy-MM-dd"
                                placeholder="请选择" style="width: 190px;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="工作年限" prop="seniority">
                            <el-input v-model="form.seniority" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="到二中工作时间" prop="toSecondMiddleSchoolTime">
                            <el-date-picker clearable v-model="form.toSecondMiddleSchoolTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="到市二中工作年限" prop="toSecondAge">
                            <el-input v-model="form.toSecondAge" placeholder="请输入" style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="教龄起算时间" prop="lengthOfTeacherTime">
                            <el-date-picker clearable v-model="form.lengthOfTeacherTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" :style="{ width: '100%' }">
                            </el-date-picker>
                        </el-form-item>

                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="工龄起算时间" prop="lengthOfServiceTime">
                            <el-date-picker clearable v-model="form.lengthOfServiceTime" type="date"
                                value-format="yyyy-MM-dd" placeholder="请选择" style="width: 100%;">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="在岗情况" prop="onDutySituation">
                            <el-select v-model="form.onDutySituation" style="width: 190px;" placeholder="请选择">
                                <el-option v-for="dict in dict.type.duty_situation" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="在编情况" prop="currentSituation">
                            <el-select v-model="form.currentSituation" style="width: 100%" placeholder="请选择">
                                <el-option v-for="dict in dict.type.current_situation" :key="dict.value" :label="dict.label"
                                    :value="dict.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业院校1" prop="graduationInstitution1">
                            <el-input v-model="form.graduationInstitution1" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="专业1" prop="major1">
                            <el-input v-model="form.major1" placeholder="请输入" style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业时间1" prop="graduationTime1">
                            <el-input v-model="form.graduationTime1" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业院校2" prop="graduationInstitution2">
                            <el-input v-model="form.graduationInstitution2" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="专业2" prop="major2">
                            <el-input v-model="form.major2" placeholder="请输入" style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业时间2" prop="graduationTime2">
                            <el-input v-model="form.graduationTime2" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业院校3" prop="graduationInstitution3">
                            <el-input v-model="form.graduationInstitution3" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="专业3" prop="major3">
                            <el-input v-model="form.major3" placeholder="请输入" style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="毕业时间3" prop="graduationTime3">
                            <el-input v-model="form.graduationTime3" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="第一学历" prop="firstDegree">
                            <el-input v-model="form.firstDegree" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="最后学历" prop="lastDegree">
                            <el-input v-model="form.lastDegree" placeholder="请输入" style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="学位" prop="degree">
                            <el-input v-model="form.degree" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="2" type="flex" justify="space-between">
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="工作经历" prop="workExperience">
                            <el-input v-model="form.workExperience" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="备注" prop="remark">
                            <el-input v-model="form.remark" placeholder="请输入" style="width: 190px;" />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" class="custom-margin">
                        <el-form-item label="钉钉手机号" prop="ddPhone">
                            <el-input v-model="form.ddPhone" placeholder="请输入" />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer custom-evenly">
                <el-button v-if="isEditing" type="primary" @click="submitForm">确 定</el-button>
                <el-button @click="cancel">取 消</el-button>
            </div>
        </el-dialog>

    </div>
</template>

<script>
import {
    listInformation,
    getInformation,
    delInformation,
    addInformation,
    filesUpload,
    updateInformation,
} from "@/api/smartSchool/electronicArchives/basicInformation";
import { uploadImage as commonUpload } from "@/api/common";
import { checkIdcard } from "@/utils/utilLibrary/validate";
import { getToken } from "@/utils/auth";
import { CustomCellStyle } from "@/enums/customStyle";
import { ExportType } from "@/enums/common";
import axios from "axios";
export default {
    name: "Information",
    dicts: [
        "sys_user_sex",
        "politics_tatusls",
        "teaching_subjects",
        "current_professional",
        "current_position",
        "current_joblevel",
        "duty_situation",
        "current_situation",
    ],

    data() {
        return {

            importing: false,
            isEditing: false, // 默认为查看模式
            // 导出选项
            exportOptions: {
                title: "选择导出类别",
                open: false,
            },
            uploadOpen: false,
            upload: {
                // 是否显示弹出层（用户导入）
                open: false,
                // 弹出层标题（用户导入）
                title: "",
                // 是否禁用上传
                isUploading: false,
                // 是否更新已经存在的用户数据
                updateSupport: 0,
                // 设置上传的请求头部
                headers: { Authorization: "Bearer " + getToken() },
                // 上传的地址
                url:
                    process.env.VUE_APP_BASE_API + "/teacher/basiclnformation/importData",
            },
            uploadForm: {},
            baseUrl: [process.env.VUE_APP_BASE_API],
            uploadLoading: false,
            uploadFileLoading: false,
            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            id: '',
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 教师基础信息表格数据
            informationList: [],
            // 弹出层标题
            title: "",
            // 图片上传遮罩层
            uploadLoading: false,
            // 是否显示弹出层
            open: false,
            query: false,
            look: false,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                teachingSubject: "",
                name: "",
                sex: "",
                birthDate: "",
                politicalLandscape: "",
                workingHours: "",
                currentProfessionalTitle: "",
                onDutySituation: "",
                graduationInstitution1: "",
                firstDegree: "",
            },
            // 表单参数
            form: {},
            // 表单校验
            rules: {
                name: [{ required: true, trigger: "blur" }],
                idCard: [{ required: true, validator: checkIdcard, trigger: "blur" }],
                teachingSubject: [
                    { required: true, trigger: "blur" },
                ],
                toSecondMiddleSchoolTime: [
                    {
                        required: true,
                        trigger: "blur",
                    },
                ],
                ddPhone: [
                    { required: true, trigger: "blur" },
                ],
            },
        };
    },
    computed: {
        //现岗位等级下拉框联动
        filteredJobLevels() {
            const position = this.form.currentPosition;
            if (position === "1") {
                // 专业技术岗
                return this.dict.type.current_joblevel.filter(
                    (level, index) => index < 12
                );
            } else if (position === "2") {
                // 管理岗
                return this.dict.type.current_joblevel.filter(
                    (level, index) => index === 0 || (index >= 12 && index < 17)
                );
            } else if (position === "3") {
                // 工勤岗
                return this.dict.type.current_joblevel.filter(
                    (level, index) => index === 0 || (index >= 17 && index <= 20)
                );
            }
            // 如果当前职位类型不是1、2、3中的任何一个，则返回全部选项
            return this.dict.type.current_joblevel;
        },
    },
    created() {
        this.getList();
    },
    methods: {
        //身份证校验
        handleIdCardBlur() {
            const idCard = this.form.idCard;
            if (idCard && idCard.length === 18) {
                // 身份证号码有效，提取性别
                this.form.sex = this.getGenderFromIdCard(idCard);
                // 提取并计算年龄
                const birthYear = parseInt(idCard.substring(6, 10));
                const birthMonth = parseInt(idCard.substring(10, 12));
                const birthDate = parseInt(idCard.substring(12, 14));
                // 设置出生年月日
                this.form.birthDate = `${birthYear}-${birthMonth}-${birthDate}`;
            } else {
                // 身份证号码无效或为空，清空性别、年龄和生日字段
                this.clearFormInfo();
            }
        },

        clearFormInfo() {
            this.form.sex = "";
            this.form.birthDate = "";
        },

        getGenderFromIdCard(idCard) {
            if (idCard && idCard.length === 18) {
                const lastDigit = parseInt(idCard.charAt(idCard.length - 2)); // 获取倒数第二位数字
                return lastDigit % 2 === 0 ? "女" : "男"; // 奇数表示男性，偶数表示女性
            }
            return ""; // 身份证号码无效或为空时返回空字符串
        },
        // 上传成功回调
        handleAvatarSuccess(res, file) {
            this.photoUrl = res.data.url;
            this.commonUpload(file);
        },

        // 上传前格式和图片大小限制
        beforeAvatarUpload(file) {
            const type =
                file.type === "image/jpeg" ||
                "image/jpg" ||
                "image/webp" ||
                "image/png";
            const isLt2M = file.size / 1024 / 1024 < 2;
            if (!type) {
                this.$message.error("图片格式不正确!(只能包含jpg，png，webp，JPEG)");
            }
            if (!isLt2M) {
                this.$message.error("上传图片大小不能超过 2MB!");
            }
            return type && isLt2M;
        },
        // 上传图片
        uploadImage(file) {
            const fileData = file.file;
            const formData = new FormData();
            formData.append("file", fileData);
            this.uploadLoading = true;
            commonUpload(formData)
                .then((response) => {
                    this.uploadLoading = false;
                    this.$modal.msgSuccess("上传成功");
                    this.photoUrl = this.pev + response.url;
                    this.form.photoUrl = response.url;
                    console.log(this.form.photoUr, 'this.form.photoUr');
                    console.log(response.url, 'response.url');
                })
                .catch((error) => {
                    this.uploadLoading = false;
                });
        },
        /** 查询教师基础信息列表 */
        getList() {
            this.loading = true;
            listInformation(this.queryParams).then((response) => {
                this.informationList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },
        // 文件压缩包上传前格式限制
        beforeFileUpload(file) {
            const fileName = file.name;
            const extension = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
            const allowedExtensions = ['zip']; // 允许的文件后缀列表
            if (allowedExtensions.includes(extension)) {
                // 文件类型正确，允许上传
                return true;
            } else {
                // 文件类型不正确，给出错误提示并阻止上传
                this.$message.error('文件格式不正确！只能上传zip文件');
                return false;
            }
        },
        // 上传照片压缩包文件
        uploadFiles(file) {
            const fileData = file.file;
            const formData = new FormData();
            formData.append("file", fileData);
            this.uploadFileLoading = true;
            filesUpload(formData)
                .then((response) => {
                    this.uploadFileLoading = false;
                    this.$modal.msg(response.msg);
                    this.getList();
                })
                .catch((error) => {
                    this.uploadFileLoading = false;
                });
        },
        handleLook(row) {
            console.log(row);
            this.look = true;
            this.isEditing = false;
            this.reset();
            const id = row.id || this.ids;
            getInformation(id).then((response) => {
                this.form = response.data;
                console.log(this.form, "this.form ");
                this.title = "查看教师基础信息";
            });
        },
        handleImport() {
            this.reset();
            this.title = "导入";
            this.uploadOpen = true;
        },
        handleFileUploadProgress(event, file, fileList) {
            this.upload.isUploading = true;
            this.importing = true;

        },
        // 提交上传文件
        submitFileForm() {
            this.$refs.upload.submit();
        },
        cancelFile() {
            this.uploadOpen = false;
            this.upload.isUploading = false;
            this.$refs.upload.clearFiles();
        },
        // 文件上传成功处理
        handleFileSuccess(response, file, fileList) {
            this.uploadOpen = false;
            this.upload.isUploading = false;
            this.importing = false;
            this.$refs.upload.clearFiles();
            this.$alert(
                "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
                response.msg +
                "</div>",
                "导入结果",
                { dangerouslyUseHTMLString: true }
            );
            this.getList();
        },
        //下载模版
        importTemplate() {
            this.download(
                "/teacher/basiclnformation/download",
                {},
                `教师基础信息_${Date.now()}.xlsx`
            );
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.look = false;
            this.query = false;
            this.reset();
        },
        // 表单重置
        reset() {
            this.form = {
                id: null,
                name: null,
                idCard: null,
                sex: null,
                fileBirthDate: null,
                birthDate: null,
                hometown: null,
                nation: null,
                politicalLandscape: null,
                partyMembershipTime: null,
                teachingSubject: null,
                currentProfessionalTitle: null,
                currentProfessionalTitleTime: null,
                currentHiringProfessionalTitle: null,
                currentHiringProfessionalTitleTime: null,
                currentPosition: null,
                currentJobLevel: null,
                currentJobLevelAppointmentTime: null,
                duties: null,
                teacherQualificationType: null,
                teacherQualificationCertificateNum: null,
                workingHours: null,
                toSecondMiddleSchoolTime: null,
                lengthOfTeacherTime: null,
                lengthOfServiceTime: null,
                onDutySituation: null,
                currentSituation: null,
                graduationInstitution1: null,
                major1: null,
                graduationTime1: null,
                graduationInstitution2: null,
                major2: null,
                graduationTime2: null,
                graduationInstitution3: null,
                major3: null,
                graduationTime3: null,
                firstDegree: null,
                lastDegree: null,
                degree: null,
                workExperience: null,
                remark: null,
                photoName: null,
                photoUrl: null,
                ddPhone: null,
                delFlag: null,
            };
            this.resetForm("form");
        },
        /** 搜索按钮操作 */
        handleQuerycx() {
            this.query = true;

        },
        handleQuery() {
            this.query = true;
            this.getList();
            this.query = false;
        },
        resetcx() {
            this.queryParams = {
                pageNum: 1,
                pageSize: 10,
                teachingSubject: "",
                name: "",
                sex: "",
                birthDate: "",
                politicalLandscape: "",
                workingHours: "",
                currentProfessionalTitle: "",
                onDutySituation: "",
                graduationInstitution1: "",
                firstDegree: "",
            };
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.queryParams = {
                pageNum: 1,
                pageSize: 10,
                teachingSubject: "",
                name: "",
                sex: "",
                birthDate: "",
                politicalLandscape: "",
                workingHours: "",
                currentProfessionalTitle: "",
                onDutySituation: "",
                graduationInstitution1: "",
                firstDegree: "",
            };
            this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.selection = selection;
            this.ids = selection.map(item => item.id);
            this.single = selection.length == 1;
            this.multiple = selection.length > 1;
            // 先定义 isMultiple 变量为 false
            let isMultiple = false;
            if (this.selection.length === 1) {
                // 单选逻辑
                this.id = this.selection[0].id;
                // console.log('this.id', this.id);
            } else if (this.selection.length > 1) {
                // 多选逻辑
                isMultiple = true;
                const ids = this.selection.map((item) => item.id);
                this.ids = ids;
                // console.log('this.ids', this.ids);
            }

        },

        /** 新增按钮操作 */
        handleAdd() {
            this.reset();
            this.open = true;
            this.title = "添加教师基础信息";
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            console.log(row);
            this.open = true;
            this.isEditing = true;
            this.reset();
            const id = row.id || this.ids;
            getInformation(id).then((response) => {
                this.form = response.data;
                console.log(this.form.photoUrl, 'this.form.photoUrl');
                this.title = "修改教师基础信息";
            });
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate((valid) => {
                if (valid) {
                    if (this.form.id != null) {
                        updateInformation(this.form).then((response) => {
                            console.log(this.form, 'this.form');
                            this.$modal.msgSuccess("修改成功");
                            this.open = false;
                            this.getList();
                        });
                    } else {
                        addInformation(this.form).then((response) => {
                            console.log(this.form, 'this.form');
                            this.$modal.msgSuccess("新增成功");
                            this.open = false;
                            this.getList();
                        });
                    }
                }
            });
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            const ids = row.id || this.ids;
            this.$modal
                .confirm('是否确认删除教师基础信息编号为"' + ids + '"的数据项？')
                .then(function () {
                    return delInformation(ids);
                })
                .then(() => {
                    this.getList();
                    this.$modal.msgSuccess("删除成功");
                })
                .catch(() => { });
        },
        /** 导出按钮操作 */
        handleExport() {
            this.download('teacher/basiclnformation/export', {
                ...this.queryParams
            }, `教师基础信息_${Date.now()}.xlsx`)
            // this.exportOptions.open = true;
            // this.download('/teacher/basiclnformation/export', {
            //     ...this.queryParams
            // }, `information_${new Date().getTime()}.xlsx`)
        },
        /** 导出 */
        exportFile(callback) {

            // let exportId = ''
            // if (this.multiple == true) {
            //     exportId = this.ids
            // } else {
            //     exportId = this.id
            // }
            // console.log('exportId', exportId);
            // const options = [
            //     {
            //         type: ExportType.TOTAL,
            //         path: "/teacher/basiclnformation/export",
            //         params: {},
            //     },
            //     {
            //         type: ExportType.SELECT,
            //         path: "/teacher/basiclnformation/export/",
            //         params: { exportId },
            //     },
            //     {
            //         type: ExportType.QUERY,
            //         path: "/teacher/basiclnformation/export",
            //         params: this.queryParams,
            //     },
            // ];

            // callback(options, `教师基础信息${Date.now()}.xlsx`);

        },


    },
};
</script>
<style lang="scss" scoped>
.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.avatar-uploader .el-upload:hover {
    border-color: #409eff;
}

.avatar-uploader-icon {
    font-size: 30px;
    color: #8c939d;
    width: 270px;
    height: 280px;
    line-height: 250px;
    text-align: center;
}

.avatar {
    width: 178px;
    height: 178px;
    display: block;
}

/*
.el-input {
    margin-top: -5px;
    margin-bottom: -8px;
}

.el-select {
    margin-top: -2px;
    margin-bottom: -5px;
} */

//.custom-margin {
//    margin: -10px 0px;
//}

//.custom-evenly {
//    margin-top: -40px !important;
//    text-align: right !important;
//}
::v-deep .el-form-item {
    margin-bottom: 0px;
}

::v-deep .el-input--medium .el-input__inner {
    height: 26px;
    line-height: 26px;
}

::v-deep .el-dialog__body {
    padding: 10px 20px
}

::v-deep .el-dialog:not(.is-fullscreen) {
    margin-top: 4vh !important;
}

.search ::v-deep .el-form-item__content {
    width: 200px
}

.addForm ::v-deep .el-dialog__header,
.editForm ::v-deep .el-dialog__header {
    padding-bottom: 0px;
    padding-top: 10px;
}

.addForm ::v-deep .el-dialog__footer,
.editForm ::v-deep .el-dialog__footer {
    padding-bottom: 10px;
}

.mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mask-content {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a74be;
    font-size: 15px;
}

::v-deep .el-table .el-table__cell {
    padding: 0;
}

::v-deep .el-table .cell {
    padding: 0;
}

::v-deep .el-table th.el-table__cell>.cell {
    padding: 0;

}

// ::v-deep.el-table .caret-wrapper {
// height: 20px !important;
// }
</style>
