<template>
  <div class="content-box">
    <div class="left">
      <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
      <span class="cameratxt">学生信息管理</span>
    </div>
    <div class="scroll">
      <div class="middle">
        <div class="filter">
          <div class="condition">
            <span>院系 :</span>
            <el-select
              @change="collegeChange"
              v-model="searchInput.college"
              placeholder="请选择院系"
              clearable
            >
              <el-option
                v-for="i in collegeData"
                :key="i.id"
                :label="i.name"
                :value="i.id"
              />
            </el-select>
          </div>
          <div class="condition">
            <span>专业 :</span>
            <el-select
              clearable
              @change="majorChange"
              v-model="searchInput.major"
              placeholder="请选择专业"
            >
              <el-option
                v-for="i in majorData"
                :key="i.id"
                :label="i.name"
                :value="i.id"
              />
            </el-select>
          </div>
          <div class="condition">
            <span>班级 :</span>
            <el-select
              clearable
              v-model="searchInput.classstr"
              placeholder="请选择专业"
            >
              <el-option
                v-for="i in classstrData"
                :key="i.id"
                :label="i.name"
                :value="i.id"
              />
            </el-select>
          </div>
          <div class="condition">
            <span>交通方式 :</span>
            <el-select
              clearable
              v-model="searchInput.trafficMethod"
              placeholder="请选择交通方式"
            >
              <el-option label="火车" value="火车" />
              <el-option label="飞机" value="飞机" />
              <el-option label="汽车" value="汽车" />
              <el-option label="自驾" value="自驾" />
              <el-option label="其他" value="其他" />
            </el-select>
          </div>
          <div class="condition">
            <span>填报状态 :</span>
            <el-select
              clearable
              v-model="searchInput.fillStatus"
              placeholder="请选择填报状态"
            >
              <el-option label="已填报" value="已填报" />
              <el-option label="未填报" value="未填报" />
            </el-select>
          </div>
          <div class="condition">
            <span>现场报到 :</span>
            <el-select
              clearable
              v-model="searchInput.isRegistered"
              placeholder="请选择现场报到"
            >
              <el-option label="已报到" value="1" />
              <el-option label="未报到" value="2" />
            </el-select>
          </div>
          <div class="condition">
            <span>姓名 :</span>
            <el-input
              clearable
              v-model.trim="searchInput.name"
              class="w-50 m-2"
              placeholder="请输入姓名"
              style="width: 180px"
              @clear="searchBtn"
            />
          </div>
          <el-button
            style="margin-left: 20px"
            color="rgba(38, 151, 255, 1)"
            type="primary"
            class="search"
            @click="searchBtn"
            ><span>查询</span></el-button
          >
          <el-button plain color="rgba(43, 153, 255, 1)" @click="resetBtn"
            >重置</el-button
          >
        </div>
        <!-- 按钮列表 -->
        <div class="gongneng">
          <el-button
            v-if="store.BtnRole('studentManagementSetting1')"
            type="primary"
            color="rgba(38, 151, 255, 1)"
            @click="buildImportBtn"
            >导入</el-button
          >
          <el-button
            v-if="store.BtnRole('studentManagementSetting2')"
            type="primary"
            style="margin-left: 0"
            color="rgba(48, 201, 191, 1)"
            @click="buildExportbtn"
            >导出</el-button
          >
          <el-button
            v-if="store.BtnRole('studentManagementSetting3')"
            type="primary"
            style="margin-left: 0"
            color="rgba(38, 151, 255, 1)"
            @click="addlist"
            >新增学生</el-button
          >
        </div>
      </div>
      <div class="footer" v-loading="loading">
        <el-table
          :row-class-name="tableRowClassName"
          :data="tableData.list"
          style="width: 100%"
          :header-cell-style="{
            background: 'rgba(240, 243, 247, 1)',
            height: '50px',
            border: 0,
          }"
        >
          <el-table-column
            width="160"
            align="center"
            prop="admissNum"
            label="录取号"
          />
          <el-table-column
            width="120"
            align="center"
            prop="name"
            label="姓名"
          />
          <el-table-column
            width="190"
            align="center"
            prop="cardId"
            label="身份证号"
          />
          <el-table-column
            width="160"
            align="center"
            prop="college"
            label="院系"
          >
            <template #default="{ row }">
              <span>{{ row.college }}</span>
            </template>
          </el-table-column>
          <el-table-column
            width="190"
            align="center"
            prop="major"
            label="专业"
          />
          <el-table-column
            width="220"
            align="center"
            prop="classstr"
            label="班级"
          />
          <el-table-column
            width="100"
            align="center"
            prop="trafficMethod"
            label="交通方式"
          >
            <template #default="{ row }">
              <span v-if="row.fillStatus == '已填报'" style="color: #2279ec">{{
                row.trafficMethod
              }}</span>
              <span v-else>{{ row.trafficMethod }}</span>
            </template>
          </el-table-column>
          <el-table-column
            width="160"
            align="center"
            prop="arrive"
            label="到站地点"
          >
            <template #default="{ row }">
              <span v-if="row.fillStatus == '已填报'" style="color: #2279ec">{{
                row.arrive
              }}</span>
              <span v-else>{{ row.arrive }}</span>
            </template>
          </el-table-column>
          <el-table-column
            width="120"
            align="center"
            prop="accompanyNum"
            label="陪同人数"
          >
            <template #default="{ row }">
              <span v-if="row.fillStatus == '已填报'" style="color: #2279ec">{{
                row.accompanyNum
              }}</span>
              <span v-else>{{ row.accompanyNum }}</span>
            </template>
          </el-table-column>
          <el-table-column
            width="120"
            align="center"
            prop="dormitory"
            label="填报状态"
          >
            <template #default="{ row }">
              <span v-if="row.fillStatus == '已填报'" style="color: #2279ec"
                >已填报</span
              >
              <span v-else>未填报</span>
            </template>
          </el-table-column>
          <el-table-column
            width="120"
            align="center"
            prop="dormitory"
            label="应缴金额"
          >
            <template #default="{ row }">
              <span v-if="row.fillStatus == '已填报'" style="color: #2279ec">{{
                row.amountPayable
              }}</span>
              <span v-else>{{ row.amountPayable }}</span>
            </template>
          </el-table-column>
          <el-table-column
            width="120"
            align="center"
            prop="dormitory"
            label="实付金额"
          >
            <template #default="{ row }">
              <span v-if="row.fillStatus == '已填报'" style="color: #2279ec">{{
                row.payAmount
              }}</span>
              <span v-else>{{ row.payAmount }}</span>
            </template>
          </el-table-column>
          <el-table-column
            width="180"
            align="center"
            prop="dormitory"
            label="宿舍信息"
          >
            <template #default="{ row }">
              <span v-if="row.fillStatus == '已填报'" style="color: #2279ec">{{
                row.dormitory
              }}</span>
              <span v-else>{{ row.dormitory }}</span>
            </template>
          </el-table-column>
          <el-table-column
            width="160"
            align="center"
            prop="isRegistered"
            label="现在报到"
          >
            <template #default="{ row }">
              <span v-if="row.isRegistered == 1" style="color: #2279ec">已报到</span>
              <span v-else>未报到</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            label="操作"
            fixed="right"
            min-width="230"
          >
            <template #default="{ row }">
              <div class="options">
                <span
                  class="info"
                  v-if="store.BtnRole('studentManagementSetting4')"
                  @click="infoStudent(row)"
                  >详情</span
                >
                <span
                  class="edit"
                  v-if="store.BtnRole('studentManagementSetting5')"
                  @click="updateS(row)"
                  >编辑</span
                >
                <span
                  class="delete"
                  v-if="store.BtnRole('studentManagementSetting6')"
                  @click="deleteS(row)"
                  >删除</span
                >
                <span
                  class="delete"
                  style="color: #c003a2; margin-left: 15px"
                  v-if="
                    store.BtnRole('studentManagementSetting8') &&
                    row.isRegistered != 1
                  "
                  @click="registerS(row, 1)"
                  >现场报到</span
                >
                <span
                  class="delete"
                  style="color: #c003a2; margin-left: 15px"
                  v-if="
                    store.BtnRole('studentManagementSetting8') &&
                    row.isRegistered == 1
                  "
                  @click="registerS(row, 2)"
                  >取消报到</span
                >
              </div>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <div class="pageSize">
          <span></span>
          <el-pagination
            background
            :current-page="currentPage"
            :page-size="pageSize"
            :page-sizes="[10, 20, 30, 40]"
            layout="total,sizes, prev, pager, next, jumper, slot"
            :total="total"
            @size-change="handleSizeChange"
            @update:current-page="handleCurrentChange"
          />
        </div>
      </div>
    </div>
    <!-- 添加账号弹窗 -->
    <el-dialog
      class="addStaff"
      v-model="addDialogVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :title="dialongTitle"
      align-center
      width="1000"
      :before-close="cancelAdd"
      destroy-on-close
      draggable
    >
      <el-form
        ref="ruleFormRef"
        :model="ruleForm"
        :rules="rules"
        label-width="100px"
        class="demo-ruleForm"
        :size="formSize"
        label-position="right"
        status-icon
      >
        <div class="photo">
          <!-- 照片 -->
          <div class="photo_left">
            <span>照片</span>
            <el-form-item label="" prop="">
              <el-upload
                class="avatar-uploader"
                action="#"
                :auto-upload="false"
                :on-remove="pictureRemove"
                :on-change="pictureImportChange"
                :before-upload="beforeAvatarPicture"
                ref="pictureRef"
              >
                <template #tip>
                  <div class="el-upload__tip">上传的图片应小于500kb</div>
                </template>
                <img :src="ruleForm.picture" class="avatar" />
                <!-- <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> -->
              </el-upload>
            </el-form-item>
          </div>
          <!-- 中间 -->
          <div class="photo_middle">
            <el-form-item label="校区 :" prop="school">
              <el-select
                clearable
                :disabled="ruleForm.fillStatus == '已填报'"
                @change="schoolChange"
                v-model="ruleForm.school"
                placeholder="请选择校区名称"
              >
                <el-option
                  v-for="i in schoolData"
                  :key="i.id"
                  :label="i.school"
                  :value="`${i.school},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="录取号 :" prop="admissNum">
              <el-input
                v-model.trim="ruleForm.admissNum"
                placeholder="请输入录取号"
                clearable
              />
            </el-form-item>
            <el-form-item label="身份证号 :" prop="cardId">
              <el-input
                :disabled="dialongTitle != '新增学生信息'"
                v-model.trim="ruleForm.cardId"
                placeholder="请输入身份证号"
                clearable
              />
            </el-form-item>
            <el-form-item label="出生年月 :" prop="birthday">
              <el-date-picker
                v-model="ruleForm.birthday"
                type="date"
                format="YYYY-MM-DD"
                value-format="YYYY-MM-DD"
                placeholder="请选择出生年月"
                :size="size"
              />
            </el-form-item>

            <el-form-item label="民族 :" prop="nationality">
              <el-input
                v-model.trim="ruleForm.nationality"
                placeholder="请输入民族"
                clearable
              />
            </el-form-item>
            <el-form-item label="考生号 :" prop="examNum">
              <el-input
                v-model.trim="ruleForm.examNum"
                placeholder="请输入考生号"
                clearable
              />
            </el-form-item>
            <!-- <el-form-item label="毕业中学 :" prop="graduationSchool">
              <el-input
                v-model.trim="ruleForm.graduationSchool"
                placeholder="请输入毕业中学"
                clearable
              />
            </el-form-item> -->
            <el-form-item label="政治面貌 :" prop="politicalStatu">
              <el-input
                v-model.trim="ruleForm.politicalStatu"
                placeholder="请输入政治面貌"
                clearable
              />
            </el-form-item>
          </div>
          <!-- 右边 -->
          <div class="photo_footer">
            <el-form-item label="姓名 :" prop="name">
              <el-input
                v-model.trim="ruleForm.name"
                placeholder="请输入姓名"
                clearable
              />
            </el-form-item>
            <el-form-item label="性别 :" prop="sex">
              <el-select v-model="ruleForm.sex" placeholder="请选择性别">
                <el-option label="男" value="男" />
                <el-option label="女" value="女" />
              </el-select>
            </el-form-item>
            <el-form-item label="院系 :" prop="college">
              <el-select
                @change="collegeFormChange"
                v-model="ruleForm.college"
                placeholder="请选择院系"
                clearable
              >
                <el-option
                  v-for="i in collegeData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="专业 :" prop="major">
              <el-select
                @change="majorFormChange"
                clearable
                v-model="ruleForm.major"
                placeholder="请选择专业"
              >
                <el-option
                  v-for="i in majorFormData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="所属班级 :" prop="classstr">
              <el-select
                clearable
                v-model="ruleForm.classstr"
                placeholder="请选择所属班级"
              >
                <el-option
                  v-for="i in classstrFormData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="学制 :" prop="eduSystem">
              <el-input
                v-model.trim="ruleForm.eduSystem"
                placeholder="请输入学制"
                clearable
              />
            </el-form-item>
            <el-form-item label="层次 :" prop="batchValue">
              <el-select
                clearable
                v-model="ruleForm.batchValue"
                placeholder="请选择层次"
              >
                <el-option label="本科" value="本科" />
                <el-option label="专升本" value="专升本" />
                <el-option label="专科" value="专科" />
              </el-select>
            </el-form-item>
          </div>
        </div>
        <!-- 填报明细 -->
        <div class="info_title">
          <SvgIcon name="filling_details" color="#fff" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;填报明细</h4>
        </div>
        <div class="filling_details">
          <el-form-item label="手机号码 :" prop="">
            <el-input
              v-model.trim="ruleForm.phone"
              placeholder="请输入手机号码"
              clearable
              style="width: 200px"
            />
          </el-form-item>
          <div class="native">
            <el-form-item label="籍贯 :" prop="">
              <el-select
                clearable
                @change="oprovinceChange"
                v-model="ruleForm.oprovince"
                placeholder="请选择籍贯省"
              >
                <el-option
                  v-for="i in provinceData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="">
              <el-select
                clearable
                @change="ocityChange"
                v-model="ruleForm.ocity"
                placeholder="请选择籍贯市"
              >
                <el-option
                  v-for="i in ocityData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="">
              <el-select
                clearable
                v-model="ruleForm.odistrict"
                placeholder="请选择籍贯县"
              >
                <el-option
                  v-for="i in odistrictData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
          </div>
          <div class="native family">
            <el-form-item label="家庭住址 :" prop="">
              <el-select
                clearable
                @change="provinceChange"
                v-model="ruleForm.province"
                placeholder="请选择省"
              >
                <el-option
                  v-for="i in provinceData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="">
              <el-select
                clearable
                @change="cityChange"
                v-model="ruleForm.city"
                placeholder="请选择市"
              >
                <el-option
                  v-for="i in cityData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="">
              <el-select
                clearable
                v-model="ruleForm.district"
                placeholder="请选择县"
              >
                <el-option
                  v-for="i in districtData"
                  :key="i.id"
                  :label="i.name"
                  :value="`${i.name},${i.id}`"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="">
              <el-input
                v-model.trim="ruleForm.address"
                placeholder="请输入详情地址"
                clearable
                style="width: 260px"
              />
            </el-form-item>
          </div>
          <div class="native"></div>
          <el-form-item label="按时报到 :" prop="">
            <el-switch
              :active-value="1"
              :inactive-value="0"
              v-model="ruleForm.registerOntime"
            />
          </el-form-item>
          <el-form-item class="email" label="邮编 :" prop="">
            <el-input
              v-model.trim="ruleForm.zipCode"
              placeholder="请输入邮编"
              clearable
              style="width: 270px"
            />
          </el-form-item>
          <div class="traffic">
            <el-form-item label="交通方式 :" prop="">
              <el-select
                v-model="ruleForm.trafficMethod"
                placeholder="请选择交通方式"
              >
                <el-option label="火车" value="火车" />
                <el-option label="飞机" value="飞机" />
                <el-option label="汽车" value="汽车" />
                <el-option label="自驾" value="自驾" />
                <el-option label="其他" value="其他" />
              </el-select>
            </el-form-item>
            <el-form-item label="到站地点 :" prop="">
              <el-select
                v-if="ruleForm.trafficMethod == '自驾'"
                v-model="ruleForm.arrive"
                placeholder="请选择到站地点"
              >
                <el-option label="黄家湖校区" value="黄家湖校区" />
                <el-option label="墨轩湖校区" value="墨轩湖校区" />
              </el-select>
              <el-select
                v-else-if="ruleForm.trafficMethod == '飞机'"
                v-model="ruleForm.arrive"
                placeholder="请选择到站地点"
              >
                <el-option label="昌北机场" value="昌北机场" />
              </el-select>
              <el-select
                v-else-if="ruleForm.trafficMethod == '火车'"
                v-model="ruleForm.arrive"
                placeholder="请选择到站地点"
              >
                <el-option label="南昌火车站" value="南昌火车站" />
                <el-option label="南昌西站" value="南昌西站" />
                <el-option label="南昌东站" value="南昌东站" />
              </el-select>
              <el-select
                v-else-if="ruleForm.trafficMethod == '汽车'"
                v-model="ruleForm.arrive"
                placeholder="请选择到站地点"
              >
                <el-option label="南昌长途汽车西站" value="南昌长途汽车西站" />
                <el-option label="靖安汽车站" value="靖安汽车站" />
              </el-select>
              <el-select
                v-else
                v-model="ruleForm.arrive"
                placeholder="请选择到站地点"
              >
                <el-option label="南昌火车站" value="南昌火车站" />
                <el-option label="南昌西站" value="南昌西站" />
                <el-option label="南昌东站" value="南昌东站" />
                <el-option label="昌北机场" value="昌北机场" />
                <el-option label="南昌长途汽车西站" value="南昌长途汽车西站" />
                <el-option label="靖安汽车站" value="靖安汽车站" />
                <el-option label="黄家湖校区" value="黄家湖校区" />
                <el-option label="墨轩湖校区" value="墨轩湖校区" />
              </el-select>
            </el-form-item>
          </div>
          <el-form-item label="到站日期 :" prop="">
            <el-date-picker
              v-model="ruleForm.arrvieDate"
              type="date"
              format="YYYY-MM-DD"
              value-format="YYYY-MM-DD"
              placeholder="请选择到站日期"
              :size="size"
            />
          </el-form-item>
          <el-form-item label="到站时间段 :" prop="">
            <el-radio-group
              @change="arriveTimeChange"
              v-model="ruleForm.arriveTime"
            >
              <el-radio
                v-for="i in arriveData"
                :key="i.id"
                :value="`${i.timeStr},${i.id}`"
                >{{ i.timeStr }}</el-radio
              >
            </el-radio-group>
          </el-form-item>
        </div>
        <div class="info_title">
          <SvgIcon name="family" color="#fff" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;家庭成员&nbsp;&nbsp;</h4>
          <img @click="familysAdd" src="@/assets/img/add_1.png" alt="" />
        </div>
        <el-form-item class="elFormTable" label="" prop="">
          <el-table
            :row-class-name="tableRowClassName"
            :data="ruleForm.familys"
            style="width: 100%"
            :header-cell-style="{
              background: 'rgba(240, 243, 247, 1)',
              height: '40px',
              border: 0,
            }"
          >
            <el-table-column align="center" prop="familyShip" label="称谓" />
            <el-table-column align="center" prop="name" label="姓名" />
            <el-table-column align="center" prop="workUnit" label="工作单位" />
            <el-table-column align="center" prop="phone" label="联系电话" />
            <el-table-column align="center" label="操作" width="120">
              <template #default="scope">
                <span
                  class="delete"
                  style="color: #d43030; cursor: pointer"
                  @click="familysDel(scope)"
                  >删除</span
                >
              </template>
            </el-table-column>
          </el-table>
        </el-form-item>

        <!-- <div class="info_title">
          <SvgIcon name="entourage" color="#fff" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;陪同人员信息&nbsp;&nbsp;</h4>
          <img @click="accompanysAdd" src="@/assets/img/add_1.png" alt="" />
        </div>
        <el-form-item class="elFormTable" label="" prop="accompanys">
          <el-table
            :row-class-name="tableRowClassName"
            :data="ruleForm.accompanys"
            style="width: 100%"
            :header-cell-style="{
              background: 'rgba(240, 243, 247, 1)',
              height: '40px',
              border: 0,
            }"
          >
            <el-table-column
              width="120"
              align="center"
              label="序号"
              type="index"
              index="1"
            />
            <el-table-column align="center" prop="name" label="姓名" />
            <el-table-column align="center" prop="phone" label="联系电话" />
            <el-table-column align="center" label="操作" width="120">
              <template #default="scope">
                <span
                  class="delete"
                  style="color: #d43030; cursor: pointer"
                  @click="accompanysDel(scope)"
                  >删除</span
                >
              </template>
            </el-table-column>
          </el-table>
        </el-form-item> -->

        <!-- <div class="info_title">
          <SvgIcon name="dorm" color="#fff" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;宿舍信息</h4>
        </div>
        <div class="dorm_info" style="display: flex; flex-wrap: wrap">
          <el-form-item label="校区 " prop="school">
            <el-select
              clearable
              @change="schoolChange"
              v-model="ruleForm.school"
              placeholder="请选择校区名称"
            >
              <el-option
                v-for="i in schoolData"
                :key="i.id"
                :label="i.school"
                :value="`${i.school},${i.id}`"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="楼栋 " prop="build">
            <el-select
              clearable
              v-model="ruleForm.build"
              placeholder="请选择楼栋名称"
              @change="buildChange"
            >
              <el-option
                v-for="i in buildData"
                :key="i.id"
                :label="i.build"
                :value="`${i.build},${i.id}`"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="寝室号" prop="dormitory">
            <el-select
              v-model="ruleForm.dormitory"
              placeholder="请选择寝室号"
              clearable
              @change="dormitoryChange"
            >
              <el-option
                v-for="i in dormitoryData"
                :key="i.id"
                :label="i.dormitory"
                :value="`${i.dormitory},${i.id}`"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="床位号" prop="bed">
            <el-select
              v-model="ruleForm.bed"
              placeholder="请选择床位号"
              clearable
            >
              <el-option
                v-for="i in bedData"
                :key="i.id"
                :label="i.name"
                :value="`${i.name},${i.id}`"
              />
            </el-select>
          </el-form-item>
        </div> -->

        <!-- <div class="info_title">
          <SvgIcon name="pay" color="#000" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;缴费信息</h4>
        </div>
        <div class="photo_middle" style="display: flex;">
          <el-form-item label="应缴金额 :" prop="admissNum">
            <el-input
              v-model.trim="ruleForm.admissNum"
              placeholder="请输入应缴金额"
              clearable
            />
          </el-form-item>
          <el-form-item label="实付金额 :" prop="cardId">
            <el-input
              v-model.trim="ruleForm.cardId"
              placeholder="请输入实付金额"
              clearable
            />
          </el-form-item>
        </div> -->

        <!-- <div class="info_title">
          <SvgIcon name="car" color="#000" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;车辆信息</h4>
        </div>
        <div class="photo_middle" style="display: flex;">
          <el-form-item label="是否自驾 :" prop="admissNum">
            <el-switch
              :active-value="1"
              :inactive-value="0"
              v-model="ruleForm.registerOntime"
            />
          </el-form-item>
          <el-form-item label="车牌号码 :" prop="cardId">
            <el-input
              v-model.trim="ruleForm.cardId"
              placeholder="请输入车牌号码"
              clearable
            />
          </el-form-item>
        </div> -->

        <el-form-item class="options">
          <el-button @click="cancelAdd">取消</el-button>
          <el-button
            color="rgba(0, 97, 255, 1)"
            class="queding"
            type="primary"
            @click="submitAdd(ruleFormRef)"
          >
            确定
          </el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog
      class="infoStudent"
      v-model="infoDialogVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      title="学生信息详情"
      align-center
      width="1000"
      :before-close="cancelInfo"
      destroy-on-close
      draggable
    >
      <div class="el-form">
        <div class="photo">
          <!-- 照片 -->
          <div class="photo_left">
            <div class="el-form-item">
              <img :src="ruleForm.picture" class="avatar" />
            </div>
          </div>
          <!-- 中间 -->
          <div class="photo_middle">
            <div class="el-form-item">
              <span class="title">校区 :</span>
              <span class="title_content">{{
                ruleForm.school ? ruleForm.school : ""
              }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">录取号 :</span>
              <span class="title_content">{{ ruleForm.admissNum }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">身份证号 :</span>
              <span class="title_content">{{ ruleForm.cardId }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">出生年月 :</span>
              <span class="title_content">{{ ruleForm.birthday }}</span>
            </div>

            <div class="el-form-item">
              <span class="title">民族 :</span>
              <span class="title_content">{{ ruleForm.nationality }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">考生号 :</span>
              <span class="title_content">{{ ruleForm.examNum }}</span>
            </div>
            <!-- <div class="el-form-item" prop="graduationSchool">
              <span class="title">毕业中学 :</span>
              <span class="title_content">{{ ruleForm.graduationSchool }}</span>
            </div> -->
            <div class="el-form-item">
              <span class="title">政治面貌 :</span>
              <span class="title_content">{{ ruleForm.politicalStatu }}</span>
            </div>
          </div>
          <!-- 右边 -->
          <div class="photo_footer">
            <div class="el-form-item">
              <span class="title">姓名 :</span>
              <span class="title_content">{{ ruleForm.name }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">性别 :</span>
              <span class="title_content">{{ ruleForm.sex }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">院系 :</span>
              <span class="title_content">{{
                ruleForm.college ? ruleForm.college : ""
              }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">专业 :</span>
              <span class="title_content">{{
                ruleForm.major ? ruleForm.major : ""
              }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">所属班级 :</span>
              <span class="title_content">{{
                ruleForm.classstr ? ruleForm.classstr : ""
              }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">学制 :</span>
              <span class="title_content">{{ ruleForm.eduSystem }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">层次 :</span>
              <span class="title_content">{{ ruleForm.batchValue }}</span>
            </div>
          </div>
        </div>
        <!-- 填报明细 -->
        <div class="info_title">
          <SvgIcon name="filling_details" color="#fff" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;填报明细</h4>
        </div>
        <div class="filling_details">
          <div class="info_content">
            <div class="el-form-item">
              <span class="title">手机号码 :</span>
              <span class="title_content">{{ ruleForm.phone }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">籍贯 :</span>
              <span class="title_content">{{
                ruleForm.oprovince ? ruleForm.oprovince : ""
              }}</span>
              <span class="title_content">{{
                ruleForm.ocity ? ruleForm.ocity : ""
              }}</span>
              <span class="title_content">{{
                ruleForm.odistrict ? ruleForm.odistrict : ""
              }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">家庭住址 :</span>
              <span class="title_content">{{
                ruleForm.province ? ruleForm.province : ""
              }}</span>
              <span class="title_content">{{
                ruleForm.city ? ruleForm.city : ""
              }}</span>
              <span class="title_content">{{
                ruleForm.district ? ruleForm.district : ""
              }}</span>
              <span class="title_content">{{
                ruleForm.address ? ruleForm.address : ""
              }}</span>
            </div>
          </div>
          <div class="native family">
            <div class="info_content">
              <div class="el-form-item">
                <span class="title">按时报到 :</span>
                <span class="title_content">{{
                  ruleForm.registerOntime == 1 ? "是" : "否"
                }}</span>
              </div>
              <div class="el-form-item">
                <span class="title">邮编 :</span>
                <span class="title_content">{{ ruleForm.zipCode }}</span>
              </div>
              <div class="el-form-item">
                <span class="title">交通方式 :</span>
                <span class="title_content">{{ ruleForm.trafficMethod }}</span>
              </div>
              <div class="el-form-item">
                <span class="title">到站地点 :</span>
                <span class="title_content">{{ ruleForm.arrive }}</span>
              </div>
            </div>
          </div>
          <div class="el-form-item">
            <div class="el-form-item">
              <span class="title">到站日期 :</span>
              <span class="title_content">{{ ruleForm.arrvieDate }}</span>
            </div>
            <div class="el-form-item">
              <span class="title">到站时间段 :</span>
              <span class="title_content">{{
                ruleForm.arriveTime ? ruleForm.arriveTime.split(",")[0] : ""
              }}</span>
            </div>
          </div>
        </div>
        <div class="info_title">
          <SvgIcon name="family" color="#fff" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;家庭成员&nbsp;&nbsp;</h4>
        </div>
        <div class="el-form-item elFormTable">
          <el-table
            :row-class-name="tableRowClassName"
            :data="ruleForm.familys"
            style="width: 100%"
            :header-cell-style="{
              background: 'rgba(240, 243, 247, 1)',
              height: '40px',
              border: 0,
            }"
          >
            <el-table-column align="center" prop="familyShip" label="称谓" />
            <el-table-column align="center" prop="name" label="姓名" />
            <el-table-column align="center" prop="workUnit" label="工作单位" />
            <el-table-column align="center" prop="phone" label="联系电话" />
          </el-table>
        </div>

        <div class="info_title">
          <SvgIcon name="entourage" color="#fff" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;陪同人员信息&nbsp;&nbsp;</h4>
        </div>
        <div class="el-form-item elFormTable">
          <el-table
            :row-class-name="tableRowClassName"
            :data="ruleForm.accompanys"
            style="width: 100%"
            :header-cell-style="{
              background: 'rgba(240, 243, 247, 1)',
              height: '40px',
              border: 0,
            }"
          >
            <el-table-column
              width="120"
              align="center"
              label="序号"
              type="index"
              index="1"
            />
            <el-table-column align="center" prop="name" label="姓名" />
            <el-table-column align="center" prop="phone" label="联系电话" />
          </el-table>
        </div>

        <div class="info_title">
          <SvgIcon name="dorm" color="#fff" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;宿舍信息</h4>
        </div>
        <div class="dorm_info" style="display: flex; flex-wrap: wrap">
          <div class="el-form-item">
            <span class="title">楼栋 :</span>
            <span class="title_content">{{
              ruleForm.build ? ruleForm.build : ""
            }}</span>
          </div>
          <div class="el-form-item">
            <span class="title">寝室号 :</span>
            <span class="title_content">{{
              ruleForm.dormitory ? ruleForm.dormitory : ""
            }}</span>
          </div>
          <div class="el-form-item">
            <span class="title">床位号 :</span>
            <span class="title_content">{{
              ruleForm.bed ? ruleForm.bed : ""
            }}</span>
          </div>
        </div>

        <div class="info_title">
          <SvgIcon name="pay" color="#000" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;缴费信息</h4>
        </div>
        <div class="dorm_info" style="display: flex; flex-wrap: wrap">
          <div class="el-form-item">
            <span class="title">应缴金额 :</span>
            <span class="title_content">{{
              ruleForm.amountPayable ? ruleForm.amountPayable : ""
            }}</span>
          </div>
          <div class="el-form-item">
            <span class="title">实付金额 :</span>
            <span class="title_content">{{
              ruleForm.payAmount ? ruleForm.payAmount : ""
            }}</span>
          </div>
        </div>

        <div class="info_title" v-if="ruleForm.trafficMethod == '自驾'">
          <SvgIcon name="car" color="#000" size="22"></SvgIcon>
          <h4>&nbsp;&nbsp;车辆信息</h4>
        </div>
        <div
          v-if="ruleForm.trafficMethod == '自驾'"
          class="dorm_info"
          style="display: flex; flex-wrap: wrap"
        >
          <div class="el-form-item">
            <span class="title">是否自驾 :</span>
            <span class="title_content">{{
              ruleForm.trafficMethod ? ruleForm.trafficMethod : ""
            }}</span>
          </div>
          <div class="el-form-item">
            <span class="title">车牌号 :</span>
            <span class="title_content">{{
              ruleForm.carNumber ? ruleForm.carNumber : ""
            }}</span>
          </div>
        </div>
      </div>
    </el-dialog>

    <!-- 添加家庭成员 -->
    <el-dialog
      class="addfamilys"
      v-model="addfamilysVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :title="addfamilysTitle"
      align-center
      width="560"
      :before-close="cancelAddfamilys"
      destroy-on-close
      draggable
    >
      <el-form
        ref="addfamilysRef"
        :model="addfamilysRuleForm"
        :rules="addfamilysRules"
        label-width="100px"
        class="demo-ruleForm"
        :size="formSize"
        label-position="right"
        status-icon
      >
        <el-form-item
          v-if="addfamilysTitle == '添加家庭成员'"
          label="称谓 :"
          prop="familyShip"
        >
          <el-input
            v-model.trim="addfamilysRuleForm.familyShip"
            placeholder="请输入称谓"
            clearable
          />
        </el-form-item>
        <el-form-item label="姓名 :" prop="name">
          <el-input
            v-model.trim="addfamilysRuleForm.name"
            placeholder="请输入姓名"
            clearable
          />
        </el-form-item>
        <el-form-item
          v-if="addfamilysTitle == '添加家庭成员'"
          label="工作单位 :"
          prop="workUnit"
        >
          <el-input
            v-model.trim="addfamilysRuleForm.workUnit"
            placeholder="请输入工作单位"
            clearable
          />
        </el-form-item>
        <el-form-item label="联系电话 :" prop="phone">
          <el-input
            v-model.trim="addfamilysRuleForm.phone"
            placeholder="请输入联系电话"
            clearable
          />
        </el-form-item>

        <el-form-item class="options">
          <el-button @click="cancelAddfamilys">取消</el-button>
          <el-button
            color="rgba(0, 97, 255, 1)"
            class="queding"
            type="primary"
            @click="submitAddfamilys(addfamilysRef)"
          >
            确定
          </el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 项目导入 -->
    <el-dialog
      class="projectImport"
      v-model="buildImportVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      title="学生信息导入"
      align-center
      width="600"
      :before-close="cancelProjectImport"
    >
      <!-- <p class="title">当前只支持项目类型为“非装配式建筑项目”的项目导入</p> -->
      <p class="down">
        <span>学生信息导入模板下载</span
        ><span @click="templateDown">模板下载</span>
      </p>
      <el-upload
        class="avatar-uploader"
        action="#"
        :auto-upload="false"
        :on-remove="projectImportRemove"
        :on-change="projectImportChange"
        :before-upload="beforeAvatarProImport"
        ref="buildRef"
        :limit="1"
        :on-exceed="projectImportExceed"
      >
        <template #trigger>
          <el-button class="queding" type="primary">
            &nbsp;&nbsp;导入文件&nbsp;&nbsp;
          </el-button>
        </template>
      </el-upload>
      <div class="options">
        <el-button
          color="rgba(9, 101, 98, 1)"
          class="queding"
          type="primary"
          @click="projectImportConfirm(buildRef)"
          :loading="buildImportLoading"
        >
          &nbsp;&nbsp;确认导入&nbsp;&nbsp;
        </el-button>
        <el-button @click="cancelProjectImport"
          >&nbsp;&nbsp;取消导入&nbsp;&nbsp;</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script setup>
import {
  ref,
  watch,
  reactive,
  nextTick,
  onBeforeMount,
  onUnmounted,
} from "vue";
import { useRouter } from "vue-router";
import { genFileId, ElMessage, ElMessageBox } from "element-plus";
import { dayjs } from "element-plus";
import lodash from "lodash";
import { https } from "@/utils/request"; // 绝对路径

import { storeToRefs } from "pinia";
import { useCounterStore } from "@/stores/index";

const router = useRouter();
const store = useCounterStore();

// 为避免解构时失去响应性
const { name, age, isCollapse, realAge, collegeRole } = storeToRefs(store);

// 表格数据
const loading = ref(false);
const tableData = reactive({
  list: [],
});
const activeIndex = ref(); // 默认跳转路由
const dialongTitle = ref("新增账号"); // 弹窗标题

const searchInput = reactive({
  college: "",
  major: "",
  classstr: "",
  trafficMethod: "",
  fillStatus: "",
  name: "",
  isRegistered:"",
}); // 搜索按钮数据

const currentPage = ref(1); // 当前页
const pageSize = ref(10);
const total = ref(); // 当前总数
const selectIds = ref([]);

const addDialogVisible = ref(false); // 控制添加账号弹窗

// 表单数据
const formSize = ref("default");
const ruleFormRef = ref();
const ruleForm = reactive({
  picture: "",
  admissNum: "",
  name: "",
  cardId: "",
  sex: "",
  birthday: "",
  school: "",
  college: "",
  major: "",
  classstr: "",
  examNum: "",
  eduSystem: "",
  graduationSchool: "",
  batchValue: "",
  politicalStatu: "",
  nationality: "",

  // 填报明细
  phone: "",
  oprovince: "",
  ocity: "",
  odistrict: "",
  province: "",
  city: "",
  district: "",
  address: "",
  registerOntime: 0, // 按时报到
  zipCode: "", // 邮编
  trafficMethod: "",
  carNumber: "",
  arrive: "",
  arrvieDate: "",
  arriveTime: "",

  // 家庭成员
  familys: [],
  // 陪同人员
  accompanys: [],

  // 宿舍信息
  school: "",
  build: "",
  dormitory: "",
  bed: "",

  amountPayable: "", // 应缴金额
  payAmount: "", // 实付金额

  fillStatus: "", // 判断有无填报
  id: "",
});
const pictureRef = ref();
// 表单验证
const rules = reactive({
  admissNum: [{ required: true, message: "录取号不能为空", trigger: "blur" }],
  cardId: [
    { required: true, message: "身份证号不能为空", trigger: "blur" },
    {
      min: 8,
      max: 20,
      pattern: /^(?:\d{15}|\d{17}[\dX])$/,
      message: "身份证号码格式有误，请重新输入",
      trigger: "blur",
    },
  ],
  birthday: [{ required: true, message: "出生年月不能为空", trigger: "blur" }],
  examNum: [{ required: true, message: "考生号不能为空", trigger: "blur" }],
  graduationSchool: [
    { required: true, message: "毕业中学不能为空", trigger: "blur" },
  ],
  politicalStatu: [
    { required: true, message: "政治面貌不能为空", trigger: "blur" },
  ],
  name: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
  sex: [{ required: true, message: "性别不能为空", trigger: "blur" }],
  eduSystem: [{ required: true, message: "学制不能为空", trigger: "blur" }],
  batchValue: [{ required: true, message: "层次不能为空", trigger: "blur" }],
  nationality: [{ required: true, message: "民族不能为空", trigger: "blur" }],

  phone: [
    { required: true, message: "手机号码不能为空", trigger: "blur" },
    {
      min: 8,
      max: 20,
      pattern: /^1[3-9]\d{9}$/,
      message: "手机号码格式有误，请重新输入",
      trigger: "blur",
    },
  ],
  address: [{ required: true, message: "详情地址不能为空", trigger: "blur" }],
  registerOntime: [
    { required: true, message: "按时报到不能为空", trigger: "blur" },
  ],
  zipCode: [{ required: true, message: "邮编不能为空", trigger: "blur" }],
  email: [{ required: true, message: "邮编不能为空", trigger: "blur" }],
  trafficMethod: [
    { required: true, message: "交通方式不能为空", trigger: "blur" },
  ],
  arrive: [{ required: true, message: "到站地点不能为空", trigger: "blur" }],
  arrvieDate: [
    { required: true, message: "到站日期不能为空", trigger: "blur" },
  ],
  arriveTime: [
    { required: true, message: "到站时间段不能为空", trigger: "blur" },
  ],
  familys: [{ required: true, message: "家庭成员至少填一位", trigger: "blur" }],

  college: [{ required: true, message: "院系不能为空", trigger: "blur" }],
  major: [{ required: true, message: "专业不能为空", trigger: "blur" }],
  classstr: [{ required: true, message: "所属班级不能为空", trigger: "blur" }],

  oprovince: [{ required: true, message: "籍贯省不能为空", trigger: "blur" }],
  ocity: [{ required: true, message: "籍贯市不能为空", trigger: "blur" }],
  odistrict: [{ required: true, message: "籍贯县不能为空", trigger: "blur" }],

  province: [{ required: true, message: "省不能为空", trigger: "blur" }],
  city: [{ required: true, message: "市不能为空", trigger: "blur" }],
  district: [{ required: true, message: "县不能为空", trigger: "blur" }],

  school: [{ required: true, message: "校区不能为空", trigger: "blur" }],
  build: [{ required: true, message: "楼栋不能为空", trigger: "blur" }],
  dormitory: [{ required: true, message: "寝室号不能为空", trigger: "blur" }],
  bed: [{ required: true, message: "床位号不能为空", trigger: "blur" }],
});
// 家庭人员 Start
const addfamilysRef = ref();
const addfamilysVisible = ref(false);
const infoDialogVisible = ref(false); // 详情弹窗
const addfamilysTitle = ref();
const addfamilysRuleForm = reactive({
  name: "",
  familyShip: "",
  workUnit: "",
  phone: "",
});
const addfamilysRules = reactive({
  name: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
  familyShip: [{ required: true, message: "称谓不能为空", trigger: "blur" }],
  workUnit: [{ required: true, message: "工作单位不能为空", trigger: "blur" }],
  phone: [
    { required: true, message: "联系电话不能为空", trigger: "blur" },
    {
      min: 8,
      max: 20,
      pattern: /^1[3-9]\d{9}$/,
      message: "手机号码格式有误，请重新输入",
      trigger: "blur",
    },
  ],
});
// 家庭成员 End

// 学院
const collegeData = ref([]);
// 专业
const majorData = ref([]);
const majorFormData = ref([]);
// 班级
const classstrData = ref([]);
const classstrFormData = ref([]);

const collegeList = async () => {
  collegeData.value = collegeRole.value;
  // let res = await https.get("/welcome/api/welcomeOrg/getColleges", "params");
  // console.log(res, "学院数据");
  // if (res.code == 200) {
  //   collegeData.value = res.data;
  // } else {
  //   ElMessage({
  //     type: "error",
  //     showClose: true,
  //     message: res.message,
  //     center: true,
  //   });
  // }
};
const majorList = async (flag) => {
  let params = {
    collegeId: flag ? flag : searchInput.college,
  };
  let res = await https.get(
    "/welcome/api/welcomeOrg/getMajors",
    "params",
    params
  );
  console.log(res, "专业数据");
  if (res.code == 200) {
    if (flag) {
      majorFormData.value = res.data;
    } else {
      majorData.value = res.data;
    }
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const classstrList = async (flag) => {
  let params = {
    majorId: flag ? flag : searchInput.major,
  };
  let res = await https.get(
    "/welcome/api/welcomeOrg/getClasss",
    "params",
    params
  );
  console.log(res, "班级数据");
  if (res.code == 200) {
    if (flag) {
      classstrFormData.value = res.data;
    } else {
      classstrData.value = res.data;
    }
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const collegeChange = async (val) => {
  console.log(val);
  searchInput.major = null;
  searchInput.classstr = null;
  if (!val) {
    majorData.value = null;
    classstrData.value = null;
    return;
  } else {
    majorData.value = null;
    classstrData.value = null;
  }
  majorList();
};
const collegeFormChange = async (val) => {
  console.log(val);
  ruleForm.major = null;
  ruleForm.classstr = null;
  if (!val) {
    majorFormData.value = null;
    classstrFormData.value = null;
    return;
  } else {
    majorFormData.value = null;
    classstrFormData.value = null;
  }
  majorList(ruleForm.college.split(",")[1]);
};
const majorChange = async (val) => {
  console.log(val);
  searchInput.classstr = null;
  if (!val) {
    classstrData.value = null;
    return;
  } else {
    classstrData.value = null;
  }
  classstrList();
};
const majorFormChange = async (val) => {
  console.log(val);
  ruleForm.classstr = null;
  if (!val) {
    classstrFormData.value = null;
    return;
  } else {
    classstrFormData.value = null;
  }
  classstrList(ruleForm.major.split(",")[1]);
};

// 家庭住址
const provinceData = ref([]);
const ocityData = ref([]); //籍贯
const odistrictData = ref([]); //籍贯

const cityData = ref([]); // 家庭住址
const districtData = ref([]); // 家庭住址

const provinceList = async () => {
  let res = await https.get(
    "/welcome/api/welcomeCity/getProvinceLevel",
    "params"
  );
  console.log(res, "省数据");
  if (res.code == 200) {
    provinceData.value = res.data;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const cityList = async (flag) => {
  let params = null;
  if (flag == "籍贯") {
    params = {
      provinceId: ruleForm.oprovince.split(",")[1],
    };
  } else {
    params = {
      provinceId: ruleForm.province.split(",")[1],
    };
  }

  let res = await https.get(
    "/welcome/api/welcomeCity/getCityLevel",
    "params",
    params
  );
  console.log(res, "市数据");
  if (res.code == 200) {
    if (flag == "籍贯") {
      ocityData.value = res.data;
    } else {
      cityData.value = res.data;
    }
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const districtList = async (flag) => {
  let params = null;
  if (flag == "籍贯") {
    params = {
      cityId: ruleForm.ocity.split(",")[1],
    };
  } else {
    params = {
      cityId: ruleForm.city.split(",")[1],
    };
  }

  let res = await https.get(
    "/welcome/api/welcomeCity/getDistrictLevel",
    "params",
    params
  );
  console.log(res, "区数据");
  if (res.code == 200) {
    if (flag == "籍贯") {
      odistrictData.value = res.data;
    } else {
      districtData.value = res.data;
    }
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const oprovinceChange = async (val) => {
  console.log(val);
  ruleForm.ocity = null;
  ruleForm.odistrict = null;
  if (!val) {
    ocityData.value = null;
    odistrictData.value = null;
    return;
  } else {
    ocityData.value = null;
    odistrictData.value = null;
  }
  cityList("籍贯");
};
const ocityChange = async (val) => {
  console.log(val);
  ruleForm.odistrict = null;
  if (!val) {
    odistrictData.value = null;
    return;
  } else {
    odistrictData.value = null;
  }
  districtList("籍贯");
};
const provinceChange = async (val) => {
  console.log(val);
  ruleForm.city = null;
  ruleForm.district = null;
  if (!val) {
    cityData.value = null;
    districtData.value = null;
    return;
  } else {
    cityData.value = null;
    districtData.value = null;
  }
  cityList();
};
const cityChange = async (val) => {
  console.log(val);
  ruleForm.district = null;
  if (!val) {
    districtData.value = null;
    return;
  } else {
    districtData.value = null;
  }
  districtList();
};

const arriveData = ref([]); // 到站时间段
const arriveList = async () => {
  let res = await https.get(
    "/welcome/api/welcomeArriveSetting/queryArriveTimes",
    "params"
  );
  console.log(res, "时间段数据");
  if (res.code == 200) {
    arriveData.value = res.data;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};

// 宿舍信息
const schoolData = ref([]);
const buildData = ref([]);
const dormitoryData = ref([]);
const bedData = ref([]);

const schoolList = async () => {
  let res = await https.get("/welcome/api/welcome-build/schoolGroup", "params");
  console.log(res, "校区数据");
  if (res.code == 200) {
    schoolData.value = res.data;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const buildList = async () => {
  let params = {
    schoolId: ruleForm.school.split(",")[1],
  };
  let res = await https.get(
    "/welcome/api/welcome-build/buildGroup",
    "params",
    params
  );
  console.log(res, "楼栋数据");
  if (res.code == 200) {
    buildData.value = res.data;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const dormitoryList = async () => {
  let params = {
    schoolId: ruleForm.school.split(",")[1],
    buildId: ruleForm.build.split(",")[1],
  };
  let res = await https.get(
    "/welcome/api/welcome-dormitory/dormitoryGroup",
    "params",
    params
  );
  console.log(res, "寝室号数据");
  if (res.code == 200) {
    dormitoryData.value = res.data;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const bedList = async () => {
  let params = {
    dormitoryId: ruleForm.dormitory.split(",")[1],
  };
  let res = await https.get(
    "/welcome/api/welcomeBed/queryBedDatas",
    "params",
    params
  );
  console.log(res, "床位号数据");
  if (res.code == 200) {
    bedData.value = res.data;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};

const schoolChange = (val) => {
  ruleForm.build = null;
  ruleForm.dormitory = null;
  ruleForm.bed = null;
  if (!val) {
    buildData.value = null;
    dormitoryData.value = null;
    bedData.value = null;
    return;
  } else {
    buildData.value = null;
    dormitoryData.value = null;
    bedData.value = null;
  }
  buildList();
};
const buildChange = async (val) => {
  ruleForm.dormitory = null;
  ruleForm.bed = null;
  if (!val) {
    dormitoryData.value = null;
    bedData.value = null;
    return;
  } else {
    dormitoryData.value = null;
    bedData.value = null;
  }
  dormitoryList();
};
const dormitoryChange = async (val) => {
  ruleForm.bed = null;
  if (!val) {
    bedData.value = null;
    return;
  } else {
    bedData.value = null;
  }
  bedList();
};

// 导入
const buildImportVisible = ref(false);
const buildRef = ref();
const buildFile = ref();
const buildImportLoading = ref(false);

// 获取账户列表
const getList = async () => {
  loading.value = true;
  let params = {
    currentPage: currentPage.value, // 当前页
    pageCount: pageSize.value, // 一页数据条数
    collegeId: searchInput.college,
    majorId: searchInput.major,
    classstrId: searchInput.classstr,
    trafficMethod: searchInput.trafficMethod,
    name: searchInput.name,
    fillStatus: searchInput.fillStatus,
    isRegistered: searchInput.isRegistered,
  };
  console.log(params);

  let res = await https.get(
    "/welcome/api/welcomeStudent/queryPageStudents",
    "params",
    params
  );
  console.log(res, "学生信息");
  if (res.code == 200) {
    tableData.list = res.data.list;
    total.value = res.data.totalCount;
    loading.value = false;
  } else {
    loading.value = false;
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};

// 搜索功能
const searchBtn = lodash.debounce(async () => {
  getList();
}, 300);
// 搜索功能
const resetBtn = lodash.debounce(async () => {
  searchInput.college = null;
  searchInput.major = null;
  majorData.value = null;
  searchInput.classstr = null;
  classstrData.value = null;
  searchInput.trafficMethod = null;
  searchInput.name = null;
  searchInput.fillStatus = null;
  searchInput.isRegistered = null;
  getList();
}, 300);

// 家庭成员添加
const familysAdd = () => {
  addfamilysTitle.value = "添加家庭成员";
  addfamilysVisible.value = true;
  addfamilysRuleForm.name = null;
  addfamilysRuleForm.familyShip = null;
  addfamilysRuleForm.workUnit = null;
  addfamilysRuleForm.phone = null;
};
const familysDel = (scope) => {
  console.log(scope.$index);
  ruleForm.familys = ruleForm.familys.filter((i, ind) => {
    return scope.$index != ind;
  });
};
const accompanysDel = (scope) => {
  console.log(scope.$index);
  ruleForm.accompanys = ruleForm.accompanys.filter((i, ind) => {
    return scope.$index != ind;
  });
};
const cancelAddfamilys = () => {
  addfamilysVisible.value = false;
  addfamilysRef.value;
};
// 陪同人员添加 （陪同人员 Start）
const accompanysAdd = () => {
  addfamilysTitle.value = "添加陪同人员";
  addfamilysVisible.value = true;
  addfamilysRuleForm.name = null;
  addfamilysRuleForm.familyShip = null;
  addfamilysRuleForm.workUnit = null;
  addfamilysRuleForm.phone = null;
};
const submitAddfamilys = lodash.debounce(async (formEl) => {
  if (!formEl) return;
  await formEl.validate(async (valid, fields) => {
    if (valid) {
      if (addfamilysTitle.value == "添加家庭成员") {
        ruleForm.familys.push({
          familyShip: addfamilysRuleForm.familyShip,
          name: addfamilysRuleForm.name,
          workUnit: addfamilysRuleForm.workUnit,
          phone: addfamilysRuleForm.phone,
        });
      } else if (addfamilysTitle.value == "添加陪同人员") {
        ruleForm.accompanys.push({
          name: addfamilysRuleForm.name,
          phone: addfamilysRuleForm.phone,
        });
      }
      addfamilysVisible.value = false;
    } else {
      console.log("error submit!", fields);
      loading.value = false;
    }
  });
}, 1000);

// 陪同人员添加 （陪同人员 End）

// 添加账号
const addlist = () => {
  dialongTitle.value = "新增学生信息";
  addDialogVisible.value = true;
  ruleForm.school = null;
  ruleForm.picture = null;
  ruleForm.admissNum = null;
  ruleForm.name = null;
  ruleForm.cardId = null;
  ruleForm.sex = null;
  ruleForm.birthday = null;
  ruleForm.college = null;
  ruleForm.major = null;
  majorFormData.value = [];
  ruleForm.classstr = null;
  classstrFormData.value = [];
  ruleForm.examNum = null;
  ruleForm.eduSystem = null;
  ruleForm.graduationSchool = null;
  ruleForm.batchValue = null;
  ruleForm.politicalStatu = null;
  ruleForm.nationality = null;

  // 填报明细
  ruleForm.phone = null;
  ruleForm.oprovince = null;
  ruleForm.ocity = null;
  ocityData.value = [];
  ruleForm.odistrict = null;
  odistrictData.value = [];
  ruleForm.province = null;
  ruleForm.city = null;
  cityData.value = [];
  ruleForm.district = null;
  districtData.value = [];
  ruleForm.address = null;
  ruleForm.registerOntime = 0; // 按时报到
  ruleForm.zipCode = null; // 邮编
  ruleForm.trafficMethod = null;
  ruleForm.arrive = null;
  ruleForm.arrvieDate = null;
  ruleForm.arriveTime = null;

  // 家庭成员
  ruleForm.familys = [];

  // 缴费信息
  ruleForm.amountPayable = null;
  ruleForm.payAmount = null;

  // 车辆信息
  ruleForm.carNumber = null;

  ruleForm.fillStatus = null;
  ruleForm.id = null;
};
// 添加账号
const updateS = async (row) => {
  console.log(row);
  dialongTitle.value = "编辑学生信息";
  addDialogVisible.value = true;
  ruleForm.id = row.id;
  ruleForm.fillStatus = row.fillStatus;

  ruleForm.oprovince = null;
  ruleForm.ocity = null;
  ruleForm.odistrict = null;
  ruleForm.province = null;
  ruleForm.city = null;
  ruleForm.district = null;

  let data = {
    id: row.id, // 当前页
  };
  let res = await https.get(
    "/welcome/api/welcomeStudent/queryStudentDetail",
    "params",
    data
  );
  if (res.code == 200) {
    console.log(res.data, "学生信息");
    let resData = res.data;
    ruleForm.picture = resData.picture;
    ruleForm.admissNum = resData.admissNum;
    ruleForm.name = resData.name;
    ruleForm.cardId = resData.cardId;
    ruleForm.sex = resData.sex;
    ruleForm.birthday = resData.birthday;

    ruleForm.school = `${resData.school},${resData.schoolId}`;
    ruleForm.college = `${resData.college},${resData.collegeId}`;
    majorList(resData.collegeId).then(() => {
      ruleForm.major = `${resData.major},${resData.majorId}`;
      classstrList(resData.majorId).then(() => {
        if (resData.classstr) {
          ruleForm.classstr = `${resData.classstr},${resData.classstrId}`;
        } else {
          ruleForm.classstr = null;
        }
      });
    });

    ruleForm.examNum = resData.examNum;
    ruleForm.eduSystem = resData.eduSystem;
    ruleForm.graduationSchool = resData.graduationSchool;
    ruleForm.batchValue = resData.batchValue;
    ruleForm.politicalStatu = resData.politicalStatu;
    ruleForm.nationality = resData.nationality;

    // 填报明细
    ruleForm.phone = resData.phone;

    if (resData.oprovince) {
      ruleForm.oprovince = `${resData.oprovince},${resData.oprovinceId}`;
      cityList("籍贯").then(() => {
        if (resData.ocity) {
          ruleForm.ocity = `${resData.ocity},${resData.ocityId}`;
          districtList("籍贯").then(() => {
            if (resData.odistrict) {
              ruleForm.odistrict = `${resData.odistrict},${resData.odistrictId}`;
            }
          });
        }
      });
    }

    if (resData.province) {
      ruleForm.province = `${resData.province},${resData.provinceId}`;
      cityList().then(() => {
        if (resData.city) {
          ruleForm.city = `${resData.city},${resData.cityId}`;
          districtList().then(() => {
            if (resData.district) {
              ruleForm.district = `${resData.district},${resData.districtId}`;
            }
          });
        }
      });
    }

    ruleForm.address = resData.address;

    ruleForm.registerOntime = resData.registerOntime ? 1 : 0; // 按时报到
    ruleForm.zipCode = resData.zipCode; // 邮编
    ruleForm.trafficMethod = resData.trafficMethod;
    ruleForm.arrive = resData.arrive;
    ruleForm.arrvieDate = resData.arrvieDate
      ? resData.arrvieDate.split(" ")[0]
      : "";

    ruleForm.arriveTime = resData.arriveTime
      ? `${resData.arriveTime},${resData.arriveTimeId}`
      : "";

    // 家庭成员
    ruleForm.familys = resData.fvs;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const deleteS = async (row) => {
  ElMessageBox.confirm("是否删除此数据?", "提示!!!", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(async () => {
      let data = {
        id: row.id, // 当前页
      };
      let res = await https.get(
        "/welcome/api/welcomeStudent/deleteStudentInfo",
        "params",
        data
      );
      if (res.code == 200) {
        ElMessage({
          type: "success",
          showClose: true,
          message: res.message,
          center: true,
        });
        getList();
      } else {
        ElMessage({
          type: "error",
          showClose: true,
          message: res.message,
          center: true,
        });
      }
    })
    .catch(() => {
      loading.value = false;
    });
};
const registerS = async (row, flag) => {
  if (flag == 1) {
    let data = {
      id: row.id,
      isRegistered: flag, //已报到：1，未报到：2，为空默认是未报到
    };
    let res = await https.post(
      "/welcome/api/welcomeStudent/isRegistered",
      "data",
      data
    );
    if (res.code == 200) {
      ElMessage({
        type: "success",
        showClose: true,
        message: res.message,
        center: true,
      });
      getList();
    } else {
      ElMessage({
        type: "error",
        showClose: true,
        message: res.message,
        center: true,
      });
    }
  } else if (flag != 1) {
    ElMessageBox.confirm("是否取消报到?", "提示!!!", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(async () => {
        let data = {
          id: row.id,
          isRegistered: flag, //已报到：1，未报到：2，为空默认是未报到
        };
        let res = await https.post(
          "/welcome/api/welcomeStudent/isRegistered",
          "data",
          data
        );
        if (res.code == 200) {
          ElMessage({
            type: "success",
            showClose: true,
            message: res.message,
            center: true,
          });
          getList();
        } else {
          ElMessage({
            type: "error",
            showClose: true,
            message: res.message,
            center: true,
          });
        }
      })
      .catch(() => {
        loading.value = false;
      });
  }
};
const arriveTimeChange = (val) => {
  console.log(val);
};

// 详情弹窗
const infoStudent = async (row) => {
  console.log(row);
  infoDialogVisible.value = true;
  ruleForm.picture = null;
  ruleForm.admissNum = null;
  ruleForm.name = null;
  ruleForm.cardId = null;
  ruleForm.sex = null;
  ruleForm.birthday = null;
  ruleForm.college = null;
  ruleForm.major = null;
  majorFormData.value = [];
  ruleForm.classstr = null;
  classstrFormData.value = [];
  ruleForm.examNum = null;
  ruleForm.eduSystem = null;
  ruleForm.graduationSchool = null;
  ruleForm.batchValue = null;
  ruleForm.politicalStatu = null;
  ruleForm.nationality = null;

  // 填报明细
  ruleForm.phone = null;
  ruleForm.oprovince = null;
  ruleForm.ocity = null;
  ocityData.value = [];
  ruleForm.odistrict = null;
  odistrictData.value = [];
  ruleForm.province = null;
  ruleForm.city = null;
  cityData.value = [];
  ruleForm.district = null;
  districtData.value = [];
  ruleForm.address = null;
  ruleForm.registerOntime = 0; // 按时报到
  ruleForm.zipCode = null; // 邮编
  ruleForm.trafficMethod = null;
  ruleForm.arrive = null;
  ruleForm.arrvieDate = null;
  ruleForm.arriveTime = null;

  // 家庭成员
  ruleForm.familys = [];
  // 陪同人员
  ruleForm.accompanys = [];

  // 宿舍信息
  ruleForm.school = null;
  ruleForm.build = null;
  buildData.value = [];
  ruleForm.dormitory = null;
  dormitoryData.value = [];
  ruleForm.bed = null;
  bedData.value = [];

  // 缴费信息
  ruleForm.amountPayable = null;
  ruleForm.payAmount = null;

  // 车辆信息
  ruleForm.carNumber = null;

  ruleForm.id = null;

  let data = {
    id: row.id, // 当前页
  };
  let res = await https.get(
    "/welcome/api/welcomeStudent/queryStudentDetail",
    "params",
    data
  );
  if (res.code == 200) {
    console.log(res.data, "学生信息");
    let resData = res.data;
    ruleForm.picture = resData.picture;
    ruleForm.admissNum = resData.admissNum;
    ruleForm.name = resData.name;
    ruleForm.cardId = resData.cardId;
    ruleForm.sex = resData.sex;
    ruleForm.birthday = resData.birthday;

    ruleForm.college = resData.college;
    ruleForm.major = resData.major;
    ruleForm.classstr = resData.classstr;

    ruleForm.examNum = resData.examNum;
    ruleForm.eduSystem = resData.eduSystem;
    ruleForm.graduationSchool = resData.graduationSchool;
    ruleForm.batchValue = resData.batchValue;
    ruleForm.politicalStatu = resData.politicalStatu;
    ruleForm.nationality = resData.nationality;

    // 填报明细
    ruleForm.phone = resData.phone;

    ruleForm.oprovince = resData.oprovince;
    ruleForm.ocity = resData.ocity;
    ruleForm.odistrict = resData.odistrict;

    ruleForm.province = resData.province;
    ruleForm.city = resData.city;
    ruleForm.district = resData.district;
    ruleForm.address = resData.address;

    ruleForm.registerOntime = resData.registerOntime ? 1 : 0; // 按时报到
    ruleForm.zipCode = resData.zipCode; // 邮编
    ruleForm.trafficMethod = resData.trafficMethod;
    ruleForm.arrive = resData.arrive;
    ruleForm.arrvieDate =
      resData.arrvieDate != null ? resData.arrvieDate.split(" ")[0] : "";
    ruleForm.arriveTime = resData.arriveTime
      ? `${resData.arriveTime},${resData.arriveTimeId}`
      : "";

    // 家庭成员
    ruleForm.familys = resData.fvs;
    // 陪同人员
    ruleForm.accompanys = resData.avs;

    // 宿舍信息
    ruleForm.build = resData.build;
    ruleForm.dormitory = resData.dormitory;
    ruleForm.bed = resData.bed;
    ruleForm.school = resData.school;

    // 缴费信息
    ruleForm.amountPayable = resData.amountPayable;
    ruleForm.payAmount = resData.payAmount;

    // 车辆信息
    ruleForm.carNumber = resData.carNumber;

    ruleForm.id = row.id;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const cancelInfo = () => {
  infoDialogVisible.value = false;
};

// 照片上传
const pictureRemove = (uploadFile, uploadFiles) => {
  console.log(uploadFile, uploadFiles);
  ruleForm.picture = "";
};
// 限制上传图片的大小
const beforeAvatarPicture = (rawFile) => {
  console.log(rawFile, 33333);
  if (rawFile.type !== "image/jpeg" && rawFile.type !== "image/png") {
    ElMessage.error("图片格式必须为JPG/PNG格式!");
    return false;
  } else if (rawFile.size / 1024 > 500) {
    ElMessage.error("图片的大小不能超过500kb!");
    return false;
  }
  return true;
};

const pictureImportChange = async (file, fileLists) => {
  console.log(file, "1111");
  if (!beforeAvatarPicture(file.raw)) {
    // 如果 beforeAvatarPicture 返回了 false，直接退出
    return;
  }
  let srcImg = file.raw;
  let data = new FormData();
  data.set("file", srcImg);
  let res = await https.post(
    "/welcome/api/welcomeFile/uploadFile",
    "data",
    data
  );
  console.log(res, "导入照片");
  if (res.code == 200) {
    ruleForm.picture = res.data.url;
    ElMessage({
      type: "success",
      showClose: true,
      message: res.message,
      center: true,
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};

// 确认添加员工
const submitAdd = lodash.debounce(async (formEl) => {
  if (!formEl) return;
  await formEl.validate(async (valid, fields) => {
    if (valid) {
      let data = {
        admissNum: ruleForm.admissNum,
        name: ruleForm.name,
        picture: ruleForm.picture,
        cardId: ruleForm.cardId,
        sex: ruleForm.sex,
        birthday: ruleForm.birthday,
        college: ruleForm.college.split(",")[0],
        collegeId: ruleForm.college.split(",")[1],
        school: ruleForm.school.split(",")[0],
        schoolId: ruleForm.school.split(",")[1],
        major: ruleForm.major.split(",")[0],
        majorId: ruleForm.major.split(",")[1],
        classstr: ruleForm.classstr.split(",")[0],
        classstrId: ruleForm.classstr.split(",")[1],
        examNum: ruleForm.examNum,
        eduSystem: ruleForm.eduSystem,
        graduationSchool: ruleForm.graduationSchool,
        batchValue: ruleForm.batchValue,
        politicalStatu: ruleForm.politicalStatu,
        nationality: ruleForm.nationality,
        phone: ruleForm.phone,
        oprovince: ruleForm.oprovince ? ruleForm.oprovince.split(",")[0] : "",
        oprovinceId: ruleForm.oprovince ? ruleForm.oprovince.split(",")[1] : "",
        ocity: ruleForm.ocity ? ruleForm.ocity.split(",")[0] : "",
        ocityId: ruleForm.ocity ? ruleForm.ocity.split(",")[1] : "",
        odistrict: ruleForm.odistrict ? ruleForm.odistrict.split(",")[0] : "",
        odistrictId: ruleForm.odistrict ? ruleForm.odistrict.split(",")[1] : "",
        province: ruleForm.province ? ruleForm.province.split(",")[0] : "",
        provinceId: ruleForm.province ? ruleForm.province.split(",")[1] : "",
        city: ruleForm.city ? ruleForm.city.split(",")[0] : "",
        cityId: ruleForm.city ? ruleForm.city.split(",")[1] : "",
        district: ruleForm.district ? ruleForm.district.split(",")[0] : "",
        districtId: ruleForm.district ? ruleForm.district.split(",")[1] : "",
        address: ruleForm.address,
        registerOntime: ruleForm.registerOntime,
        zipCode: ruleForm.zipCode,
        trafficMethod: ruleForm.trafficMethod,
        arrive: ruleForm.arrive,
        arrvieDate: ruleForm.arrvieDate
          ? `${ruleForm.arrvieDate} 00:00:00`
          : "",
        arriveTime: ruleForm.arriveTime
          ? ruleForm.arriveTime.split(",")[0]
          : "",
        arriveTimeId: ruleForm.arriveTime
          ? ruleForm.arriveTime.split(",")[1]
          : "",
        build: "",
        buildId: "",
        dormitory: "",
        dormitoryId: "",
        bed: "",
        bedId: "",
        fvs: ruleForm.familys,
        avs: "",
      };
      console.log(data);

      if (ruleForm.id) {
        data.id = ruleForm.id;
        let res = await https.post(
          "/welcome/api/welcomeStudent/updateStudentInfo",
          "data",
          data
        );
        if (res.code == 200) {
          addDialogVisible.value = false;
          getList();
          ElMessage({
            type: "success",
            showClose: true,
            message: res.message,
            center: true,
          });
        } else {
          ElMessage({
            type: "error",
            showClose: true,
            message: res.message,
            center: true,
          });
        }
      } else {
        let res = await https.post(
          "/welcome/api/welcomeStudent/insertStudentInfo",
          "data",
          data
        );
        if (res.code == 200) {
          addDialogVisible.value = false;
          getList();
          ElMessage({
            type: "success",
            showClose: true,
            message: res.message,
            center: true,
          });
        } else {
          ElMessage({
            type: "error",
            showClose: true,
            message: res.message,
            center: true,
          });
        }
      }
    } else {
      console.log("error submit!", fields);
      loading.value = false;
    }
  });
}, 1000);
const cancelAdd = () => {
  addDialogVisible.value = false;
};

// 表格斑马纹颜色修改
const tableRowClassName = ({ row, rowIndex }) => {
  if (rowIndex % 2 === 0) {
    return "even";
  } else if (rowIndex % 2 !== 0) {
    return "odd";
  }
  return "";
};
// 每页显示条数
const handleSizeChange = (value) => {
  console.log(value, "每页显示条数");
  pageSize.value = value;
  getList();
};
// 分页
const handleCurrentChange = (value) => {
  // console.log(value);
  currentPage.value = value;
  getList();
};

// 楼栋导出
const buildExportbtn = async () => {
  let params = {
    collegeId: searchInput.college,
    majorId: searchInput.major,
    classstrId: searchInput.classstr,
    trafficMethod: searchInput.trafficMethod,
    name: searchInput.name,
    fillStatus: searchInput.fillStatus,
    isRegistered: searchInput.isRegistered,
  };
  let res = await https.getBlob(
    "/welcome/api/welcomeStudent/welcomeStudentExport",
    "params",
    params
  );
  console.log(res, "学生信息导出");
  let name = `学生信息管理`;
  var content = res;
  var datas = new Blob([content]);
  var downloadUrl = window.URL.createObjectURL(datas);
  var anchor = document.createElement("a");
  anchor.href = downloadUrl;
  anchor.download = name + ".xlsx";
  anchor.click();
  window.URL.revokeObjectURL(datas);
  ElMessage({
    type: "success",
    showClose: true,
    message: "导出成功",
    center: true,
  });
};
// 楼栋导入 (--------------------------------------------------)
const buildImportBtn = () => {
  buildImportVisible.value = true;
};
// 模板下载
const templateDown = async () => {
  let res = await https.get(
    "/welcome/api/welcomeStudent/downloadStudentExcel",
    "params"
  );
  console.log(res, "模板下载");
  if (res.code == 200) {
    window.location.href = res.data;
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
// 移出照片
const projectImportRemove = (uploadFile, uploadFiles) => {
  console.log(uploadFile, uploadFiles);
  buildFile.value = "";
};
// 限制上传图片的大小
// const beforeAvatarProImport = (rawFile) => {
//   console.log(rawFile, 33333);
//   if (rawFile.type !== "image/jpeg" && rawFile.type !== "image/png") {
//     ElMessage.error("图片格式必须为JPG/PNG格式!");
//     return false;
//   } else if (rawFile.size / 1024 > 150) {
//     ElMessage.error("图片的大小不能超过150kb!");
//     return false;
//   }
//   return true;
// };
// 添加照片时往fileList列表中添加图片信息
const projectImportChange = async (file, fileLists) => {
  console.log(file, "1111");
  buildFile.value = file.raw;
};

const projectImportExceed = (files) => {
  buildRef.value.clearFiles();
  const file = files[0];
  file.uid = genFileId();
  buildRef.value.handleStart(file);
};
// 导入项目
const projectImportConfirm = async () => {
  buildImportLoading.value = true;

  let data = new FormData();
  data.set("file", buildFile.value);
  let res = await https.post(
    "/welcome/api/welcomeStudent/importStudentExcel",
    "data",
    data
  );
  console.log(res, "导入项目");
  if (res.code == 200) {
    buildImportVisible.value = false;

    buildImportLoading.value = false;
    getList();
    ElMessage({
      type: "success",
      showClose: true,
      message: res.message,
      center: true,
    });
  } else {
    ElMessage({
      type: "error",
      showClose: true,
      message: res.message,
      center: true,
    });
  }
};
const cancelProjectImport = () => {
  buildImportVisible.value = false;
  if (buildRef.value) {
    buildRef.value.clearFiles();
    buildFile.value = null;
  }
};

onBeforeMount(() => {
  getList();
  collegeList(); // 院系
  schoolList(); // 校区
  provinceList(); // 省
  arriveList(); // 时间段
});
onUnmounted(() => {
  // document.removeEventListener("keyup", Enters);
});
</script>

<style scoped lang="scss">
.content-box {
  width: calc(100% - 40px);
  height: calc(100% - 105px);
  margin: 20px auto;
  background-color: #fff;
  color: #000;
  display: flex;
  flex-direction: column;

  .svg {
    width: 22px;
    height: 22px;
  }

  .left {
    width: calc(100% - 60px);
    height: 60px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ccc;
    color: #000;
    font-size: 18px;
    font-weight: 600;
    .camera {
      margin-right: 15px;
      color: #4392f7;
    }
  }
  .scroll {
    width: calc(100% - 60px);
    height: calc(100% - 61px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;

    .middle {
      width: calc(100%);
      color: #000;
      .filter {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        .search {
          margin-left: 0 !important;
          color: #fff;
        }
        .condition {
          display: flex;
          align-items: center;
          margin: 10px 30px 10px 0;
          :deep(.el-input .el-input__inner) {
            font-size: 14px;
          }
          .el-select {
            width: 200px;
          }
          span {
            margin: 0 10px 0 0;
          }
        }
      }
      .gongneng {
        margin: 10px 0;
        .el-button {
          color: #fff;
          margin-right: 15px;
        }
      }
    }
    .footer {
      width: calc(100%);
      flex: 1;
      margin: 0 auto;
      overflow: auto;

      .el-table--fit {
        height: calc(100% - 60px);
        :deep(.el-table__header-wrapper) {
          background-color: #000;
          font-size: 15px;
          color: #000;
          .cell {
            color: #000;
          }
        }
        :deep(.el-table__row) {
          height: 50px;
          font-size: 15px;
          color: #000;
        }
        :deep(.el-table__row td) {
          padding: 0;
          border: 0;
        }

        .el-button--primary {
          margin-left: 5px;
        }
        :deep(.el-table__body .even) {
          background-color: #fff;
        }
        :deep(.el-table__body .odd) {
          background-color: rgba(240, 243, 247, 1);
        }
        :deep(.options) {
          display: flex;
          justify-content: center;
          align-items: center;
          .info {
            color: rgba(0, 97, 255, 1);
            cursor: pointer;
            margin: 0 15px 0 0;
          }
          .edit {
            margin: 0 15px 0 0;
            color: rgba(0, 186, 173, 1);
            cursor: pointer;
          }
          .delete {
            color: rgba(212, 48, 48, 1);
            cursor: pointer;
          }
        }
      }

      .pageSize {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0 30px;
        height: 60px;

        span {
          color: #000;
        }

        .el-pagination {
          // width: 1600px;
          :deep(.el-pagination__total) {
            color: #000;
          }

          :deep(.el-pagination__goto) {
            color: #000;
          }

          :deep(.el-pagination__classifier) {
            color: #000;
          }

          :deep(.el-input__wrapper) {
            border: 1px solid rgba(0, 0, 0, 1);
            border-radius: 5px;
            box-shadow: none;
          }

          :deep(.el-pager li) {
            margin: 0 5px;
            border: 1px solid rgba(0, 0, 0, 1);
            border-radius: 5px;
            background-color: transparent;
          }

          :deep(.el-pager li.is-active) {
            // background-color: rgba(0, 97, 255, 0.8);
            border: 1px solid rgba(0, 97, 255, 1);
            color: rgba(0, 97, 255, 1);
          }

          :deep(.btn-prev) {
            margin-right: 5px;
            border: 1px solid rgba(0, 0, 0, 1);
            border-radius: 5px;
            background-color: transparent;
          }

          :deep(.btn-next) {
            margin-left: 5px;
            border: 1px solid rgba(0, 0, 0, 1);
            border-radius: 5px;
            background-color: transparent;
          }
        }
      }
    }
  }

  // 添加员工弹窗样式
  :deep(.addStaff) {
    .el-dialog__body {
      height: 680px;
      overflow: auto;
      padding: 20px 20px 10px 20px;
      .el-form {
        .el-form-item__content {
          display: flex;
          align-items: normal;
        }
        // 照片
        .photo {
          display: flex;

          .photo_left {
            cursor: pointer;
            position: relative;
            .el-form-item__content {
              margin-left: 0 !important;
              .el-upload-list {
                display: none;
              }
              .el-upload__tip {
                text-align: center;
              }
            }
            img {
              width: 200px;
              height: 249px;
              opacity: 1;
              border-radius: 7px;
            }
            span {
              position: absolute;
              top: 50%;
              left: 50%;
              transform: translate(-50%, -200%); /* 移动元素自身的一半尺寸 */
              font-size: 30px;
              color: #d4d4d4;
            }
          }
          .photo_middle {
            margin: 0 50px 0 25px;
          }
          .photo_footer {
            .el-form-item {
              .el-form-item__label {
                width: 90px !important;
              }
            }
          }
        }
        .info_title {
          display: flex;
          align-items: center;
          font-size: 16px;
          color: #000;
          img {
            width: 20px;
            cursor: pointer;
          }
        }
        // 填报明细
        .filling_details {
          display: flex;
          flex-wrap: wrap;
          .el-input {
            width: 170px;
          }

          .el-form-item {
            margin-right: 15px;
          }
          // 籍贯
          .native {
            display: flex;
            .el-select {
              width: 170px;
            }
            .el-form-item {
              .el-form-item__label {
                // border: 1px solid red;
                width: 60px !important;
              }
              .el-form-item__content {
                margin-left: 0 !important;
              }
            }
          }
          // 家庭住址
          .family {
            display: flex;
            .el-form-item {
              .el-form-item__label {
                // border: 1px solid red;
                width: 100px !important;
              }
            }
          }
          .email {
            .el-form-item__label {
              // border: 1px solid red;
              width: 60px !important;
            }
            .el-form-item__content {
              margin-left: 0 !important;
            }
          }
          // 交通方式
          .traffic {
            display: flex;
            .el-form-item {
              .el-form-item__label {
                // border: 1px solid red;
                width: 100px !important;
              }
              .el-form-item__content {
                margin-left: 0 !important;
              }
            }
          }
        }
        // 宿舍信息
        .dorm_info {
          display: flex;
          .el-select {
            width: 180px;
          }
          .el-form-item {
            margin-right: 15px;
            .el-form-item__label {
              // border: 1px solid red;
              width: 70px !important;
            }
          }
        }
        .elFormTable {
          .el-form-item__content {
            margin-left: 0 !important;
          }
        }
      }
      .el-input {
        width: 240px;
        .el-input__suffix-inner {
          color: rgba(61, 81, 232, 1);
        }
      }
      .el-select {
        width: 240px;
      }
    }
  }

  :deep(.infoStudent) {
    .el-dialog__body {
      height: 680px;
      overflow: auto;
      padding: 20px 20px 10px 20px;
      .el-form {
        .el-form-item {
          display: flex;
          align-items: center;
          flex-wrap: wrap;
          .title {
            margin-right: 5px;
            font-size: 16px;
            font-weight: 600;
            color: #000;
          }
          .title_content {
            font-size: 16px;
            font-weight: 600;
          }
        }
        // 照片
        .photo {
          display: flex;

          .photo_left {
            position: relative;
            .el-form-item__content {
              margin-left: 0 !important;
              .el-upload-list {
                display: none;
              }
              .el-upload__tip {
                text-align: center;
              }
            }
            img {
              width: 200px;
              height: 249px;
              opacity: 1;
              border-radius: 7px;
            }
          }
          .photo_middle {
            margin: 0 50px 0 25px;
          }
          .photo_footer {
            .el-form-item {
              .el-form-item__label {
                width: 90px !important;
              }
            }
          }
        }
        .info_title {
          display: flex;
          align-items: center;
          font-size: 16px;
          color: #000;
          img {
            width: 20px;
            cursor: pointer;
          }
        }
        // 填报明细
        .filling_details {
          display: flex;
          flex-direction: column;
          .info_content {
            display: flex;
            flex-wrap: wrap;
            .el-form-item {
              margin-bottom: 15px;
            }
          }
          .email {
            display: flex;
            flex-wrap: nowrap;
          }
          // .el-input {
          //   width: 170px;
          // }

          .el-form-item {
            margin-right: 50px;
          }
          // 籍贯
          .native {
            display: flex;
            .el-select {
              width: 170px;
            }
            .el-form-item {
              .el-form-item__label {
                // border: 1px solid red;
                width: 60px !important;
              }
              .el-form-item__content {
                margin-left: 0 !important;
              }
            }
          }
          // 家庭住址
          .family {
            display: flex;
            .el-form-item {
              .el-form-item__label {
                // border: 1px solid red;
                width: 100px !important;
              }
            }
          }
          .email {
            .el-form-item__label {
              // border: 1px solid red;
              width: 60px !important;
            }
            .el-form-item__content {
              margin-left: 0 !important;
            }
          }
          // 交通方式
          .traffic {
            display: flex;
            .el-form-item {
              .el-form-item__label {
                // border: 1px solid red;
                width: 100px !important;
              }
              .el-form-item__content {
                margin-left: 0 !important;
              }
            }
          }
        }
        // 宿舍信息
        .dorm_info {
          display: flex;
          .el-select {
            width: 180px;
          }
          .el-form-item {
            margin-right: 50px;
            .el-form-item__label {
              // border: 1px solid red;
              width: 70px !important;
            }
          }
        }
        .elFormTable {
          .el-form-item__content {
            margin-left: 0 !important;
          }
        }
      }
      .el-input {
        width: 240px;
        .el-input__suffix-inner {
          color: rgba(61, 81, 232, 1);
        }
      }
      .el-select {
        width: 240px;
      }
    }
  }
  :deep(.addfamilys) {
    .el-dialog__body {
      // height: 260px;
      overflow: auto;
      padding: 20px 20px 10px 20px;
      .el-form {
        .el-form-item__content {
          display: flex;
          align-items: normal;
        }
        .options {
          margin-top: 30px;
        }
      }
    }
  }
  // 导入
  :deep(.projectImport) {
    .el-dialog__body {
      padding: 20px 30px 0 30px;
      .title {
        color: red;
      }
      .down {
        span:nth-child(1) {
          color: rgba(127, 127, 127, 1);
        }
        span:nth-child(2) {
          margin-left: 25px;
          color: rgba(2, 167, 240, 1);
          cursor: pointer;
        }
      }
      .options {
        margin: 50px 0 30px 0;
        display: flex;
        flex-direction: row-reverse;
        .queding {
          margin-left: 20px;
          background: linear-gradient(
            90deg,
            rgba(38, 151, 255, 1) 0%,
            rgba(102, 181, 255, 1) 100%
          );
          border: none;
        }
        .quxiao {
          border: 1px solid rgba(43, 151, 252, 1);
          color: rgba(43, 151, 252, 1);
        }
      }
    }
  }
}
</style>
