
<script lang="ts">
export default {
  name: 'exportdata' // 数据管理-导出数据
};
</script>
<script setup lang="ts">
import { onMounted, ref ,watch,computed } from "vue";
import { ElMessage, ElMessageBox, FormRules,ElTable} from "element-plus";
import Page from '@/components/Pagination/page.vue';
import { querySchoolGradeClassList } from "@/api/regionmodule/schoolClass";
import { queryExamineResultDataPage,exportExamineStudent,delExamineStudentResult,updateExamineResult,exportStudentHealthNetwork } from "@/api/planscreening";
import { downloadFile } from '@/utils/index'

import { publicTree } from '@/utils/validate';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const url = userStore.webApiBaseUrl;
const props:any = defineProps({
  planInfo: {
    required: false,
    type: Object,
    default: {}
  }
})
const tableRowClassName = ({
    row,
    rowIndex,
}: {
    row: any
    rowIndex: number
}) => {
    if (row.is_sighted == 1) {
        return 'is_sightedbg'
    }
    return ''
}

const planSchoolInfo:any = ref({})



const queryInfo :any = ref({
  current:1,
  size:10,
  total:0,
  name:"",
})
const visionlist = ref({
    startVisionLeft:'',endVisionLeft:'',checkleftvision:false,
    startVisionRight:'',endVisionRight:'',checkrightvision:false,
    startSphLeft:'',endSphLeft:'',checkleftsph:false,
    startSphRight:'',endSphRight:'',checkrightsph:false,
    startCytdnderLeft:'',endCytdnderLeft:'',checkleftcyl:false,
    startCytdnderRight:'',endCytdnderRight:'',checkrightcyl:false,
    startAxiesLeft:'',endAxiesLeft:'',checkleftaxi:false,
    startAxiesRight:'',endAxiesRight:'',checkrightaxi:false,
    startSeLeft:'',endSeLeft:'',checkleftsphs:false,
    startSeRight:'',endSeRight:'',checkrightsphs:false,
    is_sighted:'',
    studentName: ''
})
const tableData = ref([])
const multipleSelection = ref([])
const loading = ref(false)
// 左侧树
const treeloading = ref(false)
const defaultProps = { label: "name",children: 'children' }
//树形控件类型定义
interface Tree {
  [x: string]: any;
  label: string;
  children?: Tree[];
}
onMounted(() => {
  planSchoolInfo.value = props.planInfo
  if(planSchoolInfo.value.schoolList != null &&  planSchoolInfo.value.schoolList.length>0){
      getTree()
    }else{
      treeData.value = []
    }
});
const vMove = {
  mounted(el: any) {
    el.onmousedown = function (e: any) {
      var init = e.clientX;
      var parent: any = document.getElementById("silderLeft2");
      const initWidth: any = parent.offsetWidth;
      document.onmousemove = function (e) {
        var end = e.clientX;
        var newWidth = end - init + initWidth;
        parent.style.width = newWidth + "px";
      };
      document.onmouseup = function () {
        document.onmousemove = document.onmouseup = null;
      };
    };
  }
}
//搜索
function searchclick(){
  dialogQuery.value = false
  queryInfo.value.current = 1
  init()
}
const loading2 = ref(false)
function exportHealthNetwork(){
  let params:any = {
    current:queryInfo.value.current,
    size:queryInfo.value.size,
    planId:planSchoolInfo.value.id,
    is_sighted: visionlist.value.is_sighted
  }
  if(nodeInfo.value.org_type == "5"){
    params.schoolId = nodeInfo.value.id
  }else if(nodeInfo.value.org_type == "6"){
    params.gradeId = nodeInfo.value.id
  }else if(nodeInfo.value.org_type == "7"){
    params.classId = nodeInfo.value.id
  }
  if(visionlist.value.checkleftvision == true){
    params.startVisionLeft = visionlist.value.startVisionLeft
    params.endVisionLeft = visionlist.value.endVisionLeft
  }
  if(visionlist.value.checkrightvision == true){
    params.startVisionRight = visionlist.value.startVisionRight
    params.endVisionRight = visionlist.value.endVisionRight
  }
  if(visionlist.value.checkleftsph == true){
    params.startSphLeft = visionlist.value.startSphLeft
    params.endVisionRight = visionlist.value.endVisionRight
  }
  if(visionlist.value.checkrightsph == true){
    params.startSphRight = visionlist.value.startSphRight
    params.endSphRight = visionlist.value.endSphRight
  }
  if(visionlist.value.checkleftcyl == true){
    params.startCytdnderLeft = visionlist.value.startCytdnderLeft
    params.endCytdnderLeft = visionlist.value.endCytdnderLeft
  }
  if(visionlist.value.checkrightcyl == true){
    params.startCytdnderRight = visionlist.value.startCytdnderRight
    params.endCytdnderRight = visionlist.value.endCytdnderRight
  }
  if(visionlist.value.checkleftaxi == true){
    params.startAxiesLeft = visionlist.value.startAxiesLeft
    params.endAxiesLeft = visionlist.value.endAxiesLeft
  }
  if(visionlist.value.checkrightaxi == true){
    params.startAxiesRight = visionlist.value.startAxiesRight
    params.endAxiesRight = visionlist.value.endAxiesRight
  }
  if(visionlist.value.checkleftsphs == true){
    params.startSeLeft = visionlist.value.startSeLeft
    params.endSeLeft = visionlist.value.endSeLeft
  }
  if(visionlist.value.checkrightsphs == true){
    params.startSeRight = visionlist.value.startSeRight
    params.endSeRight = visionlist.value.endSeRight
  }
  if(radioStr.value == "1"){
    loading2.value= true
    exportExamineStudent(params).then((response: any) => {
      isExportVisible.value = false
      loading2.value= false
      downloadFile(response, planSchoolInfo.value.plan_name + '学生检查信息', 'xlsx')
    }).catch(()=>{
      loading2.value= false
    });
  }
  if(radioStr.value == "2"){
    loading2.value= true
    exportStudentHealthNetwork(params).then((response: any) => {
      isExportVisible.value = false
      loading2.value= false
      downloadFile(response, planSchoolInfo.value.plan_name + '学生体质健康网模板', 'xlsx')
    }).catch(()=>{
      loading2.value= false
    });
  }
  
}
function handleSelectionChange(val:any){
  multipleSelection.value = val
}
function resetdata(){
  dialogQuery.value = false
  queryInfo.value = {
    current:1,
    size:10,
    total:0,
  }
  visionlist.value ={
    startVisionLeft:'',endVisionLeft:'',checkleftvision:false,
    startVisionRight:'',endVisionRight:'',checkrightvision:false,
    startSphLeft:'',endSphLeft:'',checkleftsph:false,
    startSphRight:'',endSphRight:'',checkrightsph:false,
    startCytdnderLeft:'',endCytdnderLeft:'',checkleftcyl:false,
    startCytdnderRight:'',endCytdnderRight:'',checkrightcyl:false,
    startAxiesLeft:'',endAxiesLeft:'',checkleftaxi:false,
    startAxiesRight:'',endAxiesRight:'',checkrightaxi:false,
    startSeLeft:'',endSeLeft:'',checkleftsphs:false,
    startSeRight:'',endSeRight:'',checkrightsphs:false,
    is_sighted: '',
    studentName: ''
  }
  init()
}

const treeLoading = ref(false)
const treeData:any = ref([])
function getTree(){
  let schoolIds = []

   for(let i =0; i<planSchoolInfo.value.schoolList.length;i++){
    schoolIds.push(planSchoolInfo.value.schoolList[i].id)
   }
  let params = {
    planId:  planSchoolInfo.value.id,
    schoolIds:schoolIds.join(','),
    }
  querySchoolGradeClassList(params).then((res) => {
      treeData.value = publicTree(res.data,"")
    }).catch(()=>{
    });
  
}
// 初始化
function init(){
  let params:any = {
    current:queryInfo.value.current,
    size:queryInfo.value.size,
    planId:planSchoolInfo.value.id,
    is_sighted: visionlist.value.is_sighted,
    studentName: visionlist.value.studentName
  }
  if(nodeInfo.value.org_type == "5"){
    params.schoolId = nodeInfo.value.id
  }else if(nodeInfo.value.org_type == "6"){
    params.gradeId = nodeInfo.value.id
  }else if(nodeInfo.value.org_type == "7"){
    params.classId = nodeInfo.value.id
  }

  if(visionlist.value.checkleftvision == true){
    params.startVisionLeft = visionlist.value.startVisionLeft
    params.endVisionLeft = visionlist.value.endVisionLeft
  }
  if(visionlist.value.checkrightvision == true){
    params.startVisionRight = visionlist.value.startVisionRight
    params.endVisionRight = visionlist.value.endVisionRight
  }
  if(visionlist.value.checkleftsph == true){
    params.startSphLeft = visionlist.value.startSphLeft
    params.endVisionRight = visionlist.value.endVisionRight
  }
  if(visionlist.value.checkrightsph == true){
    params.startSphRight = visionlist.value.startSphRight
    params.endSphRight = visionlist.value.endSphRight
  }

  if(visionlist.value.checkleftcyl == true){
    params.startCytdnderLeft = visionlist.value.startCytdnderLeft
    params.endCytdnderLeft = visionlist.value.endCytdnderLeft
  }
  if(visionlist.value.checkrightcyl == true){
    params.startCytdnderRight = visionlist.value.startCytdnderRight
    params.endCytdnderRight = visionlist.value.endCytdnderRight
  }
  if(visionlist.value.checkleftaxi == true){
    params.startAxiesLeft = visionlist.value.startAxiesLeft
    params.endAxiesLeft = visionlist.value.endAxiesLeft
  }
  if(visionlist.value.checkrightaxi == true){
    params.startAxiesRight = visionlist.value.startAxiesRight
    params.endAxiesRight = visionlist.value.endAxiesRight
  }
  if(visionlist.value.checkleftsphs == true){
    params.startSeLeft = visionlist.value.startSeLeft
    params.endSeLeft = visionlist.value.endSeLeft
  }
  if(visionlist.value.checkrightsphs == true){
    params.startSeRight = visionlist.value.startSeRight
    params.endSeRight = visionlist.value.endSeRight
  }

  loading.value = true
  queryExamineResultDataPage(params).then((res) => {
    loading.value = false
    tableData.value = res.data.records
    queryInfo.value.total = res.data.total
  }).catch(()=>{
    loading.value = false
  });
}
const nodeInfo:any = ref({})
const handleNodeClick = (data: Tree) => {
  nodeInfo.value = data
  init()
};
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;
  }
}
//清空结果
function clearresult(){
  if(content.value != '确认清空'){
      ElMessage({
        message: "请输入“ 确认清空 ”",
        type: "warning",
      });
     return
  }
  let params:any = {
    planId: planSchoolInfo.value.id,
    }
    if(multipleSelection.value.length>0){
    let id = [] as any[];
    multipleSelection.value.forEach((item: any) => {
      id.push(item.student_id)
    })
    params.studentIds= id.join(',')
  }
  loading.value = true
  dialogTableVisible.value = false
  delExamineStudentResult(params).then((res:any) => {
     if(res.code =="0"){
      ElMessage({
        message: "视力结果清空成功！",
        type: "success",
      });
      init()
     }else{
      loading.value = false
      ElMessage({
        message: "视力结果清空失败！",
        type: "error",
      });
     }
     
    }).catch(()=>{
      loading.value = false
    });
}
watch(
  () => props.planInfo,
  (newVal: any) => {
    planSchoolInfo.value = newVal
    tableData.value =[]
    if(planSchoolInfo.value.schoolList != null &&  planSchoolInfo.value.schoolList.length>0){
      getTree()
    }else{
      treeData.value = []
    }
  },
  { immediate: true }
);
function tisClick(){
  content.value = ""
  dialogTableVisible.value = true
}
const dialogTableVisible = ref(false);
const content:any = ref("")

const dialogFrom = ref(false)
const studentInfo:any = ref({})
const studentTitle = ref("")
function editinfo(row:any){
  studentInfo.value  = JSON.parse(JSON.stringify(row))
  if(studentInfo.value.vision_left !=null && studentInfo.value.vision_left !=""){
    studentInfo.value.vision_left =  studentInfo.value.vision_left.toFixed(1)
  }
  if(studentInfo.value.vision_right !=null && studentInfo.value.vision_right !=""){
    studentInfo.value.vision_right =  studentInfo.value.vision_right.toFixed(1)
  }

  if(studentInfo.value.rectify_vision_left !=null && studentInfo.value.rectify_vision_left !=""){
    studentInfo.value.rectify_vision_left =  studentInfo.value.rectify_vision_left.toFixed(1)
  }

  if(studentInfo.value.rectify_vision_right !=null && studentInfo.value.rectify_vision_right !=""){
    studentInfo.value.rectify_vision_right =  studentInfo.value.rectify_vision_right.toFixed(1)
  }



  if(studentInfo.value.sph_left !=null && studentInfo.value.sph_left !=""){
    studentInfo.value.sph_left =  studentInfo.value.sph_left.toFixed(2)
  }

  if(studentInfo.value.sph_right !=null && studentInfo.value.sph_right !=""){
    studentInfo.value.sph_right =  studentInfo.value.sph_right.toFixed(2)
  }

  if(studentInfo.value.se_left !=null && studentInfo.value.se_left !=""){
    studentInfo.value.se_left =  studentInfo.value.se_left.toFixed(2)
  }

  if(studentInfo.value.se_right !=null && studentInfo.value.se_right !=""){
    studentInfo.value.se_right =  studentInfo.value.se_right.toFixed(2)
  }

  studentTitle.value = studentInfo.value.student_name + '的视力信息'
  dialogFrom.value  = true
}

function infoSubmit(){
console.log(isNaN(studentInfo.value.vision_left))
  if(studentInfo.value.vision_left !=null && studentInfo.value.vision_left !=''
  && isNaN(studentInfo.value.vision_left)){
    ElMessage({
      message: "左眼视力:请输入正确数值！",
      type: "warning",
    });
    return
  }

  if(studentInfo.value.vision_right !=null && studentInfo.value.vision_right !=''
  && isNaN(studentInfo.value.vision_right)){
    ElMessage({
      message: "右眼视力:请输入正确数值！",
      type: "warning",
    });
    return
  }

  if(studentInfo.value.rectify_vision_left !=null && studentInfo.value.rectify_vision_left !=''
  && isNaN(studentInfo.value.rectify_vision_left)){
    ElMessage({
      message: "左眼矫正视力:请输入正确数值！",
      type: "warning",
    });
    return
  }
  if(studentInfo.value.rectify_vision_right !=null && studentInfo.value.rectify_vision_right !=''
  && isNaN(studentInfo.value.rectify_vision_right)){
    ElMessage({
      message: "右眼矫正视力:请输入正确数值！",
      type: "warning",
    });
    return
  }
  if(studentInfo.value.sph_left !=null && studentInfo.value.sph_left !=''
  && isNaN(studentInfo.value.sph_left)){
    ElMessage({
      message: "左眼球镜:请输入正确数值！",
      type: "warning",
    });
    return
  }
  if(studentInfo.value.sph_right !=null && studentInfo.value.sph_right !=''
  && isNaN(studentInfo.value.sph_right)){
    ElMessage({
      message: "右眼球镜:请输入正确数值！",
      type: "warning",
    });
    return
  }




  if(studentInfo.value.cytdnder_left !=null && studentInfo.value.cytdnder_left !=''
  && isNaN(studentInfo.value.cytdnder_left)){
    ElMessage({
      message: "左眼柱镜:请输入正确数值！",
      type: "warning",
    });
    return
  }
  if(studentInfo.value.cytdnder_right !=null && studentInfo.value.cytdnder_right !=''
  && isNaN(studentInfo.value.cytdnder_right)){
    ElMessage({
      message: "右眼柱镜:请输入正确数值！",
      type: "warning",
    });
    return
  }
  if(studentInfo.value.axies_left !=null && studentInfo.value.axies_left !=''
  && isNaN(studentInfo.value.axies_left)){
    ElMessage({
      message: "左眼轴位:请输入正确数值！",
      type: "warning",
    });
    return
  }
  if(studentInfo.value.axies_right !=null && studentInfo.value.axies_right !=''
  && isNaN(studentInfo.value.axies_right)){
    ElMessage({
      message: "右眼轴位:请输入正确数值！",
      type: "warning",
    });
    return
  }
  if(studentInfo.value.se_left !=null && studentInfo.value.se_left !=''
  && isNaN(studentInfo.value.se_left)){
    ElMessage({
      message: "左眼等效球镜:请输入正确数值！",
      type: "warning",
    });
    return
  }
  if(studentInfo.value.se_right !=null && studentInfo.value.se_right !=''
  && isNaN(studentInfo.value.se_right)){
    ElMessage({
      message: "右眼等效球镜:请输入正确数值！",
      type: "warning",
    });
    return
  }

  let data = {
    id:studentInfo.value.id,
    visionLeft:studentInfo.value.vision_left,
    visionRight:studentInfo.value.vision_right,
    rectifyVisionLeft:studentInfo.value.rectify_vision_left,
    rectifyVisionRight:studentInfo.value.rectify_vision_right,
    sphLeft:studentInfo.value.sph_left,
    sphRight:studentInfo.value.sph_right,
    cytdnderLeft:studentInfo.value.cytdnder_left,
    cytdnderRight:studentInfo.value.cytdnder_right,
    axiesLeft:studentInfo.value.axies_left,
    axiesRight:studentInfo.value.axies_right,
    seLeft:studentInfo.value.se_left,
    seRight:studentInfo.value.se_right,
    isGlasses:studentInfo.value.is_glasses,
    age:studentInfo.value.age
  }
  updateExamineResult(data).then((res:any) => {

    dialogFrom.value  = false
    if(res.code == '0'){
      ElMessage({
        message: "编辑成功！",
        type: "success",
      });
      queryInfo.value.current =1
      init()
    }
  }).catch(()=>{
  });
}
const expandedKeys = computed(() => {  
  const keys = [];  
  function traverse(nodes) {  
    for (const node of nodes) {  
      keys.push(node.id); // 添加当前节点的 key  
      // if (node.children) {  
      //   traverse(node.children); // 递归遍历子节点  
      // }  
      // console.log(keys.length)
      // if (keys.length === 2) { // 当找到两个 key 时停止遍历  
      //   break;  
      // }  
    }  
  }  
  traverse(treeData.value);  
  return keys; 
}); 
const isExportVisible = ref(false)
const radioStr = ref("1")
function exportVisibleClick(){
  radioStr.value = "1"
  isExportVisible.value = true
}
const dialogQuery = ref(false)
</script>

<template>
    <div class="contents-box">
      <aside id="silderLeft2">
        <div class="lefttitle">
          <div class="line"></div>
          <div class="treetitle">数据列表</div>
        </div>
        <div>
          <el-tree v-loading="treeloading" ref="treeRef" node-key="id" :data="treeData" 
          :default-expanded-keys="expandedKeys"
          :highlight-current="true" :props="defaultProps" :expand-on-click-node="false"
          @node-click="handleNodeClick" style="height: calc(100vh - 360px); overflow: auto">
        </el-tree>
        </div>
        <div class="moveBtn" v-move>
          <div class="moveBtn-line" v-move></div>
        </div>
      </aside>
      <div class="silderRight">
        <div class="searchinfo">
          <div style="display: flex;width: 25%;margin-right: 10px; text-align: right;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkleftvision" label="左眼视力" />
              </div>
              <div>
                <el-input v-model="visionlist.startVisionLeft" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endVisionLeft" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
          <div style="display: flex;width: 25%;margin-right: 10px;text-align: right;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkrightvision" label="右眼视力" />
              </div>
              <div>
                <el-input v-model="visionlist.startVisionRight" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endVisionRight" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
          <div style="display: flex;width: 25%;margin-right: 10px; text-align: right;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkleftsph" label="左眼球镜" />
              </div>
              <div>
                <el-input v-model="visionlist.startSphLeft" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endSphLeft" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
          <div style="display: flex;width: 25%;  text-align: right;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkrightsph" label="右眼球镜" />
              </div>
              <div>
                <el-input v-model="visionlist.startSphRight" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endSphRight" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
        </div>

          <div class="searchinfos">
            <div style="display: flex;width: calc(100%);">
              <div style="display: flex;align-items: center;margin-left: 10px;">
                <div style="margin-right: 5px;font-size: 14px;">
                    是否近视
                </div>
                <el-select v-model="visionlist.is_sighted" clearable style="width: 80px;" placeholder="" @change="searchclick" >
                  <el-option  :key="'1'" :label="'是'" :value="'1'" />
                  <el-option  :key="'0'" :label="'否'" :value="'0'" />
                </el-select>

                <el-input v-model="visionlist.studentName" placeholder="学生姓名" style="width: 100px;margin-left:10px" clearable />
                <el-button :disabled="nodeInfo.org_type == null && nodeInfo.studentName ==''" type="primary" @click="searchclick" style="margin-left: 5px;">搜索</el-button>
                <el-button :disabled="nodeInfo.org_type == null" @click="resetdata" style="margin-left: 5px;">重置</el-button>
                <el-button :disabled="nodeInfo.org_type == null && nodeInfo.studentName ==''" type="primary" @click="dialogQuery = true" style="margin-left: 5px;">更多搜索</el-button>
                <el-button type="primary" @click="exportVisibleClick" style="padding:5px;"><img src="@/assets/visionscreening/exports.png" alt="" style="margin-right: 4px;" >全部导出</el-button>
                <el-button type="primary" :disabled="multipleSelection.length <= 0" @click="tisClick" style="padding:5px;"><img src="@/assets/visionscreening/exports.png" alt="" style="margin-right: 4px;" >清空视力结果</el-button>
              </div>
            </div>
          </div>
          <div v-loading="loading">
          <el-table ref="multipleTableRef" :data="tableData" border :row-class-name="tableRowClassName"
            style="width: 100%; height:calc(100vh - 480px)" @selection-change="handleSelectionChange" :header-cell-style="{background:'rgb(250 250 250)',height:'50px'}">
            <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" />
            <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="grade_name" label="所属年级" min-width="100" />
            <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  src="@/assets/MenuIcon/lbcz_xg.png" alt="" title="修改" @click="editinfo(scope.row)" style="cursor: pointer;">
                  <!-- <img  src="@/assets/tableicon/u886.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="init" />
        </div>
      </div>
      <el-dialog v-model="dialogTableVisible" title="提示" width="300">
        <div>确定清空已选的视力结果吗？</div>
        <el-input v-model="content" placeholder="请输入 “确认清空”" style="width: 100%;padding: 20px 0;" clearable />
        <div style="display: flex;justify-content: end;">
          <el-button type="primary" @click="clearresult" style="padding:5px;width: 60px;">确定</el-button>
        </div>
      </el-dialog>

      <el-dialog v-model="dialogQuery" title="更多搜索" width="650">
        <div style="display: flex;margin-bottom: 10px;">
          <el-input v-model="visionlist.studentName" placeholder="学生姓名" style="width: 50%;margin-right:10px" clearable />
          <el-select v-model="visionlist.is_sighted"  placeholder="是否近视"  clearable style="width: 50%;">
            <el-option  :key="'1'" :label="'是'" :value="'1'" />
            <el-option  :key="'0'" :label="'否'" :value="'0'" />
          </el-select>
        </div>

        
        <div style="display:flex ;">
          <div style="display: flex;width: 50%; text-align: right;margin-right: 30px;margin-bottom: 10px;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkleftvision" label="左眼视力" />
              </div>
              <div>
                <el-input v-model="visionlist.startVisionLeft" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endVisionLeft" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
          <div style="display: flex;width: 50%;text-align: right;margin-bottom: 10px;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkrightvision" label="右眼视力" />
              </div>
              <div>
                <el-input v-model="visionlist.startVisionRight" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endVisionRight" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
        </div>
        <div style="display:flex ;">
          <div style="display: flex;width: 50%;text-align: right;margin-right: 30px;margin-bottom: 10px;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkleftsph" label="左眼球镜" />
              </div>
              <div>
                <el-input v-model="visionlist.startSphLeft" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endSphLeft" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
          <div style="display: flex;width: 50%;  text-align: right;margin-bottom: 10px;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkrightsph" label="右眼球镜" />
              </div>
              <div>
                <el-input v-model="visionlist.startSphRight" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endSphRight" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
        </div>
        <div style="display:flex ;">
          <div style="display: flex;width: 50%;margin-bottom: 10px;margin-right: 30px;text-align: right;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkleftcyl" label="左眼柱镜" />
              </div>
              <div>
                <el-input v-model="visionlist.startCytdnderLeft" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endCytdnderLeft" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
          <div style="display: flex;width: 50%;margin-bottom: 10px;    text-align: right;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkrightcyl" label="右眼柱镜" />
              </div>
              <div>
                <el-input v-model="visionlist.startCytdnderRight" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endCytdnderRight" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
        </div>
        <div style="display:flex ;">
          <div style="display: flex;width: 50%;margin-bottom: 10px;text-align: right;margin-right: 30px;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkleftaxi" label="左眼轴位" />
              </div>
              <div>
                <el-input v-model="visionlist.startAxiesLeft" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endAxiesLeft" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
          <div style="display: flex;width: 50%;margin-bottom: 10px; text-align: right;">
              <div style="margin-right: 10px;">
                  <el-checkbox v-model="visionlist.checkrightaxi" label="右眼轴位" />
              </div>
              <div>
                <el-input v-model="visionlist.startAxiesRight" placeholder="起始值" style="width: 40%;" clearable />
                <span>&nbsp;-&nbsp;</span>
                <el-input v-model="visionlist.endAxiesRight" placeholder="结束值" style="width: 40%;" clearable />
              </div>
          </div>
        </div>
        <div style="display:flex ;">
          <div style="display: flex; width: 50%; margin-bottom: 10px; text-align: right; margin-right: 30px;">
            <div style="margin-right: 5px;">
                <el-checkbox v-model="visionlist.checkleftsphs" label="左眼等效球镜" />
            </div>
            <div>
              <el-input v-model="visionlist.startSeLeft" placeholder="起始值" style="width: 45%;" clearable />
              <span>&nbsp;-&nbsp;</span>
              <el-input v-model="visionlist.endSeLeft" placeholder="结束值" style="width: 45%;" clearable />
            </div>
          </div>
          <div style="display: flex;display: flex; width: 50%; margin-bottom: 10px;">
            <div style="margin-bottom: 10px;margin-right: 10px;">
              <el-checkbox v-model="visionlist.checkrightsphs" label="右眼等效球镜" />
            </div>
            <div>
              <el-input v-model="visionlist.startSeRight" placeholder="起始值" style="width: 45%;" clearable />
              <span>&nbsp;-&nbsp;</span>
              <el-input v-model="visionlist.endSeRight" placeholder="结束值" style="width: 45%;" clearable />
            </div>
          </div>
        </div>
        <div style="display: flex;justify-content: flex-end;">
          <el-button  type="primary" @click="searchclick" style="margin-left: 5px;">搜索</el-button>
          <el-button  @click="resetdata" style="margin-left: 5px;">重置</el-button>
        </div>

      </el-dialog>


      <el-dialog v-model="dialogFrom" :title="studentTitle" width="800">
        <el-form ref="infoForm" :model="studentInfo" label-width="150px">
          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼视力" style="width: 50%;">
              <el-input v-model="studentInfo.vision_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼视力" style="width: 50%;">
              <el-input v-model="studentInfo.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%;">
              <el-input v-model="studentInfo.rectify_vision_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼矫正视力" style="width: 50%;">
              <el-input v-model="studentInfo.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%;">
              <el-input v-model="studentInfo.sph_left" style="width: 100%">
                <template #append>D</template>
              </el-input>
            </el-form-item>
            <el-form-item label="右眼球镜" style="width: 50%;">
              <el-input v-model="studentInfo.sph_right" style="width: 100%" placeholder="">
                <template #append>D</template>
              </el-input>
            </el-form-item>
          </div>
          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼柱镜" style="width: 50%;">
              <el-input v-model="studentInfo.cytdnder_left" style="width: 100%">
                <template #append>D</template>
              </el-input>
            </el-form-item>
            <el-form-item label="右眼柱镜" style="width: 50%;">
              <el-input v-model="studentInfo.cytdnder_right" style="width: 100%" placeholder="">
                <template #append>D</template>
              </el-input>
            </el-form-item>
          </div>
          <div style="width: 100%;display: flex;">
            <el-form-item label="左眼轴位" style="width: 50%;">
              <el-input v-model="studentInfo.axies_left" style="width: 100%"></el-input>
            </el-form-item>
            <el-form-item label="右眼轴位" style="width: 50%;">
              <el-input v-model="studentInfo.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="studentInfo.se_left" style="width: 100%">
                <template #append>D</template>
              </el-input>
            </el-form-item>
            <el-form-item label="右眼等效球镜" style="width: 50%;">
              <el-input v-model="studentInfo.se_right" style="width: 100%" placeholder="">
                <template #append>D</template>
              </el-input>
            </el-form-item>
          </div>
          <div style="width: 100%;display: flex;">
            <el-form-item label="是否戴镜" style="width: 50%;">
              <el-select v-model="studentInfo.is_glasses" tyle="width: 100%">
                <el-option  label="框架眼镜" value="1" />
                <el-option  label="隐形眼镜" value="2" />
                <el-option  label="角膜塑形镜" value="3" />
                <el-option  label="不带镜" value="4" />
                <el-option  label="未知" value="0" />
              </el-select>
            </el-form-item>
          </div>
          <span class="dialog-footer">
            <el-button type="primary" @click="infoSubmit">确定</el-button>
        </span>
      </el-form>
      </el-dialog>
      <el-dialog v-model="isExportVisible" title="导出数据" width="350">
        <div v-loading="loading2">
          <div>
            <el-radio label="1" size="large" v-model="radioStr">系统模版数据导出</el-radio>
          </div>
          <div>
            <el-radio label="2" size="large" v-model="radioStr">体质健康网模版数据导出</el-radio>
          </div>
          <div style="display: flex;justify-content: end;margin-top: 10px;">
            <el-button type="primary" @click="exportHealthNetwork" style="padding:5px;width: 60px;">确定</el-button>
          </div>
       
        </div>
        
      </el-dialog>
    </div>
</template>
<style scoped  lang="scss">
  .contents-box{
    margin-top: 15px;
    height: calc(100vh - 300px);
    display: -webkit-flex;
    display: flex;
    .box-search{
      display: flex;
      display: -webkit-flex;
      justify-content: space-between;
      margin-bottom: 20px;
      :deep(){
        .el-input{
            width: 240px;
        }
    }
    }
  }
  #silderLeft2 {
  width: 180px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 3px;
  position: relative;
  &:hover {
    .moveBtn {
      opacity: 1;
    }
  }
}
/* 拖动条 */
.moveBtn {
  height: 100%;
  width: 15px;
  padding: 0 6px;
  opacity: 0;
  position: absolute;
  right: -15px;
  top: 0;
}

.moveBtn-line {
  width: 100%;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  background-color: #60bfff;
}
.silderRight {
  flex: 1;
  position: relative;
  width: 100%;
//   height: calc(100vh - 285px);
  overflow: auto;
  background-color: rgba(255, 255, 255, 1);
  border-radius: 3px;
  padding: 20px;
  padding-bottom: 0px;
  margin-left: 15px;
  box-sizing: border-box;
}
.lefttitle {
  min-width: 130px;
  display: flex;
  align-items: center;
  padding: 10px 20px;
  font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
  font-weight: 700;
  font-style: normal;
  font-size: 16px;
  color: #1B1B1B;
  border-bottom: 1px var(--el-border-color) var(--el-border-style);
  margin-bottom: 10px;
  .line{
    border-width: 0px;
    width: 5px;
    height: 14px;
    margin-right: 7px;
    background: inherit;
    background-color: rgba(64, 158, 255, 1);
    border: none;
    border-radius: 0px;
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
  }
}
:deep(){
  //  .el-input{
  //   height: 40px;
  //   line-height: 40px;
  //  }
  //  .el-button{
  //   height:40px; 
  //   margin-left: 10px;
  // }
  .el-tree-node__content{
    height: 40px;
    color: #505050;
   }
   .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{
    color: #409eff;
   }
   .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content:hover{
    color: #409eff;
    background-color: #ecf5ff;
   }
  .el-tree-node__content:hover{
    color: #409eff;
    background-color: transparent;
    // #ecf5ff
  }
  .el-tree-node__expand-icon{
    color: #333333;
  }
}
.searchinfo{
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  justify-content: space-around;
}
.searchinfos{
  display: flex;
  align-items: center;
  margin-bottom: 15px;
//   align-content: flex-start;
  justify-content:left;
}
.my-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  .icontext{
    font-size: 12px;
    color: #787878;
    width: 25px;
    text-align: center;
    cursor: pointer;
    img{
        padding-left: 4px;
    }
  }
  
}
.QRbox{
    height: calc(100vh - 200px);
    text-align: center;
}
.statistics-text{
    color:#949494;
    margin-right:35px;
}
.dialog-footer {
  display: flex;
  display: -webkit-flex;
  justify-content: flex-end;
  -webkit-justify-content: flex-end;
}
</style>
