
<script lang="ts">
export default {
  name: 'reinspection' // 复查管理
};
</script>
<script setup lang="ts">
import { onMounted, ref, nextTick ,watch,reactive} from "vue";
import { ElMessage, ElMessageBox, FormRules,ElTable,ElTree} from "element-plus";
import Page from '@/components/Pagination/page.vue';
import { recheckStudentList,exportRecheckTemplate,exportRecheckExamineResultStudent,addRecheckExamineResult,
  recheckStudentInfo,updateRecheckExamineResult,studentRecheckNotice,exportSchoolRecheckNotice } from "@/api/planscreening";

import { queryExaminePlanById } from "@/api/planscreening";
import { downloadFile } from '@/utils/index'
import { getToken } from '@/utils/auth'
import * as XLSX from 'xlsx';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const isSort = ref('down');
const queryInfo :any = ref({
  schoolId:"",
  gradeId:"",
  classId:"",
  gender:"",
  name:"",
  current:1,
  size:10,
  total:0
})

const url = userStore.webApiBaseUrl;
const tableRowClassName = ({
    row,
    rowIndex,
}: {
    row: any
    rowIndex: number
}) => {
    if (row.is_sighted == 1) {
        return 'is_sightedbg'
    }
    return ''
}
const recheckStr =ref("")
const props:any = defineProps({
  planInfo: {
    required: false,
    type: Object,
    default: {}
  }
})
const planSchoolInfo:any = ref({})
const tempSchoolList:any =ref([])
const shcoolId=ref("")
const tableData = ref([])

function getSort(type){
   isSort.value = type
   if(type == "up"){
    planSchoolInfo.value.schoolList.sort((a, b) => a.recheckrate - b.recheckrate); 
   }else if(type == "down"){
    planSchoolInfo.value.schoolList.sort((a, b) => b.recheckrate - a.recheckrate); 
   }else if(type == "no"){
    planSchoolInfo.value.schoolList =JSON.parse(JSON.stringify(tempSchoolList.value)) ; 
   }
}
watch(
  () => props.planInfo,
  (newVal: any) => {
    planSchoolInfo.value = newVal
    if(planSchoolInfo.value != null && planSchoolInfo.value.schoolList != null ){
      planSchoolInfo.value.schoolList.forEach(element => {
        if(element.total == 0){
          element.recheckrate = 0
        }else{
          element.recheckrate = (element.recheck/element.total *100).toFixed(2)
        }
      });
      tempSchoolList.value = JSON.parse(JSON.stringify(planSchoolInfo.value.schoolList))
      isSort.value = 'no'
    }
    recheckStr.value = ""
    queryInfo.value = {
      schoolId:"",
      gradeId:"",
      classId:"",
      gender:"",
      name:"",
      current:1,
      size:10,
      total:0
    }
    
    shcoolId.value = ""
    tableData.value =[]
  },
  { immediate: true }
);


const loading = ref(false)
// 左侧树
onMounted(() => {
  planSchoolInfo.value = props.planInfo
  if(planSchoolInfo.value != null && planSchoolInfo.value.schoolList != null){
    planSchoolInfo.value.schoolList.forEach(element => {
      if(element.total == 0){
        element.recheckrate = 0
      }else{
        element.recheckrate = (element.recheck/element.total *100).toFixed(2)
      }
      
    });
    tempSchoolList.value = JSON.parse(JSON.stringify(planSchoolInfo.value.schoolList))
    isSort.value = 'no'
    recheckStr.value = ""
    queryInfo.value = {
      schoolId:"",
      gradeId:"",
      classId:"",
      gender:"",
      name:"",
      current:1,
      size:10,
      total:0
    }
  }
});

function download(){

let params = {
    planId:  planSchoolInfo.value.id,
    schoolIds:shcoolId.value

  };
  exportRecheckTemplate(params).then((response: any) => {
    downloadFile(response,planSchoolInfo.value.plan_name+ '-复查学生基本信息', 'xlsx')
  });
}

function exportRecheck(type){
    let params = {
      planId:  planSchoolInfo.value.id,
      schoolIds:shcoolId.value,
      type:type
    };
    exportRecheckExamineResultStudent(params).then((response: any) => {
      if(type == 'no'){
        downloadFile(response,planSchoolInfo.value.plan_name+ '-未复查学生基本信息', 'xlsx')
      }else{
        downloadFile(response,planSchoolInfo.value.plan_name+ '-已复查学生基本信息', 'xlsx')
      }
     
    });
}
function exportRecheckNotice(){
    let params = {
      planId:  planSchoolInfo.value.id,
      schoolIds:shcoolId.value
    };
    loadingtext.value = "正在导出复查通知书，请耐心等待！"
    loading.value = true
    // if(queryInfo.value.total<1000){
    //   studentRecheckNotice(params).then((response: any) => {
    //     loadingtext.value = ""
    //     loading.value = false
    //     downloadFile(response,planSchoolInfo.value.plan_name+ '-复查通知书', 'docx')
    //   }).catch(()=>{
    //     loadingtext.value = ""
    //     loading.value = false
    //   });
    // }else{
      exportSchoolRecheckNotice(params).then((response: any) => {
        loadingtext.value = ""
        loading.value = false
        downloadFile(response,planSchoolInfo.value.plan_name+ '-复查通知书', 'zip')
      }).catch(()=>{
        loadingtext.value = ""
        loading.value = false
      });
    // }

    
}




function checkchange(id:any){
  schoolNames.value = ''
  for(let j = 0;j<planSchoolInfo.value.schoolList.length;j++){
    if(planSchoolInfo.value.schoolList[j].id == id){
      schoolNames.value = planSchoolInfo.value.schoolList[j].name
    }
  }   
  if(id != '' && id !=null){
    getData()
  }else{
    tableData.value =[]
  }
}
function searchClick(){
  queryInfo.value.current = 1
  getData()
}
function getData(){
  let params = {
    planId:  planSchoolInfo.value.id,
    schoolIds:shcoolId.value,
    size:queryInfo.value.size,
    current:queryInfo.value.current,
    recheckStr:recheckStr.value
    }
    recheckStudentList(params).then((res) => {
        tableData.value = res.data.records;
        queryInfo.value.total = res.data.total;
      }).catch(()=>{
      });
}
function dateFormat(row: any) { // 时间方法
  const daterc = row;
  if (daterc != null) {
    var date = new Date(daterc);
    var year = date.getFullYear();
    var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
    date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    // 拼接
    return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  }
}
const upload:any = ref(null)
const errorData:any = ref([])
const dialogTableVisible = ref(false)
function handlesSuccess(file: any) {
  loading.value = false
  if(file.code == "0"){
    ElMessage({
      message: "导入成功！",
      type: "success",
    });
    getData()
    refreshInfo()
  }else{
    errorData.value = []
    let msg =  file.msg.split("！！<br>")
    msg.forEach(element => {
      errorData.value.push({name:element})
    });
    dialogTableVisible.value = true
    // ElMessage({
    //   message: file.msg,
    //   type: "error",
    // });
  }

  upload.value.clearFiles()
}

const schoolNames:any = ref("")
function handleError(file: any){
  loading.value = false
  ElMessage({
    message: "导入失败！",
    type: "error",
  });
  upload.value.clearFiles()
}
function handlePreview(){
  loadingtext.value = "正在导入数据，请耐心等待！"
  loading.value = true
}

const dialogFrom = ref(false)
const studentInfo:any = ref({})
const studentTitle = ref("")

const recheckInfo:any = ref({
  vision_left:null,
  vision_right:null,
  rectify_vision_left:null,
  rectify_vision_right:null,
  sph_left:null,
  sph_right:null,
  cytdnder_left:null,
  cytdnder_right:null,
  axies_left:null,
  axies_right:null,
  od_left:null,
    od_right:null,
})
const recheckRules = reactive<FormRules>({
  vision_left: [{ required: true, message: "请输入左眼视力", trigger: "blur" }],
  vision_right: [{ required: true, message: "请输入右眼视力", trigger: "blur" }],
  rectify_vision_left: [{ required: true, message: "请输入左眼矫正视力", trigger: "blur" }],
  rectify_vision_right: [{ required: true, message: "请输入右眼矫正视力", trigger: "blur" }],
  sph_left: [{ required: true, message: "请输入左眼球镜", trigger: "blur" }],
  sph_right: [{ required: true, message: "请输入右眼球镜", trigger: "blur" }],
  cytdnder_left: [{ required: true, message: "请输入左眼柱镜", trigger: "blur" }],
  cytdnder_right: [{ required: true, message: "请输入右眼柱镜", trigger: "blur" }],
  axies_left: [{ required: true, message: "请输入左眼轴位", trigger: "blur" }],
  axies_right: [{ required: true, message: "请输入右眼轴位", trigger: "blur" }],
});
function addinfo(row:any){
  isNum.value = false
  studentInfo.value  = JSON.parse(JSON.stringify(row))
  recheckInfo.value = {
    vision_left:null,
    vision_right:null,
    rectify_vision_left:null,
    rectify_vision_right:null,
    sph_left:null,
    sph_right:null,
    cytdnder_left:null,
    cytdnder_right:null,
    axies_left:null,
    axies_right:null,
    od_left:null,
    od_right:null,
  }
  studentTitle.value = '录入'+studentInfo.value.student_name + '的复查数据'
  dialogFrom.value  = true
}

function editinfo(row:any){
  isNum.value = false
  let params = {
    planId:row.plan_id,
    studentId:row.student_id
  }
  recheckStudentInfo(params).then((res:any) => {
    recheckInfo.value = res.data
    studentTitle.value ='修改'+ recheckInfo.value.student_name + '的复查数据'
    dialogFrom.value  = true
  })
}

function refreshInfo(){
  let params ={
    id: planSchoolInfo.value.id
  }
  queryExaminePlanById(params).then((res:any) => {
    
    if(res.data !=null){
      let schoolList = res.data.schoolList
      for(let i =0;i<schoolList.length;i++){
        for(let j =0;j<planSchoolInfo.value.schoolList.length;j++){
          if(planSchoolInfo.value.schoolList[j].id ==schoolList[i].id){
            if(schoolList[i].total == 0){
              planSchoolInfo.value.schoolList[j].total = 0
            }else{
              planSchoolInfo.value.schoolList[j].recheckrate = (schoolList[i].recheck/schoolList[i].total *100).toFixed(2)
            }
          }
        }
      }
      tempSchoolList.value = JSON.parse(JSON.stringify(planSchoolInfo.value.schoolList))
    }
   
  });
}


const isNum = ref(false)

function infoEditSubmit(formEl: any){
  formEl.validate((valid: any) => {
    if (valid) {
      if(isNum.value == true){
         return
      }
      isNum.value = true
      let data = {
        id:recheckInfo.value.id,
        visionLeft:recheckInfo.value.vision_left,
        visionRight:recheckInfo.value.vision_right,
        rectifyVisionLeft:recheckInfo.value.rectify_vision_left,
        rectifyVisionRight:recheckInfo.value.rectify_vision_right,
        sphLeft:recheckInfo.value.sph_right,
        sphRight:recheckInfo.value.sph_right,
        cytdnderLeft:recheckInfo.value.cytdnder_left,
        cytdnderRight:recheckInfo.value.cytdnder_right,
        axiesLeft:recheckInfo.value.axies_left,
        axiesRight:recheckInfo.value.axies_right,
        odLeft:recheckInfo.value.od_left,
        odRight:recheckInfo.value.od_right,

      }
      updateRecheckExamineResult(data).then((res:any) => {
        if(res.code == '0'){
          dialogFrom.value  = false
          ElMessage({
            message: "修改成功！",
            type: "success",
          });
          getData()
        }else{
          ElMessage({
            message: "修改失败！",
            type: "error",
          });
          isNum.value = false
        }
      }).catch(()=>{
        isNum.value = false
      });
    }
  })
  
}
function infoSubmit(formEl: any){
  formEl.validate((valid: any) => {
    if (valid) {
      if(isNum.value == true){
         return
      }
      isNum.value = true
      let data = {
        id:studentInfo.value.id,
        visionLeft:recheckInfo.value.vision_left,
        visionRight:recheckInfo.value.vision_right,
        rectifyVisionLeft:recheckInfo.value.rectify_vision_left,
        rectifyVisionRight:recheckInfo.value.rectify_vision_right,
        sphLeft:recheckInfo.value.sph_right,
        sphRight:recheckInfo.value.sph_right,
        cytdnderLeft:recheckInfo.value.cytdnder_left,
        cytdnderRight:recheckInfo.value.cytdnder_right,
        axiesLeft:recheckInfo.value.axies_left,
        axiesRight:recheckInfo.value.axies_right,
        odLeft:recheckInfo.value.od_left,
        odRight:recheckInfo.value.od_right,

      }
      addRecheckExamineResult(data).then((res:any) => {
        if(res.code == '0'){
          dialogFrom.value  = false
          ElMessage({
            message: "录入成功！",
            type: "success",
          });
          getData()
          refreshInfo()
        }else{
          ElMessage({
            message: "录入失败！",
            type: "error",
          });
          isNum.value = false
        }
      }).catch(()=>{
        isNum.value = false
      });
    }
  })
  
}
const multipleSelection:any = ref([])
function handleSelectionChange(val:any){
  multipleSelection.value = val
}

function checkExportRecheckNotice(){
  
  let id = [] as any[];
  multipleSelection.value.forEach((item: any) => {
    id.push(item.id)
  })
  let params ={
    planId:  planSchoolInfo.value.id,
    schoolIds:shcoolId.value,
    ids: id.join(',')
  }
  loadingtext.value = "正在导出复查通知书，请耐心等待！"
    loading.value = true
  studentRecheckNotice(params).then((response: any) => {
    loadingtext.value = ""
    loading.value = false
      downloadFile(response,planSchoolInfo.value.plan_name+ '-复查通知书', 'docx')
  }).catch(()=>{
    loadingtext.value = ""
    loading.value = false
  });
   
}
const recheckForm = ref();
function handleClose(){
  if (recheckForm.value != null) recheckForm.value.resetFields();
  dialogFrom.value = false
}

const loadingtext = ref("")

function exportToExcel() {
  // 获取表格的 DOM 元素
  const table = document.querySelector('.reinspection_table_error');

  // 使用 html-to-xlsx 工具将表格转换为工作表
  const ws = XLSX.utils.table_to_sheet(table);
  // 设置列的宽度
  const colWidths = [
    { wch: 5 }, 
    { wch: 70 },
  ];
  ws['!cols'] = colWidths;
  // 创建一个工作簿
  const wb = XLSX.utils.book_new();
  XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');

  // 导出 Excel 文件
  XLSX.writeFile(wb, '导入错误信息.xlsx');
};
</script>

<template>
    <div class="importdata-box" v-loading="loading" :element-loading-text="loadingtext">
      <div class="importdata-box-top">
        <el-radio-group v-model="shcoolId"   @change="checkchange">
            <el-radio v-for="(item,index) in planSchoolInfo.schoolList" :value="item.id" :key="item.id">
              {{ item.name }}
            <span style="color: red;">({{ item.recheckrate }}%)</span>
            </el-radio>
            <el-button v-if="isSort == 'down'" type="primary" @click="getSort('no')">正常</el-button>
            <el-button v-if="isSort == 'no'" type="primary" @click="getSort('up')">升序</el-button>
            <el-button v-if="isSort == 'up'" type="primary" @click="getSort('down')">降序</el-button>
      </el-radio-group>
      </div>
      <div class="importdata-box-bottom">
        <div style="margin-bottom: 15px; display: flex;">
            <el-button type="primary" @click="download" :disabled="shcoolId ==null || shcoolId ==''">
              <img src="@/assets/tableicon/download.png" style="padding-right: 5px;" alt="">下载模板
            </el-button>
            <el-upload
              :disabled="shcoolId ==null || shcoolId ==''"
              ref="upload"
              accept=".xlsx"
              class="upload-demo"
              :action=" url + '/vision_examine/examine-result/ImportRecheckExamineResultStudent/?planId=' + planSchoolInfo.id +'&schoolNames=' + schoolNames "
              :headers="{ token: getToken() }" 
              :show-file-list="false"
              :before-upload="handlePreview"
              :on-success="handlesSuccess"
              :on-error="handleError">
              <el-button type="primary" :disabled="shcoolId ==null || shcoolId ==''"  style="margin: 0 10px;"><img src="@/assets/MenuIcon/u455.png" alt=""  style="margin-right: 5px;">导入数据</el-button>
            </el-upload>
            <el-button type="primary" @click="exportRecheck('yes')" :disabled="shcoolId ==null || shcoolId ==''">
              <img src="@/assets/visionscreening/exports.png" style="padding-right: 5px;" alt="">导出复查数据
            </el-button>
            <el-button type="primary" @click="exportRecheck('no')" :disabled="shcoolId ==null || shcoolId ==''">
              <img src="@/assets/visionscreening/exports.png" style="padding-right: 5px;" alt="">导出未复查数据
            </el-button>
            <el-button type="primary" @click="exportRecheckNotice" :disabled="shcoolId ==null || shcoolId ==''">
              <img src="@/assets/visionscreening/exports.png" style="padding-right: 5px;" alt="">导出复查通知书
            </el-button>
            <el-select v-model="recheckStr" :disabled="shcoolId ==null || shcoolId ==''" clearable style="width: 100px;margin: 0 10px;" placeholder="是否复查" @change="searchClick" >
                  <el-option  :key="'1'" :label="'是'" :value="'1'" />
                  <el-option  :key="'0'" :label="'否'" :value="'0'" />
                </el-select>
            <el-button type="primary" @click="checkExportRecheckNotice" :disabled="multipleSelection.length==0">
              <img src="@/assets/visionscreening/exports.png" style="padding-right: 5px;" alt="">导出勾选复查通知书
            </el-button>
        </div>
        <el-table v-loading="loading" :element-loading-text="loadingtext" :data="tableData" border :row-class-name="tableRowClassName"
           style="width: 100%; height:calc(100vh - 570px)" :header-cell-style="{background:'rgb(250 250 250)',height:'50px'}"
           @selection-change="handleSelectionChange">
           <el-table-column fixed type="selection" width="55" />
           <el-table-column fixed type="index" width="55" label="序号" align="center" />
            <el-table-column fixed prop="student_name" label="姓名" width="100">
              <template #default="scope">
                <div style="display: flex;align-items: center;">
                  <div v-if="scope.row.count>0"></div>
                  <div v-else class="circularbox" ></div>
                  <div>{{ scope.row.student_name }}</div>
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="gender" label="性别" width="80" align="center">
              <template #default="scope">
              <span v-if="scope.row.gender == '1'">男</span>
              <span v-if="scope.row.gender == '2'">女</span>
              </template>
            </el-table-column>
            <el-table-column prop="age" label="年龄" width="80" />
            <el-table-column prop="birth_date" label="出生日期" width="120" align="center" />
            <el-table-column prop="nation" label="民族" width="80" align="center" />
            <el-table-column prop="study_code" label="学籍号" width="185" align="center" />
            
            <el-table-column prop="school_name" label="所属学校" min-width="120" />
            <el-table-column prop="grade_name" label="所属年级" min-width="120" />
            <el-table-column prop="class_name" label="所属班级" min-width="100" />
            <el-table-column prop="exam_status" label="状态" align="center">
            <template #default="scope">
              <span v-if="scope.row.exam_status == '00'">未检</span>
              <span v-if="scope.row.exam_status == '01'">已检</span>
              <span v-if="scope.row.exam_status == '02'">漏检</span>
              </template>
            </el-table-column>
            <el-table-column prop="exam_time" label="检查时间" width="120" align="center">
            <template #default="scope">
              {{dateFormat(scope.row.exam_time)}}
            </template>
          </el-table-column>
          <el-table-column prop="vision_left" label="左眼视力" width="60" align="center">
            <template #default="scope">
              <span v-if="scope.row.vision_left !=0 && scope.row.vision_left!=null"> {{scope.row.vision_left.toFixed(1)}}</span>
            </template>
          </el-table-column>
            <el-table-column prop="vision_right" label="右眼视力" width="60" align="center">
              <template #default="scope">
              <span v-if="scope.row.vision_right !=0 && scope.row.vision_right!=null"> {{scope.row.vision_right.toFixed(1)}}</span>
              </template>
            </el-table-column>
            
            <el-table-column prop="sph_left" label="左眼球镜"  width="90" align="center">
              <template #default="scope">
                <span v-if="scope.row.sph_left !=0 && scope.row.sph_left!=null">
                  <span v-if="scope.row.sph_left>0">+{{scope.row.sph_left.toFixed(2)}}D</span>
                  <span v-else>{{scope.row.sph_left.toFixed(2)}}D</span> 
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="sph_right" label="右眼球镜"  width="90" align="center">
            <template #default="scope">
              <span v-if="scope.row.sph_right !=0 && scope.row.sph_right!=null">
                <span v-if="scope.row.sph_right>0">+{{scope.row.sph_right.toFixed(2)}}D</span>
                <span v-else>{{scope.row.sph_right.toFixed(2)}}D</span> 
              </span>
              </template>
            </el-table-column>
            <el-table-column prop="cytdnder_left" label="左眼柱镜"  width="90" align="center">
              <template #default="scope">
                <span v-if="scope.row.cytdnder_left !=0 && scope.row.cytdnder_left!=null">
                  <span v-if="scope.row.cytdnder_left>0">+{{scope.row.cytdnder_left.toFixed(2)}}D</span>
                <span v-else>{{scope.row.cytdnder_left.toFixed(2)}}D</span> 
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="cytdnder_right" label="右眼柱镜"  width="90" align="center">
              <template #default="scope">
                <span v-if="scope.row.cytdnder_right !=0 && scope.row.cytdnder_right!=null">
                  <span v-if="scope.row.cytdnder_right>0">+{{scope.row.cytdnder_right.toFixed(2)}}D</span>
                  <span v-else>{{scope.row.cytdnder_right.toFixed(2)}}D</span> 
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="axies_left" label="左眼轴位"  width="60" align="center"/>
            <el-table-column prop="axies_right" label="右眼轴位"  width="60" align="center"/>
            <el-table-column prop="se_left" label="左眼等效球镜"  width="120" align="center">
              <template #default="scope">
                <span v-if="scope.row.se_left !=0 && scope.row.se_left!=null">
                  <span v-if="scope.row.se_left>0">+{{scope.row.se_left.toFixed(2)}}D</span>
                  <span v-else>{{scope.row.se_left.toFixed(2)}}D</span> 
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="se_right" label="右眼等效球镜"  width="120" align="center">
              <template #default="scope">
                <span v-if="scope.row.se_right !=0 && scope.row.se_right!=null">
                  <span v-if="scope.row.se_right>0">+{{scope.row.se_right.toFixed(2)}}D</span>
                  <span v-else>{{scope.row.se_right.toFixed(2)}}D</span> 
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="rectify_vision_left" label="左眼矫正视力"  width="80" align="center">
              <template #default="scope">
              <span v-if="scope.row.rectify_vision_left !=0 && scope.row.rectify_vision_left!=null"> {{scope.row.rectify_vision_left.toFixed(1)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="rectify_vision_right" label="右眼矫正视力"  width="80" align="center">
              <template #default="scope">
              <span v-if="scope.row.rectify_vision_right !=0 && scope.row.rectify_vision_right!=null"> {{scope.row.rectify_vision_right.toFixed(1)}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="is_sighted" label="是否近视"  width="60" align="center">
              <template #default="scope">
                <span v-if="scope.row.is_sighted == '0'">否</span>
                <span v-if="scope.row.is_sighted == '1'">是</span>
              </template>
            </el-table-column>
            <el-table-column prop="is_hyperopia" label="远视储备是否充足" width="90" align="center">
              <template #default="scope">
                <span v-if="scope.row.age >12">/</span>
                <span v-else-if="scope.row.is_hyperopia == '1'">否</span>
                <span v-else-if="scope.row.is_hyperopia == '0'">是</span>
              </template>
            </el-table-column>
            <el-table-column prop="is_glasses" label="是否戴镜" width="100" align="center">
              <template #default="scope">
                <span v-if="scope.row.is_glasses == '0'||scope.row.is_glasses == ''||scope.row.is_glasses == null">未知</span>
                <span v-if="scope.row.is_glasses == '4'">不带镜</span>
                <span v-if="scope.row.is_glasses == '3'">角膜塑形镜</span>
                <span v-if="scope.row.is_glasses == '2'">隐形眼镜</span>
                <span v-if="scope.row.is_glasses == '1'">框架眼镜</span>
              </template>
            </el-table-column>
            <el-table-column prop="id_code" label="身份证" width="180" align="center" />
            <el-table-column prop="is_view" label="家长是否查看"  width="80" align="center">
              <template #default="scope">
                <span v-if="scope.row.is_view == '1'">是</span>
                <span v-else>否</span>
              </template>
            </el-table-column>
            <el-table-column prop="address" label="操作" width="60" fixed="right" align="center">
              <template #default="scope">
                <div style="display: -webkit-flex;display: flex; justify-content: space-around;-webkit-justify-content: space-around; ">
                  <img v-if="scope.row.count == 0" src="@/assets/MenuIcon/lbcz_xg.png" alt="" title="录入复查" @click="addinfo(scope.row)" style="cursor: pointer;">
                  <img v-else src="@/assets/MenuIcon/lbcz_xg.png" alt="" title="修改" @click="editinfo(scope.row)" style="cursor: pointer;">
                </div>
              </template>
            </el-table-column>
          </el-table>
          <Page class="mt-[20px]" :total="queryInfo.total" v-model:size="queryInfo.size" v-model:current="queryInfo.current"
          @pagination="getData" />
      </div>
      <el-dialog v-model="dialogTableVisible" title="导入学生错误信息列表" width="800">
        <el-button style="margin-bottom: 10px" type="primary" @click="exportToExcel">导出错误信息</el-button>
        <el-table class="reinspection_table_error" :data="errorData" style="height: calc(100vh - 200px);" border>
          <el-table-column type="index" label="序号" width="90" />
          <el-table-column prop="name" label="内容" />
        </el-table>
      </el-dialog>
      <el-dialog v-model="dialogFrom" :title="studentTitle" width="800" :before-close="handleClose">
        <el-form ref="recheckForm" :rules="recheckRules" :model="recheckInfo" label-width="150px">
          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼视力" style="width: 50%;" prop="vision_left">
              <el-input v-model="recheckInfo.vision_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼视力" style="width: 50%;" prop="vision_right">
              <el-input v-model="recheckInfo.vision_right" style="width: 100%" placeholder=""></el-input>
            </el-form-item>
          </div>
          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼矫正视力" style="width: 50%;" prop="rectify_vision_left">
              <el-input v-model="recheckInfo.rectify_vision_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼矫正视力" style="width: 50%;" prop="rectify_vision_right">
              <el-input v-model="recheckInfo.rectify_vision_right" style="width: 100%" placeholder=""></el-input>
            </el-form-item>
          </div>

          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼球镜" style="width: 50%;" prop="sph_left">
              <el-input v-model="recheckInfo.sph_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼球镜" style="width: 50%;" prop="sph_right">
              <el-input v-model="recheckInfo.sph_right" style="width: 100%" placeholder=""></el-input>
            </el-form-item>
          </div>
          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼柱镜" style="width: 50%;" prop="cytdnder_left">
              <el-input v-model="recheckInfo.cytdnder_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼柱镜" style="width: 50%;" prop="cytdnder_right">
              <el-input v-model="recheckInfo.cytdnder_right" style="width: 100%" placeholder=""></el-input>
            </el-form-item>
          </div>
          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼轴位" style="width: 50%;" prop="axies_left">
              <el-input v-model="recheckInfo.axies_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼轴位" style="width: 50%;" prop="axies_right">
              <el-input v-model="recheckInfo.axies_right" style="width: 100%" placeholder=""></el-input>
            </el-form-item>
          </div>
          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼眼轴长度" style="width: 50%;">
              <el-input v-model="recheckInfo.od_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼眼轴长度" style="width: 50%;">
              <el-input v-model="recheckInfo.od_right" style="width: 100%" placeholder=""></el-input>
            </el-form-item>
          </div>
          <span class="dialog-footer" >
            <el-button v-if="recheckInfo.exam_type == '04'" type="primary" @click="infoEditSubmit(recheckForm)">确定</el-button>
            <el-button v-else type="primary" @click="infoSubmit(recheckForm)">确定</el-button>
            <el-button  @click="handleClose">关闭</el-button>
        </span>
      
      </el-form>
      </el-dialog>
    </div>
</template>
<style scoped  lang="scss">
  .importdata-box{
    height: calc(100vh - 285px);
    width: 100%;
    padding-top: 15px;
    .importdata-box-top{
      height: 125px;
      width: 100%;
      background: #fff;
      border-radius: 5px;
      box-shadow: 0px 0px 10px rgba(219, 225, 236, 0.498039215686275);
      margin-bottom: 15px;
      display: flex;
      padding: 10px;
      flex-wrap: wrap;
      align-content: flex-start;
      overflow: auto;
    }
    .importdata-box-bottom{
      width: 100%;
      height: calc(100vh - 440px);
     background: #fff;
      border-radius: 5px;
      box-shadow: 0px 0px 10px rgba(219, 225, 236, 0.498039215686275);
      padding: 15px;
    }
  }
  .dialog-footer {
    display: flex;
    display: -webkit-flex;
    justify-content: flex-end;
    -webkit-justify-content: flex-end;
  }
  .circularbox{
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: red;
    margin-right: 5px;
  }
</style>
