<template>
  <div class="app-container">
    <el-form style="background-color: #fff; padding: 15px 5px; border-radius:10px;"  :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
      <p class="bgtan" style="margin-top: 0;">搜索条件</p>
			<el-row>  
				<el-col :span="8">
					<el-form-item label="开始时间" prop="startTime">
					        <el-date-picker clearable   
					          v-model="queryParams.startTime"
					          type="datetime"
					          value-format="yyyy-MM-dd HH:mm:ss"
					          placeholder="请选择请假开始时间">
					        </el-date-picker>
					      </el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item label="结束时间" prop="endTime">
					        <el-date-picker clearable
					          v-model="queryParams.endTime"
					          type="datetime"
					          value-format="yyyy-MM-dd HH:mm:ss"
					          placeholder="请选择请假结束时间">
					        </el-date-picker>
					      </el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item label="请假人姓名" prop="absenteeName">
					        <el-input
					          v-model="queryParams.absenteeName"
					          placeholder="请输入请假人姓名"
					          clearable
					          @keyup.enter.native="handleQuery"
					        />
					      </el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item label="班级名称" prop="classId">
							  <el-select v-model="queryParams.classId" placeholder="请选择班级名称">
							    <el-option
							      v-for="dict in kiuesegh"
							      :key="dict.deptId"
							      :label="dict.deptName"
							      :value="dict.deptId"
								  clearable
								  @keyup.enter.native="handleQuery"
							    ></el-option>
							  </el-select>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item label="请假类别" prop="category">
					   <el-select v-model="queryParams.category" placeholder="请选择请假类别" clearable>
					     <el-option
					       v-for="dict in dict.type.qjlx"
					       :key="dict.value"
					       :label="dict.label"
					       :value="dict.value"
						   clearable
						   @keyup.enter.native="handleQuery"
					     />
					   </el-select>
					</el-form-item>
				</el-col>
				
				<el-col :span="6">
					<el-form-item>
					  <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
					  <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
					</el-form-item>
				</el-col>
				<el-col :span="6">
					
				</el-col>
				<el-col :span="6">
					
				</el-col>
				<el-col :span="6">
					
				</el-col>
				<el-col :span="6">
					
				</el-col>
				<el-col :span="6">
					
				</el-col>
				<el-col :span="6">
					
				</el-col>
			</el-row>
      
      
    </el-form>

    <el-row :gutter="10" class="mb8" style=" border-top-left-radius: 12px; border-top-right-radius: 12px; background-color: #fff;margin: 0;margin-top: 20px;padding: 10px 5px; ">
      <p class="bgtan" style="margin-top: 0;">请假信息</p>
	   <el-col :span="1.5">
	          <el-button
	            type="primary"
	            plain
	            icon="el-icon-plus"
	            size="mini"
	            @click="handleAdd"
	            v-hasPermi="['system:leave:add']"
	          >新增</el-button>
	  </el-col>
	        <el-col :span="1.5">
	          <el-button
	            type="success"
	            plain
	            icon="el-icon-edit"
	            size="mini"
	            :disabled="single"
	            @click="handleUpdate"
	            v-hasPermi="['system:leave:edit']"
	          >修改</el-button>
	        </el-col>
	        <el-col :span="1.5">
	          <el-button
	            type="danger"
	            plain
	            icon="el-icon-delete"
	            size="mini"
	            :disabled="multiple"
	            @click="handleDelete"
	            v-hasPermi="['system:leave:remove']"
	          >删除</el-button>
	        </el-col>
	        <el-col :span="1.5">
	          <el-button
	            type="warning"
	            plain
	            icon="el-icon-download"
	            size="mini"
	            @click="handleExport"
	            v-hasPermi="['system:leave:export']"
	          >导出</el-button>
			  </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
     <div class="ngtes" style="background-color: #fff; padding: 0 10px;  padding-bottom: 40px; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;">
		<el-table  :max-height="tableMaxHeight"  v-loading="loading" :data="leaveList" @selection-change="handleSelectionChange">
		  <el-table-column type="selection" width="55" align="center" />
			<el-table-column label="姓名" align="center" prop="absenteeName" width="100" />
			 <el-table-column label="请假开始时间" align="center" prop="startTime" width="180">
			        <template slot-scope="scope">
			          <span>{{ scope.row.startTime}}</span>
			        </template>
			      </el-table-column>
			 <el-table-column label="请假结束时间" align="center" prop="endTime" width="180">
			        <template slot-scope="scope">
			          <span>{{ scope.row.endTime}}</span>
			        </template>
			      </el-table-column>
				  <el-table-column label="提交时间" align="center" prop="submitTime" width="180">
				         <template slot-scope="scope">
				           <span>{{ scope.row.submitTime}}</span>
				         </template>
				       </el-table-column>
			 <el-table-column label="请假理由" align="center" prop="reason" />
			</el-table-column>
				 <el-table-column label="请假类别" align="center" prop="category">
				        <template slot-scope="scope">
				          <dict-tag :options="dict.type.qjlx" :value="scope.row.category"/>
				        </template>
				</el-table-column>
			
			
			
			<!-- <el-table-column label="备注" align="center" prop="remark" /> -->
		  <el-table-column  label="操作" align="center" class-name="small-padding fixed-width" width="160">
		    <template slot-scope="scope">
		      <el-button
		        size="mini"
		        type="text"
		        style="background: #00B034;color: #FFF;padding: 7px;"
		        @click="handleUpdate(scope.row)"
		        v-hasPermi="['student:info:edit']"
		      >修改</el-button>
		      <el-button
		        size="mini"
		        type="text"
		        style="background: red;color: #FFF;padding: 7px;"
		        @click="handleDelete(scope.row)"
		        v-hasPermi="['student:info:remove']"
		      >删除</el-button>
			  
			  <!-- <el-dropdown class="nlos" style="background: #3a77ea;color: #FFF; padding: 3px 0; border-radius: 5px;" size="mini" @command="(command) => handleCommand(command, scope.row)" >
			    <span class="el-dropdown-link">
			      <i class="el-icon-d-arrow-right el-icon--right"></i>更多
			    </span>
			    <template #dropdown>
			    <el-dropdown-menu slot="dropdown">
			      <el-dropdown-item  command="getPass" icon="el-icon-circle-check"
			           >历史数据</el-dropdown-item>
			    </el-dropdown-menu>
			    </template>
			  </el-dropdown> -->
		    </template>
		  </el-table-column>
		</el-table>
		
		<pagination
		  v-show="total>0"
		  :total="total"
		  :page.sync="queryParams.pageNum"
		  :limit.sync="queryParams.pageSize"
		  @pagination="getList"
		/> 
	 </div>
    

    <!-- 添加或修改注册-老师-班级（学科）对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1300px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <!-- <el-form-item label="老师id" prop="teacherId">
          <el-input v-model="form.teacherId" placeholder="请输入老师id" />
        </el-form-item> -->
		<el-row>
			<el-col :span="8">
				 <!-- <el-form-item label="学校名称" prop="schoolId">
				  					  <el-select :disabled="fku"  style="width: 100%;"   v-model="form.schoolId" placeholder="请选择学校名称">
				  					    <el-option
				  					      v-for="dict in deptOptions"
				  					      :key="dict.deptId"
				  					      :label="dict.deptName"
				  					      :value="dict.deptId"
				  						  @click.native="mjyhes(dict)"
				  					    ></el-option>
				  					  </el-select>
				  </el-form-item> -->
			</el-col>
			<el-col :span="8">
				  <el-form-item label="班级名称" prop="classId">
				  <el-select style="width: 100%;" v-model="form.classId" placeholder="请选择班级名称">
				    <el-option
				      v-for="dict in kiuesegh"
				      :key="dict.deptId"
				      :label="dict.deptName"
				      :value="dict.deptId"
				  	@click.native="mjyhess(dict)"
				    ></el-option>
				  </el-select>
				  </el-form-item>
			</el-col>
			
			<el-col :span="8">
				<el-form-item label="姓名" prop="absenteeName">
					<el-select style="width: 100%;" filterable v-model="form.absenteeName" placeholder="请选择学生名称">
					  <el-option
					    v-for="dict in infoListstu"
					    :key="dict.id"
					    :label="dict.studentName"
					    :value="dict.studentName"
						@click.native="mjyhesstu(dict)"
					  ></el-option>
					</el-select>
				          <!-- <el-input v-model="form.name" placeholder="请输入姓名" /> -->
				</el-form-item>
			</el-col>
			<el-col :span="8">
				<el-form-item label="开始时间" prop="startTime">
				          <el-date-picker style="width:100%;" clearable
				            v-model="form.startTime"
				            type="datetime"
				            value-format="yyyy-MM-dd HH:mm:ss "
				            placeholder="请选择请假开始时间">
				          </el-date-picker>
				        </el-form-item>
			</el-col>
			<el-col :span="8">
				<el-form-item label="结束时间" prop="endTime">
				          <el-date-picker style="width:100%;" clearable
				            v-model="form.endTime"
				            type="datetime"
				            value-format="yyyy-MM-dd HH:mm:ss"
				            placeholder="请选择请假结束时间">
				          </el-date-picker>
				        </el-form-item>
			</el-col>
			<el-col :span="8">
				<el-form-item label="请假理由" prop="reason">
				          <el-input v-model="form.reason" placeholder="请输入请假理由" />
				        </el-form-item>
			</el-col>
			
			<el-col :span="8">
				<el-form-item label="请假类别" prop="category">
				   <el-select style="width:100%;" v-model="form.category" placeholder="请选择请假类别" clearable>
				     <el-option
				       v-for="dict in dict.type.qjlx"
				       :key="dict.value"
				       :label="dict.label"
				       :value="dict.value"
				     />
				   </el-select>
				</el-form-item>
			</el-col>
		</el-row>
          
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
	
  </div>
</template>

<script>
import PieCharts from './../../dashboard/PieCharts'
import PieChartss from './../../dashboard/PieChartss'
import { listLeave, getLeave, delLeave, addLeave, updateLeave } from "@/api/zhihuixy/record";
import { listInfo, listInfostu,getInfo, delInfo, delInfoxinl,delInfoshengao,addInfo, updateInfo,updateInfoxl,updateInfoshg,listInfols,listInfolsxinl,listInfolss } from "@/api/zhihuixy/infos";
import { listDept,listDeptode} from "@/api/system/dept";
import {regionData,CodeToText} from 'element-china-area-data'
const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}
export default {
  name: "Info",
  dicts: ['qjlx'],
  components: {
    PieCharts,
	PieChartss
  },
  data() {
    return {
		
		// 遮罩层
		      loading: true,
		      // 选中数组
		      ids: [],
		      // 非单个禁用
		      single: true,
		      // 非多个禁用
		      multiple: true,
		      // 显示搜索条件
		      showSearch: true,
		      // 总条数
		      total: 0,
		      // 请假记录信息表格数据
		      leaveList: [],
		      // 弹出层标题
		      title: "",
		      // 是否显示弹出层
		      open: false,
		      // 查询参数
		      queryParams: {
		        pageNum: 1,
		        pageSize: 10,
		        type: null,
		        startTime: null,
		        endTime: null,
		        reason: null,
		        classId: null,
		        className: null,
		        absenteeId: null,
		        absenteeName: null,
		        examinersId: null,
		        examinersName: null,
		        category: null,
		        isPass: null,
		        photo: null,
		        submitTime: null,
				params:{}
		      },
		      // 表单参数
		      form: {},
		      // 表单校验
		      rules: {
				  reason: [
				            { required: true, message: "请假理由不能为空", trigger: "blur" }
				          ],
				          absenteeName: [
				            { required: true, message: "请假人id不能为空", trigger: "blur" }
				          ],
				          category: [
				            { required: true, message: "请假类别 1：病假，2：产假，3：陪产假，4：婚假，5：丧假，6：其他不能为空", trigger: "blur" }
				          ],
		      },
	  kiuesegh:[],
	   kiueseghs:[],
	   options: regionData,
	     selectedOptions: [],
	     addtions:{},			//存储地址数据
	     namestwo:[],
	      keyword: '',
	   mapZoom: 15,
	   mapCenter: '潜山市',
	   mapLocation: {
	     address: undefined,
	     coordinate: undefined
	   },
	   okuyt:true,
	   nameadd:[],
	   kdourg:[{'value':'抱歉，没有搜索到位置请重新输入'}],
	   location:'',
	   pageCapacitys:20,
	   cb:undefined,
	   nameadd:[],
	   listInfostucs:{
		   params:{}
	   },
	   infoListstu:[],
	   deptOptions:[],
	   uhgte:false,
	   lishilist:[],
	   beach:{},
	   hgdtesge:{},
	   ngshg:false,
	   ngtzh:false,
    };
  },
  created() {
		window.onresize = () => {
		          this.changeTableMaxHeight()
		        }
		        this.changeTableMaxHeight()
    this.getList();
	this.getdept(0)
  },
	mounted() {
		 window.onresize = () => {
		           this.changeTableMaxHeight()
		         }
		         this.changeTableMaxHeight()
	},
  methods: {
	  
	  // 查询历史档案信息
       getlihgw(val){
		 this.loading = true;
		 let he={}
		 he.studentId = val
		 // this.listInfostucs.classId = val
		 // this.ngshg = false,
		 // this.ngtzh = true,
		 listInfols(he).then(response => {
		   this.lishilist = response.rows;
		   this.loading = false;
		 });  
	   },
		   getlihgws(val){
		   		 this.loading = true;
		   		 let he={}
		   		 he.studentId = val
		   		 // this.listInfostucs.classId = val
		   		 listInfolss(he).then(response => {
		   		   this.beach = response.data;
				   // this.hgdtesge.x = this.beach[0]
				   // this.hgdtesge.y = this.beach[0]
				   // this.hgdtesge.x = this.beach[0]
		   		   this.loading = false;
		   		 });  
		   },
		 
	  /** 查询学生档案信息列表 */
	  getListuye(val) {
	    this.loading = true;
		this.listInfostucs.classId = val
		// if(this.$store.state.user.rolesName.length==1){
		// 		  this.$store.state.user.rolesName.filter(rou=>{
		// 			  if(rou.roleName == '超级管理员'){
		// 				 this.queryParams.params = {}
		// 			  }else{
		// 				this.queryParams.params.role =  'teacher'
		// 			  }
		// 		  })
		// }else{
		// 		this.queryParams.params.role =  'teacher'  
		// }
		this.listInfostucs.params.role=this.roleqh()
	    listInfostu(this.listInfostucs).then(response => {
	      this.infoListstu = response.rows;
	      this.loading = false;
	    });
	  },
	  getdept(val){
	  		  let kuesf=  {'parentId':val}
	  		  // this.kiuesegh = []
	  			  console.log(kuesf)
	  		listDeptode(kuesf).then(response => {
	  		  this.deptOptions = this.handleTree(response.data, "deptId");
	  		  this.deptOptions.filter(rou =>{
	  			  if(rou.children != undefined){
	  			  	rou.children.filter(rour =>{
	  			  					  this.kiuesegh.push(rour)
	  			  	})		  
	  			  }
	  			  // this.kiuesegh = rou.children
	  			  // this.kiuesegh.push(rou.children)
	  			  console.log(rou.children)
	  		  })
	  		  this.kiueseghs = this.kiuesegh
	  		  // this.deptOptions = response.data
	  		  console.log(this.kiuesegh)
	  		});  
	  },
	  
    /** 查询学生档案信息列表 */
    getList() {
      this.loading = true;
	  console.log(this.$store.state.user.rolesName)
	  this.queryParams.params.role=this.roleqh()
            listLeave(this.queryParams).then(response => {
              this.leaveList = response.rows;
              this.total = response.total;
              this.loading = false;
            });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
                type: null,
                startTime: null,
                endTime: null,
                reason: null,
                classId: null,
                className: null,
                absenteeId: null,
                absenteeName: null,
                examinersId: null,
                examinersName: null,
                category: null,
                isPass: null,
                photo: null,
                submitTime: null,
                createBy: null,
                createTime: null,
                updateBy: null,
                updateTime: null,
                remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
       this.ids = selection.map(item => item.recordId)
       this.single = selection.length!==1
       this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
       this.reset();
       this.open = true;
       this.title = "添加请假记录信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
     this.reset();
           const id = row.recordId || this.ids
           getLeave(id).then(response => {
             this.form = response.data;
			 this.form.classId = this.form.classId - 0
             this.open = true;
             this.title = "修改请假记录信息";
           });
    },
	// 身份证
	idcde(event) {
		console.log(event);
		// 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
		let reg = /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
	  let _IDre15 =  /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/;
	  // 护照
	   // let ncjsle = /^1[45][0-9]{7}$|(^[P|p|S|s]\d{7}$)|(^[S|s|G|g|E|e]\d{8}$)|(^[Gg|Tt|Ss|Ll|Qq|Dd|Aa|Ff]\d{8}$)|(^[H|h|M|m]\d{8,10}$)/;
	   let ncjsle = /^[a-zA-Z0-9]{5,17}$/
	   let nhyeli = /^[a-zA-Z]{5,17}$/
	  // 港澳
	  let gnse = /^([A-Z]\d{6,10}(\(\w{1}\))?)$/;
	  // 台湾
	  // let tw = /^\d{8}|^[a-zA-Z0-9]{10}|^\d{18}$/
	  var tw =  /^[0-9]{8}$/;
	   var twe = /^[0-9]{10}$/;
	  // 校验身份证：
	  console.log(reg.test(this.form.idCard),23741)
		if ( reg.test(this.form.idCard)|| _IDre15.test(this.form.idCard)) {
			// this.idea();
			this.go(this.form.idCard);
			// callback()
		} else {
	    if(ncjsle.test(this.form.idCard) || nhyeli.test(this.form.idCard)){
	       console.log(3)
	    }else{
	      if(gnse.test(this.form.idCard)  ){
	          console.log(4)
	      }else{
	        if(tw.test(this.form.idCard) || twe.test(this.form.idCard)){
	          console.log(5)
	        }else{
	          this.$message.error('证件格式不正确');
	        }
	      }
	
	    }
		}
	},
	// 实现自动生成生日，性别，年龄
	go(idCard) {
		 let sex = null;
		        let birth = null;
		        let myDate = new Date();
		        let month = myDate.getMonth() + 1;
		        let day = myDate.getDate();
		        let age = 0;
		
		        if (idCard.length === 18) {
		          age = myDate.getFullYear() - idCard.substring(6, 10) - 1;
		          sex = idCard.substring(16, 17);
		          birth = idCard.substring(6, 10) + "-" + idCard.substring(10, 12) + "-" + idCard.substring(12, 14);
		          if (idCard.substring(10, 12) < month || idCard.substring(10, 12) === month && idCard.substring(12, 14) <= day)
		            age++;
		
		        }
		        if (idCard.length === 15) {
		          age = myDate.getFullYear() - idCard.substring(6, 8) - 1901;
		          sex = idCard.substring(13, 14);
		          birth = "19" + idCard.substring(6, 8) + "-" + idCard.substring(8, 10) + "-" + idCard.substring(10, 12);
		          if (idCard.substring(8, 10) < month || idCard.substring(8, 10) === month && idCard.substring(10, 12) <= day)
		            age++;
		        }
		
		        if (sex % 2 === 0) sex = '2';
		        else sex = '1';
				this.form.sex = sex
				this.form.age = age
		        return {
		          age,
		          sex,
		          birth
		        }
	},
	// 请求身份证数据
	// idea() {
	// 	idces({ idCard: this.form.idCard }).then(response => {
	// 		console.log(response);
			
	// 	});
	// },
	// 更多操作触发
	handleCommand(command, row) {
	  switch (command) {
	    case "getPass":
	      this.getPass(row);
	      break;
	    default:
	      break;
	  }
	},
	// 历史数据
	getPass(val){
		console.log(val)
		this.innerDrawer = true
		this.getlihgw(val.id)
	},
    /** 提交按钮 */
    submitForm() {
		this.$refs["form"].validate(valid => {
		        if (valid) {
		          if (this.form.recordId != null) {
		            updateLeave(this.form).then(response => {
		              this.$modal.msgSuccess("修改成功");
		              this.open = false;
		              this.getList();
		            });
		          } else {
		            addLeave(this.form).then(response => {
		              this.$modal.msgSuccess("新增成功");
		              this.open = false;
		              this.getList();
		            });
		          }
		        }
		      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.recordId || this.ids;
	  delLeave(ids).then(response => {
	   this.getList();
	   this.$modal.msgSuccess("删除成功");
	  });
            // this.$modal.confirm('是否确认删除请假记录信息编号为"' + ids + '"的数据项？').then(function() {
            //   return delLeave(ids);
            // }).then(() => {
            //   this.getList();
            //   this.$modal.msgSuccess("删除成功");
            // }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('record/leave/export', {
              ...this.queryParams
            }, `leave_${new Date().getTime()}.xlsx`)
    },
	handleChange (value) {
	        console.log(3976);
	      //我们选择地址后，selectedOptions 会保存对应的区域码，例如北京的区域码为'110000'
	      //我们要取出区域码对应的汉字，就需要用CodeToText(区域码)进行输出
	        this.addtions.selectedOptions = value
	        console.log(this.selectedOptions);
	        var name = ''
	        this.selectedOptions.map(item => name += CodeToText[item] + '/')
	        this.addtions.names = name  
	        this.namestwo = this.addtions.names.split('/')
	        // for (let index = 0; index < this.namestwo.length; index++) {
	        //   const element = this.namestwo[index];
	        //   this.form.provinceName.value = this.namestwo[0]
	        //    this.form.cityName.value = this.namestwo[1]
	        //    this.form.regionName.value = this.namestwo[2]
	        //    console.log(this.form);
	           
	        // }
	        this.form.area = this.addtions.names.split('/')
	        this.form.areaCode = this.addtions.selectedOptions
	        console.log(this.form.area);
	        for(var i = 0 ; i < this.form.area.length; i++){
	          this.mapCenter =  this.form.area[1]
	          this.location = this.form.area[1]
	        }
	        console.log(this.mapCenter);
	        console.log(this.location);
	        
	        
	         console.log(this.form.areaCode);
	        console.log(this.addtions.names.split('/'))
	
	        console.log(this.addtions.selectedOptions)
	      },
	      // 、、地图
	      getLocationPoint(e){
	       console.log(e);
	       
	      },
	      searchcomplete(e){
	        console.log(e);
	        
	      },
	      handlerBMap({ BMap, map }) {
	      this.BMap = BMap
	      this.map = map
	      console.log(BMap,map);
	      console.log(this.mapLocatio);
	      
	      // if (this.mapLocation.coordinate && this.mapLocation.coordinate.lng) {
	      //   // this.mapCenter.lng = this.mapLocation.coordinate.lng
	      //   // this.mapCenter.lat = this.mapLocation.coordinate.lat
	      //   this.mapZoom = 15
	      //   map.addOverlay(new this.BMap.Marker(this.mapLocation.coordinate))
	      // } else {
	      //   // this.mapCenter.lng = 113.271429
	      //   // this.mapCenter.lat = 23.135336
	      //   this.mapZoom = 10
	      // }
	    },
	    querySearch(queryString,cb) {
	      // console.log(e);
	      // this.keyword = e
	      // results, cb
	      // var that = this
	      // var myGeo = new this.BMap.Geocoder()
	      // console.log(queryString, cb);
	      
	      // myGeo.getPoint(queryString, function(point) {
	      //   console.log(point);
	      //   // var point = '安庆市'
	        
	      //   if (point) {
	      //     that.mapLocation.coordinate = point
	      //     that.makerCenter(point)
	      //   } else {
	      //     that.mapLocation.coordinate = null
	      //   }
	      // }, this.locationCity)
	      // console.log(this.locationCity);
	      
	      // var options = {
	      //   onSearchComplete: function(results) {
	      //     console.log(local.getStatus());
	          
	      //     if (local.getStatus() === 0) {
	      //       // 判断状态是否正确
	      //       var s = []
	      //       console.log(results.getCurrentNumPois());
	            
	      //       for (var i = 0; i < results.getCurrentNumPois(); i++) {
	      //         var x = results.getPoi(i)
	      //         console.log(x);
	              
	      //         var item = { value: x.address + x.title, point: x.point }
	      //         s.push(item)
	      //         // console.log(s);
	              
	      //         cb(s)
	      //       }
	      //       // console.log(s);
	            
	      //     } else {
	      //       cb()
	      //     }
	      //   }
	      // // this.oieueo(results)
	      console.log(queryString);
	      var item = []
	      var x = ''
	      //  this.nameadd = queryString.Ir
	      // queryString.value = ''
	       for(var i = 0 ; i <  this.nameadd.length; i++){
	         console.log(queryString[i]);
	        // var item = { value: this.nameadd[i].address + this.nameadd[i].title, point: this.nameadd[i].point }
	        // if(queryString[i].address == undefined){
	        //     queryString[i].address = ''
	        // }
	        //  x= this.nameadd[i].address + this.nameadd[i].title 
	        // item.push(x)
	       this.nameadd[i].value = this.nameadd[i].address + this.nameadd[i].title 
	       console.log(this.nameadd[i].value);
	       
	      //  this.nameadd.push( item)
	         }
	        //  this.nameadd = item
	         console.log(this.nameadd);
	        //  this.cb = cb
	      cb(this.nameadd)
	      if(this.nameadd.length != 0){
	        // console.log(local.getStatus());
	       
	      }else{
	        cb(this.kdourg)
	      }
	       
	      console.log(this.nameadd);
	      
	      // }
	      // console.log(options );
	    // var local = new this.BMap.LocalSearch('安庆市', options)
	    
	    // console.log(queryString );
	      // local.search(queryString)
	    },
	    handleSelect(item) {
	      var { point } = item
	      this.mapLocation.coordinate = point
	      console.log(this.mapLocation.coordinate);
	      
	      // this.makerCenter(point)
	    },
	    makerCenter(point) {
	      console.log(point);
	      
	      if (this.map) {
	        this.map.clearOverlays()
	        this.map.addOverlay(new this.BMap.Marker(point))
	        // this.mapCenter.lng = point.lng
	        // this.mapCenter.lat = point.lat
	        // this.mapCenter = '安庆市'
	        this.mapZoom = 15
	      }
	    },
	    oieueo(results,cb){
	    //  console.log(results,cb);
	   console.log(results);
	   console.log(this.form.address);
	
	
	    // if(this.form.address == ''){
	    //   this.nameadd = []
	    // }else{
	    //  this.nameadd = results.Ir
	    // }
	    //  console.log(type.Ir.value);
	     console.log(this.nameadd);
	    //  var cb= cb
	     this.querySearch(this.nameadd,this.cb)
	    //  results,cb
	     
	    //  this.nameadd.
	    //  var local = new this.BMap.LocalSearch(this.map, options)
	    //   local.search(queryString)
	     
	    },
	    //选中数据
	    confirmf(e){
	      console.log(143);
	      console.log(e);
	      this.nameadd = e
	      
	    },
	    boiu(){
	      // this.okuyt = false
	    },
	    //获取焦点
	    faie(){
	// this.okuyt = true
	    },
		// 学校选择器
		mjyhes(){
			
		},
		// 班级选择器
		mjyhess(val){
			this.getListuye(val.deptId)
		},
		
		// 学生姓名选择器
		mjyhesstu(val){
			if(this.form.classId == null){
				this.$message.error('请先选择班级');
				return
			}else if(this.form.classId == undefined){
				this.$message.error('请先选择班级');
				return
			}else if(this.form.classId == ''){
				this.$message.error('请先选择班级');
				return
			}
			this.form.absenteeId = val.id
			this.form.absenteeName = val.studentNumber
		},
		hetdt(val){
			this.drawer = true
			this.ngshg = false,
			this.ngtzh = true,
			this.getlihgw(val.id)
			this.getlihgws(val.id)
		},
		hetdtw(val){
			this.drawer = true
			this.ngshg = true,
			this.ngtzh = false,
			this.getlihgw(val.id)
			this.getlihgws(val.id)
		},
		// 获取屏幕高度
		showFilterForm () {
		      this.filterActive = !this.filterActive
		      this.changeTableMaxHeight()
		    },
		
		    changeTableMaxHeight () {
		      let height = document.body.offsetHeight // 网页可视区域高度
		      // if (this.filterActive) {
		      //   this.tableMaxHeight = height - 320
		      // } else {
		        this.tableMaxHeight = height - 250
		      // }
		      console.log(height)
		    },
			ngekusfd(){
				if(this.form.isNearsightedness == '1'){
					this.uhgte = true
				}else{
					this.uhgte = false
				}
			}
			
  }
};
</script>
<style>
	.el-drawer__body{
		padding: 0 10px;
	}
	.el-card__body, .el-main{
		padding:10px;
		/* margin-bottom:10px; */
	}
	.el-divider--horizontal{
		margin:7px 0;
	}
	.text {
	    font-size: 14px;
	  }
	
	  .item {
	    /* padding: 10px 0; */
	  }
	  .item p {
		  margin:0;
		  color:#161616;
		  margin-bottom:5px;
	  }
	  .item p span{
		  color:#aaa;
		  /* padding-left:5px; */
		  margin-right:5px;
	  }
	
	  .box-card {
	    width: 100%;
		margin-bottom:10px;
	  }
	.ngtes .el-table .el-dropdown-link, .el-table .el-dropdown-selfdefine{
		margin-left:0;
	}
	.ngtes .el-button+.el-button, .el-checkbox.is-bordered+.el-checkbox.is-bordered{
		margin-right:5px;
		margin-left:5px;
	}
  .demo-table-expand {
    font-size: 0;
	.ngr{
		color: #161616;
	}
  }
  .demo-table-expand label {
    width: 90px;
	text-align: right;
    color: #666;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 25%;
  }
</style>

<style scoped lang="scss">
	
	.bgtan{
		border-left: 3px solid #4775EA;
		padding-left: 10px;
	}
	
	.app-container{
		background-color: #f6f6f6;
		// height: 100vh;
	}
	.bm-view {
	  width: 100%;
	  height: 300px;
	}
	.oiue{
	  height: 300px;
	}
	.pui{
	  height: 100px;
	  position: absolute;
	  top: 40px;
	  left: 0;
	  z-index: 99;
	  // overflow: hidden;
	}
	.anchorTL{
	  width: 100%;
	}
	.app-container{
	  // padding: 0 !important;
	}
	.BMap_mask{
	  // background-color: #fff !important;
	}
	.bm-view {
	  width: 100%;
	  height: 300px;
	}
	// 去除百度地图的图标 根据实际情况看是否要加样式穿透(::v-deep)
	    ::v-deep .anchorBL {
	      display: none !important;
	    }
</style>
