<template>
  <div class="mod-config">
    <basic-container>
      <el-form :inline="true" :model="dataForm" @keyup.enter="getDataList()" ref="searchForm">
        <el-form-item label="招生计划" prop="groupId">
          <el-select v-model="dataForm.groupId" filterable clearable placeholder="请选择招生计划" size="small"
                     @change="chanMajor" style="width: 150px;">
            <el-option
              v-for="item in planList"
              :key="item.id"
              :label="item.groupName"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="学院" prop="xy">
          <el-select v-model="dataForm.xy" filterable clearable placeholder="请选择学院" size="small" style="width: 130px;">
            <el-option
              v-for="item in deptList"
              :key="item.deptCode"
              :label="item.deptName"
              :value="item.deptCode">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="报名时段" prop="startDate">
          <el-date-picker v-model="dataForm.startDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd" filterable
                          clearable size="small"
                          :picker-options="startDatePicker" type="date" style="width: 150px;"></el-date-picker>
          -
          <el-date-picker v-model="dataForm.endDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd" filterable clearable
                          size="small"
                          :picker-options="endDatePicker" type="date" style="width: 150px;"></el-date-picker>
        </el-form-item>
        <el-form-item label="录取时段" prop="lqStartDate">
          <el-date-picker v-model="dataForm.lqStartDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd" filterable
                          clearable size="small"
                          type="date" style="width: 150px;"></el-date-picker>
          -
          <el-date-picker v-model="dataForm.lqEndDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd" filterable
                          clearable size="small"
                          type="date" style="width: 150px;"></el-date-picker>
        </el-form-item>

        <el-form-item label="录取专业" prop="confirmedMajor">
          <el-select v-model="dataForm.confirmedMajor" filterable clearable placeholder="请选择录取专业" size="small">
            <el-option
              v-for="item in planMajorList"
              :key="item.zydm"
              :label="item.zymc+'('+item.xz+'年制)'"
              :value="item.zydm">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="拟报专业" prop="wishMajorOne">
          <el-select v-model="dataForm.wishMajorOne" filterable clearable placeholder="请选择录取专业" size="small">
            <el-option
              v-for="item in planMajorList"
              :key="item.zydm"
              :label="item.zymc+'('+item.xz+'年制)'"
              :value="item.zydm">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="录取状态" prop="auditStatus">
          <el-select v-model="dataForm.auditStatus" filterable clearable placeholder="请选择录取状态" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in auditStatusList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="唯一号/姓名/身份证号/学校名称" prop="search">
          <el-input v-model="dataForm.search" clearable placeholder="唯一号/姓名/身份证号/学校名称" size="small"></el-input>
        </el-form-item>
        <el-form-item label="文化程度" prop="degreeOfEducation">
          <el-select v-model="dataForm.degreeOfEducation" filterable clearable placeholder="请选择文化程度" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in eduList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否住宿" prop="isAccommodation">
          <el-select v-model="dataForm.isAccommodation" filterable clearable placeholder="请选择是否住宿" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in yesNoList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否低保" prop="isMinimumLivingSecurity">
          <el-select v-model="dataForm.isMinimumLivingSecurity" filterable clearable placeholder="请选择是否低保" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in yesNoList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="经办人" prop="auditor">
          <el-select
            v-model="dataForm.auditor"
            filterable
            remote
            style="width: 90%"
            clearable
            reserve-keyword
            placeholder="请选择经办人"
            :remote-method="remoteTeacherByQuery">
            <el-option
              v-for="item in teacherList"
              :key="item.teacherNo"
              :label="item.realName"
              :value="item.teacherNo">
            </el-option>
          </el-select>
          <!--          <el-select v-model="dataForm.auditor" filterable clearable placeholder="请选择经办人" size="small"-->
<!--                     style="width: 120px;">-->
<!--            <el-option-->
<!--              v-for="item in auditorList"-->
<!--              :key="item.username"-->
<!--              :label="item.realName"-->
<!--              :value="item.username">-->
<!--            </el-option>-->
<!--          </el-select>-->
        </el-form-item>
        <el-form-item label="缴费状态" prop="paystatus">
          <el-select v-model="dataForm.paystatus" filterable clearable placeholder="请选择缴费状态" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in paystatusList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="新市民材料已上传" prop="isNewCity">
          <el-select v-model="dataForm.isNewCity" filterable clearable placeholder="请选择新市民材料已上传" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in yesNoList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="毕业证已上传" prop="graPic">
          <el-select v-model="dataForm.graPic" filterable clearable placeholder="请选择毕业证已上传" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in yesNoList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="推送状态" prop="pushed">
          <el-select v-model="dataForm.pushed" filterable clearable placeholder="请选择推送状态" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in pushedList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="来源" prop="isOut">
          <el-select v-model="dataForm.isOut" filterable clearable placeholder="请选择来源" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in isOutList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="证书发放" prop="isBackTz">
          <el-select v-model="dataForm.isBackTz" filterable clearable placeholder="请选择是否发放" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in isBackTzList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="是否同步学工" prop="isTb">
          <el-select v-model="dataForm.isTb" filterable clearable placeholder="请选择是否同步学工" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in yesNoList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="市局审核" prop="cityExamType">
          <el-select v-model="dataForm.cityExamType" filterable clearable placeholder="请选择市局审核状态" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in cityExamTypeList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="面试结果" prop="interview">
          <el-select v-model="dataForm.interview" filterable clearable placeholder="请选择面试结果" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in interviewDicList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="资料审核状态" prop="zlsh">
          <el-select v-model="dataForm.zlsh" filterable clearable placeholder="请选择资料审核状态" size="small"
                     style="width: 120px;">
            <el-option
              v-for="item in zlshList"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item>
          <el-button icon="el-icon-search" type="primary" size="small"
                     @click="handleFilter()">查询
          </el-button>
          <el-button icon="el-icon-delete" type="normal" plain size="small"
                     @click="resetForm('searchForm')">清空
          </el-button>
          <el-button type="success" v-if="permissions.zipExport"
                     icon="el-icon-download"
                     size="small"
                     @click="downZip()">招生名单打包导出
          </el-button>
          <el-button type="warning"
                     icon="el-icon-download"
                     size="small"
                     @click="handleExport()">名单导出
          </el-button>


          <!--        <el-button type="danger"-->
          <!--                   v-if="permissions.recruit_banding"-->
          <!--                   size="small"-->
          <!--                   @click="oneClassAndStuNo()">一键分班分学号</el-button>-->
          <!--        <el-button type="danger"-->
          <!--                   v-if="permissions.recruit_synchronous_stuwork"-->
          <!--                   size="small"-->
          <!--                   @click="tbStuWork()">同步学工</el-button>-->
          <el-button type="danger"
                     v-if="permissions.recruit_send_img"
                     size="small"
                     @click="sendImg()">图片同步
          </el-button>
        </el-form-item>

      </el-form>


      <div class="avue-crud">
        <el-table
          :data="dataList"
          border
          stripe
          v-loading="dataListLoading">

          <el-table-column
            header-align="center"
            align="center"
            label="操作">
            <template #default="scope">
              <el-button type="text" size="small" icon="el-icon-view" @click="addOrUpdateHandle(scope.row.id,0)">查看
              </el-button>
              <el-button v-if="permissions.recruit_recruitstudentsignup_edit" type="text" size="small"
                         icon="el-icon-edit" @click="edit(scope.row.id)">补材料
              </el-button>

              <el-button
                v-if="permissions.recruit_recruitstudentsignup_interview && scope.row.degreeOfEducation == '3'"
                type="text" size="small"
                icon="el-icon-check" @click="interviewForm(scope.row)">面试
              </el-button>

              <el-button v-if="permissions.recruit_recruitstudentsignup_edit && scope.row.auditStatus=='0'"
                         type="text" size="small" icon="iconfont icon-rizhiguanli"
                         @click="addOrUpdateHandle(scope.row.id,1)">审核
              </el-button>

              <el-button
                v-if="permissions.recruit_recruitstudentsignup_leaveSchool && scope.row.auditStatus=='20' && scope.row.isMajorChange!='1'"
                type="text" size="small" icon="el-icon-circle-close"
                @click="update(scope.row.id,scope.row.groupId,scope.row.feeAgency)">退学
              </el-button>
              <el-button v-if="permissions.recruit_recruitstudentsignup_change && scope.row.auditStatus=='20' "
                         type="text" size="small" icon="iconfont iconbanjiguanli1" @click="majorChange(scope.row.id)">
                调整专业
              </el-button>
              <el-button
                v-if="permissions.recruit_recruitstudentsignup_show && scope.row.pushed=='1' && scope.row.paiedOffline!='10'"
                type="text" icon="el-icon-tickets" size="small" plain @click="showPayCode(scope.row)">支付二维码
              </el-button>
              <!--                  <el-button v-if="permissions.recruit_recruitstudentsignup_show && scope.row.pushed=='1' && scope.row.paiedOffline=='0' && scope.row.auditStatus=='20'" type="text" icon="el-icon-check" size="small" @click="delayPayTimeSet(scope.row)">延迟收费</el-button>-->
              <el-button
                v-if="permissions.recruit_recruitstudentsignup_rePush && scope.row.pushed=='0' && scope.row.auditStatus=='20'"
                type="text" icon="el-icon-check" size="small" plain @click="rePush(scope.row)">重新推送
              </el-button>

              <el-button
                v-if="permissions.recruit_recruitstudentsignup_show && ((scope.row.degreeOfEducation=='1'&& scope.row.isOut=='1' && scope.row.auditStatus=='20')
                || (scope.row.degreeOfEducation=='1'&& scope.row.isOut=='0' && scope.row.paiedOffline!='0' && scope.row.auditStatus=='20')
                || (scope.row.degreeOfEducation=='2' && scope.row.isGradePic=='1' && scope.row.paiedOffline!='0' && scope.row.auditStatus=='20')
                || (scope.row.degreeOfEducation=='3' && scope.row.isGradePic=='1' && scope.row.paiedOffline!='0' && scope.row.auditStatus=='20')
                ) "
                type="text" icon="el-icon-check" size="small" plain @click="lqtz(scope.row)">录取通知书
              </el-button>
              <el-button
                v-if="permissions.recruit_recruitstudentsignup_show && scope.row.paiedOffline!='0' && scope.row.auditStatus=='20'"
                type="text" icon="el-icon-check" size="small" plain @click="infoTable(scope.row)">信息表
              </el-button>
              <el-button v-if="permissions.recruit_recruitstudentsignup_push && scope.row.auditStatus=='20'" type="text"
                         icon="el-icon-upload" size="small" plain @click="pushCity(scope.row.id)">推送市局
              </el-button>
            </template>
          </el-table-column>

          <el-table-column
            prop="serialNumber"
            header-align="center"
            align="center"
            width="120"
            label="唯一号">
          </el-table-column>
          <el-table-column
            prop="name"
            header-align="center"
            align="center"
            width="120"
            label="姓名">
          </el-table-column>

          <el-table-column
            prop="name"
            header-align="center"
            align="left"
            width="250"
            label="资料检测">
            <template #default="scope">
                <div v-if="scope.row.isOut=='0'">
                  <span >资料审核状态:</span>
                  <span style="color: #b4bccc" v-if="scope.row.zlsh=='0'">未填写</span>
                  <span style="color: green" v-if="scope.row.zlsh=='2' && scope.row.isOut=='0'">通过</span>
                  <span style="color: #ff9900" v-if="scope.row.zlsh=='1' && scope.row.isOut=='0'">待审核</span>
                  <span style="color: red" v-if="scope.row.zlsh=='3' && scope.row.isOut=='0'">驳回</span>
                  <br/>
                  <span v-if="scope.row.zlsh !='2'">材料状态:</span>
                  <span style="color: #ff9900" v-if="!scope.row.graPic && scope.row.zlsh !='2'">缺少毕业证</span>
                  <span style="color: #3c763d" v-if="scope.row.degreeOfEducation == '1' && scope.row.isOut == '1'">无需上传</span>
                  <span style="color: #ff9900" v-if="scope.row.degreeOfEducation == '1' && scope.row.zlsh !='2' && !scope.row.yyPic  && !scope.row.housePic && !scope.row.sbPic">, 缺新市民材料</span>
                  <br />
                  <span v-if="scope.row.zlsh=='3' && scope.row.zlshRemark !='' && scope.row.zlshRemark !=null">资料审核意见:</span>
                  <span style="color: red" v-if="scope.row.zlsh=='3' && scope.row.zlshRemark !='' && scope.row.zlshRemark !=null">{{scope.row.zlshRemark}}</span>
                </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="confirmedMajor"
            header-align="center"
            align="left"
            label="录取专业">
            <template #default="scope">
              <span>录取状态：</span>
              <span v-if="scope.row.auditStatus==0"
                    style="color: orange">{{ getLabelValue(auditStatusList, scope.row.auditStatus) }}</span>
              <span v-if="scope.row.auditStatus==20"
                    style="color: green">{{ getLabelValue(auditStatusList, scope.row.auditStatus) }}</span>
              <span v-if="scope.row.auditStatus==-20"
                    style="color: red">{{ getLabelValue(auditStatusList, scope.row.auditStatus) }}</span>
              <br/>
              <div v-if="scope.row.auditStatus==20">
                录取专业：
                {{ getMajorLabelWithYears(planMajorList, scope.row.confirmedMajor, { key: 'zydm', value: 'zymc' }) }}<br/>
              </div>
              <div v-if="scope.row.auditStatus==20">
                录取时间：{{ dateFormat(scope.row.auditTime, "yyyy-MM-dd HH:mm:ss") }}
              </div>
              <div v-if="scope.row.degreeOfEducation == '3'">
                面试结果：{{ getLabelValue(interviewDicList, scope.row.interview) }}
                <span v-if="scope.row.interview == '-1' && scope.row.interviewReason"
                      style="color: #ff9900">({{ scope.row.interviewReason }})</span>
              </div>
              <div v-if="scope.row.confirmedMajor">
                证书发放：
                <span v-if="scope.row.isBackTz=='0'" style="color: red">未发放</span>
                <span v-if="scope.row.isBackTz=='1'" style="color: green">已发放</span>
              </div>
              <div v-if="scope.row.confirmedMajor">
                发放人：
                <span v-if="scope.row.isBackTz=='0'" style="color: red"></span>
                <span v-if="scope.row.isBackTz=='1'" style="color: green">{{ scope.row.sendUserName }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            prop="xy"
            header-align="center"
            align="center"
            width="120"
            label="学院(经办人)">

            <template #default="scope">
              <span v-if="scope.row.auditStatus==20">
                {{ getLabelValueByProps(deptList, scope.row.xy, { key: 'deptCode', value: 'deptName' }) }}
              </span> <br/>
              <span v-if="scope.row.auditStatus==20">
                ({{scope.row.auditorName}})
              </span>

            </template>
          </el-table-column>

          <el-table-column
            prop="paiedOffline"
            header-align="center"
            align="center"
            width="90"
            label="缴费状态">
            <template #default="scope">
              {{ getStatus(scope.row.paiedOffline) }}
            </template>
          </el-table-column>
          <el-table-column
            prop="pushed"
            header-align="center"
            align="center"
            width="90"
            label="推送状态">
            <template #default="scope">
              <span v-if="scope.row.pushed==0" style="color: red">{{ getPushed(scope.row.pushed) }}</span>
              <span v-if="scope.row.pushed==1" style="color: green">{{ getPushed(scope.row.pushed) }}</span>
            </template>
          </el-table-column>

        </el-table>
      </div>

      <div class="avue-crud__pagination">
        <el-pagination
          @size-change="sizeChangeHandle"
          @current-change="currentChangeHandle"
          :current-page="pageIndex"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          :total="totalPage"
          background
          layout="total, sizes, prev, pager, next, jumper">
        </el-pagination>
      </div>
      <!-- 弹窗, 新增 / 修改 -->
      <table-form v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></table-form>

      <major-change v-if="majorChangeVisible" ref="majorChange" @refreshDataList="getDataList"></major-change>

      <update v-if="updateVisible" ref="update" @refreshDataList="getDataList"></update>

      <!-- 支付二维码弹窗 -->
      <pay-qrcode-dialog ref="payQrcodeDialogRef" @refresh="getDataList"></pay-qrcode-dialog>

      <!-- 延迟缴费弹窗 -->
      <delay-pay-time-dialog ref="delayPayTimeDialogRef" @refresh="getDataList"></delay-pay-time-dialog>


      <!-- 录取通知书弹窗 -->
      <admission-notice-dialog ref="admissionNoticeDialogRef" :permissions="permissions" @refresh="getDataList"></admission-notice-dialog>

      <dorm-f-w v-if="dormFWRefVisible" ref="dormFWRef"></dorm-f-w>
      <show-map v-if="baiduMapVisible" ref="baiduMapRef"></show-map>
      <interview-form ref="interviewFormRef" @refresh="getDataList"></interview-form>
    </basic-container>
  </div>
</template>

<script>
import {list} from '/@/api/recruit/recruitstudentplangroup'
import {
  delObj,
  exportZip,
  fetchList,
  leaveSchool,
  rePush,
  yjOut,
  oneClassAndStuNo,
  tbStuWork,
  sendImg,
  pushCity
} from '/@/api/recruit/recruitstudentsignup'
import {defineAsyncComponent} from 'vue'
// import {formatDate} from "element-ui/src/utils/date-util";

// import global from '@/components/tools/commondict' // global 已废弃
import { getLabelValue, getLabelValueByProps, getMajorLabelWithYears } from '/@/utils/dictLabel'
import {getDeptList} from "/@/api/basic/basicclass";
import {listPlanByCondition as planMajor} from "/@/api/recruit/recruitstudentplan";
import {getTypeValue, getDictsByTypes} from "/@/api/admin/dict";
import {getUserListByRole} from "/@/api/admin/user";
import {ROLE_CODE} from "/@/config/global";
import {showLoading, hideLoading} from "/@/api/asset/loading";
import {queryTeacherBaseByNo} from "/@/api/professional/teacherbase";

const TableForm = defineAsyncComponent(() => import('./detaiform.vue'))
const MajorChange = defineAsyncComponent(() => import('./majorChange.vue'))
const Update = defineAsyncComponent(() => import('./update.vue'))
const DormFW = defineAsyncComponent(() => import('./dormFW.vue'))
const ShowMap = defineAsyncComponent(() => import('./showMap.vue'))
const InterviewForm = defineAsyncComponent(() => import('/@/views/recruit/recruitstudentsignup/interviewForm.vue'))
const PayQrcodeDialog = defineAsyncComponent(() => import('./PayQrcodeDialog.vue'))
const DelayPayTimeDialog = defineAsyncComponent(() => import('./DelayPayTimeDialog.vue'))
const AdmissionNoticeDialog = defineAsyncComponent(() => import('./AdmissionNoticeDialog.vue'))

export default {
  data() {
    return {
      dataForm: {
        zlsh:'',
        groupId: '',
        xy: "",
        confirmedMajor: "",
        degreeOfEducation: "",
        isAccommodation: "",
        isMinimumLivingSecurity: "",
        search: "",
        auditor: "",
        isNewCity: "",
        startDate: "",
        endDate: "",
        lqStartDate: '',
        lqEndDate: '',
        paystatus: "",
        graPic: "",
        pushed: "",
        wishMajorOne: "",
        isTb: '',
        cityExamType: ""
      },
      id: "",
      auditorList: [],
      isBackTzList: [{label: "未发放", value: "0"}, {label: "已发放", value: "1"}],
      paystatusList: [],
      global: global,
      planList: [],
      eduList: [],
      planMajorList: [],
      auditStatusList: [{label: "未录取", value: "-20"}, {label: "待审核", value: "0"}, {label: "已录取", value: "20"}],
      yesNoList: [{label: "否", value: "0"}, {label: "是", value: "1"}],
      cityExamTypeList: [{label: "待审核", value: "0"}, {label: "通过", value: "1"}, {label: "驳回", value: "2"}],
      pushedList: [{label: "未推送", value: "0"}, {label: "已推送", value: "1"}],
      isOutFwList: [{label: "待确认", value: "0"}, {label: "范围内", value: "1"}, {label: "范围外", value: "2"}],
      isOutList: [{label: "学校", value: "0"}, {label: "市平台", value: "1"}],
      interviewDicList: [],
      zlshList: [],
      deptList: [],
      dataList: [],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
      addOrUpdateVisible: false,
      majorChangeVisible: false,
      updateVisible: false,
      startDatePicker: this.beginDate(),
      endDatePicker: this.processDate(),

      dormFWRefVisible: false,
      baiduMapVisible: false,
      teacherList:[]
    }
  },
  components: {
    InterviewForm,
    TableForm,
    MajorChange,
    Update,
    DormFW,
    ShowMap,
    PayQrcodeDialog,
    DelayPayTimeDialog,
    AdmissionNoticeDialog
  },
  created() {
    this.init();
  },
  computed: {
  },
  methods: {
    getLabelValue,
    getLabelValueByProps,
    getMajorLabelWithYears,
    dateFormat(date, format) {
      // return formatDate(date, format)
    },
    //检索教师
    remoteTeacherByQuery(query) {
      this.teacherList = []
      if (query !== '') {
        setTimeout(() => {
          queryTeacherBaseByNo(query).then(response => {
            this.teacherList = response.data
          })
        }, 200);
      }
    },
    sendImg() {
      this.$confirm('是否确认同步招生图片到市平台？请谨慎操作', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        return sendImg()
      }).then(data => {
        this.$message.success('同步图片请求已发起,请耐心等待')
      }).catch(function (err) {
        hideLoading()
      })
    },
    tbStuWork() {
      let _this = this;
      if (this.dataForm.groupId == '') {
        this.$message({
          message: '招生计划不能为空',
          type: 'warning'
        });
        return
      }
      this.$confirm('是否确认同步学工？请谨慎操作', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        showLoading()
        return tbStuWork(_this.dataForm)
      }).then(data => {
        hideLoading()//关闭加载
        this.$message.success('同步完成')
      }).catch(function (err) {
        hideLoading()
      })
    },
    oneClassAndStuNo() {
      let _this = this;
      if (this.dataForm.groupId == '') {
        this.$message({
          message: '招生计划不能为空',
          type: 'warning'
        });
        return
      }
      this.$confirm('是否确认一键分配班级和学号？请谨慎操作', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        showLoading()
        return oneClassAndStuNo(_this.dataForm)
      }).then(data => {
        hideLoading()//关闭加载
        this.$message.success('分配完成')
      }).catch(function (err) {
        hideLoading()
      })

    },
    downZip() {
      if (this.dataForm.groupId == '') {
        this.$message({
          message: '招生计划不能为空',
          type: 'warning'
        });
        return
      }
      showLoading()//显示加载中
      exportZip(this.dataForm).then(res => { // 处理返回的文件流
        hideLoading()//关闭加载
        const blob = new Blob([res.data]);
        let fileName = "";
        const elink = document.createElement('a');
        elink.download = "招生名单.zip";
        elink.style.display = 'none';
        elink.href = URL.createObjectURL(blob);
        document.body.appendChild(elink);
        elink.click();
        URL.revokeObjectURL(elink.href); // 释放URL 对象
        document.body.removeChild(elink);
      }).catch(function (err) {
      })

    },
    baiduMap(row) {
      this.baiduMapVisible = true
      this.$nextTick(() => {
        this.$refs.baiduMapRef.init(row)
      })
    },
    setDormFW() {
      this.dormFWRefVisible = true
      this.$nextTick(() => {
        this.$refs.dormFWRef.init()
      })
    },
    yjOut() {
      let _this = this;
      if (this.dataForm.groupId == '') {
        this.$message({
          message: '招生计划不能为空',
          type: 'warning'
        });
        return
      }
      this.$confirm('是否确认一键判断是否超出住宿范围？请谨慎操作', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        return yjOut({groupId: _this.dataForm.groupId})
      }).then(data => {
        this.$message.success('操作成功')
        this.getDataList()
      })
    },
    handleExportAudit(type) {
      if (this.dataForm.groupId == '') {
        this.$message({
          message: '招生计划不能为空',
          type: 'warning'
        });
        return
      }
      this.downFile(type);
    },
    handleExport() {
      if (this.dataForm.groupId == '') {
        this.$message({
          message: '招生计划不能为空',
          type: 'warning'
        });
        return
      }
      this.exportExcel(this.dataForm, '/recruit/recruitstudentsignup/exportData').then(res => { // 处理返回的文件流
        const blob = new Blob([res.data]);
        const elink = document.createElement('a');
        elink.download = "招生名单导出.xls";
        elink.style.display = 'none';
        elink.href = URL.createObjectURL(blob);
        document.body.appendChild(elink);
        elink.click();
        URL.revokeObjectURL(elink.href); // 释放URL 对象
        document.body.removeChild(elink);
      }).catch(function (err) {
      })
    },
    exportExcel: function (form, url) {
      return axios({ // 用axios发送post请求
        method: 'post',
        url: url, // 请求地址
        data: form, // 参数
        responseType: 'blob', // 表明返回服务器返回的数据类型
        headers: {
          'Content-Type': 'application/json'
        }
      })
    },
    downFile(type) {
      let _that = this;
      this.dataForm.type = type;
      this.exportExcel(this.dataForm, '/recruit/recruitstudentsignup/exportExcel').then(res => { // 处理返回的文件流
        const blob = new Blob([res.data]);
        let fileName = "";
        if (type == 1) {
          fileName = '延迟缴费名单导出.xlsx';
        } else {
          fileName = '超时缴费名单导出.xlsx';
        }
        const elink = document.createElement('a');
        elink.download = fileName;
        elink.style.display = 'none';
        elink.href = URL.createObjectURL(blob);
        document.body.appendChild(elink);
        elink.click();
        URL.revokeObjectURL(elink.href); // 释放URL 对象
        document.body.removeChild(elink);
      }).catch(function (err) {
      })
    },
    beginDate() {
      const self = this
      return {
        disabledDate(time) {
          if (self.dataForm.endDate) {  //如果结束时间不为空，则小于结束时间
            return new Date(self.dataForm.endDate).getTime() < time.getTime()
          } else {
          }
        }
      }
    },
    processDate() {
      const self = this
      return {
        disabledDate(time) {
          if (self.dataForm.startDate) {  //如果开始时间不为空，则结束时间大于开始时间
            return new Date(self.dataForm.startDate).getTime() > time.getTime()
          } else {
          }
        }
      }
    },
    init() {
      //查询二级学院信息
      getDeptList().then(data => {
        this.deptList = data.data
      })
      list().then(data => {
        this.planList = data.data
        this.dataForm.groupId = this.planList[0].id;
        this.getDataList()
        this.chanMajor()
      });
      getTypeValue('finance_student_source').then(res => {
        this.eduList = res.data
      })
      // 批量获取字典数据：面试结果、资料审核状态、缴费状态
      getDictsByTypes(['interview_dic', 'recruit_zlsh', 'recruit_pay_status']).then((res) => {
        this.interviewDicList = res.data.interview_dic || []
        this.zlshList = res.data.recruit_zlsh || []
        this.paystatusList = res.data.recruit_pay_status || []
      })
      //所有经办人
      getUserListByRole(ROLE_CODE.ROLE_RECRUIT_SECOND).then(res => {
        this.auditorList = res.data;
        getUserListByRole(ROLE_CODE.ROLE_RECRUIT).then(re => {
          re.data.forEach(r => {
            this.auditorList.push(r)
          });
          this.auditorList = this.unique(this.auditorList);
        });

      });
    },
    unique(arr) {
      const rese = new Map();
      return arr.filter((arr) => !rese.has(arr.username) && rese.set(arr.username, 1))
    },
    //性别
    getGender(gender) {
      if (gender == '2') {
        return '女'
      }
      if (gender == '1') {
        return '男'
      }
    },
    chanMajor() {
      this.planMajorList = [];
      planMajor({groupId: this.dataForm.groupId}).then(data => {
        this.planMajorList = data.data;
      });
    },
    handleFilter() {
      this.pageIndex = 1;
      this.getDataList();
    },
    // 获取数据列表
    getDataList() {
      this.dataList = []
      this.dataListLoading = true
      fetchList(Object.assign({
        current: this.pageIndex,
        size: this.pageSize
      }, this.dataForm)).then(response => {
        this.dataList = response.data.records
        this.totalPage = response.data.total
      })
      this.dataListLoading = false
    },
    // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageIndex = val
      this.getDataList()
    },
    // 新增 / 修改
    addOrUpdateHandle(id, type) {
      this.addOrUpdateVisible = true
      this.$nextTick(() => {
        this.$refs.addOrUpdate.init(id, type)
      })
    },
    // 新增 / 修改
    edit(id) {
      this.updateVisible = true
      this.$nextTick(() => {
        this.$refs.update.init(id)
      })
    },
    majorChange(id) {
      this.majorChangeVisible = true
      this.$nextTick(() => {
        this.$refs.majorChange.init(id)
      })
    },
    update(id, groupId, feeAgency) {
      this.$confirm('是否确认办理退学操作？请谨慎操作', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        return leaveSchool({id: id, groupId: groupId, feeAgency: feeAgency})
      }).then(data => {
        this.$message.success('操作成功')
        this.getDataList()
      })
    },
    // 删除
    deleteHandle(id) {
      this.$confirm('是否确认删除本条数据？请谨慎操作', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        return delObj(id)
      }).then(data => {
        this.$message.success('删除成功')
        this.getDataList()
      })
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
    //使用插槽  缴费状态
    getStatus(type) {
      if (type == '0') {
        return '未缴费'
      } else if (type == '5') {
        return '部分缴费'
      } else if (type == '10') {
        return '已缴费'
      }
    },
    getPushed(type) {
      if (type == '0') {
        return '未推送'
      } else if (type == '1') {
        return '已推送'
      }
    },
    getMajor(type) {
      if (type == '0') {
        return '未申请'
      } else if (type == '1') {
        return '待审核'
      } else if (type == '2') {
        return '驳回'
      } else if (type == '3') {
        return '已通过'
      }
    },
    lqtz(row) {
      this.$nextTick(() => {
        this.$refs.admissionNoticeDialogRef?.init(row)
      })
    },
    infoTable(row) {
      window.open("printRecruitedStu.html?appId=" + row.id);
    },
    pushCity(id) {
      let _this = this;
      this.$confirm('是否确认推送该数据到市局审核？请谨慎操作', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        return pushCity({id: id})
      }).then(data => {
        this.$message.success('推送成功')
        this.getDataList()
      })
    },
    rePush(row) {
      this.$confirm('是否确认重新推送本条数据？请谨慎操作', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        return rePush({id: row.id})
      }).then(data => {
        this.$message.success('推送成功')
        this.getDataList()
      })
    },
    delayPayTimeSet(row) {
      this.$nextTick(() => {
        this.$refs.delayPayTimeDialogRef?.init(row)
      })
    },
    showPayCode(row) {
      this.$nextTick(() => {
        this.$refs.payQrcodeDialogRef?.init(row)
      })
    },
    interviewForm(row) {
      this.$refs.interviewFormRef.init(row)
    },
  }
}
</script>
