<!--供应商管理-->
<template>
  <div class="supplier">
    <div class="supplier-title">
      <P>实验室名称-已授权列表 </P>
      <p class="button-p reset-button-one" @click="backPage">返回</p>
    </div>
    <div class="supplier-page">
      <advanced-search :searchData="searchData"></advanced-search>
        <el-table  v-loading="loading"  ref="multipleTable2"  border tooltip-effect="dark" :row-key="getRowKeys2" :data="tableData"
                  highlight-current-row @selection-change="handleSelectionChange2">
          <el-table-column type="selection"  width="55" :reserve-selection="true" align="center"></el-table-column>
        <el-table-column label="所属单位" align="left" prop="deptName" show-overflow-tooltip/>
        <el-table-column label="姓名" align="left" prop="nickName"></el-table-column>
        <el-table-column  align="left" prop="verifyMode">
          <template slot-scope="scope" slot="header">
            <span>验证方式
              <el-tooltip class="item" effect="dark" placement="top-start">
                <i class= 'el-icon-question' style="color:#E6A23C; margin-left:5px;font-size: 16px;'"></i>
                <div style="width: 200px;" slot="content">红色:表示此验证方式失败<br/>绿色表示此验证方式成功</div>
              </el-tooltip>
            </span>
          </template>
          <template slot-scope="scope">
              <span  v-for="item in scope.row.verifyList" :class="item.verifyStatus?'verify-green':'verify-red'">{{item.name}}</span>
          </template>
        </el-table-column>
        <el-table-column label="授权状态" align="left" prop="isretry">
          <template slot-scope="scope">
            <span v-if="scope.row.state">成功</span>
            <span v-if="!scope.row.state">失败</span>
          </template>
        </el-table-column>
        <el-table-column label="类别" align="left" prop="userType"></el-table-column>
        <el-table-column label="授权时间" align="left" prop="verifyTime" show-overflow-tooltip></el-table-column>
        <el-table-column label="授权人" align="left" prop="verifyUser"></el-table-column>
        <el-table-column label="失效时间" align="left" prop="invalidTime" width="250">
          <template slot-scope="scope">
            <el-date-picker
              :disabled="(scope.row.userType=='学生' && admittance) || (scope.row.userType=='教师' && whiteList)"
              :picker-options="pickerOptions0"
              v-model="scope.row.invalidTime"
              value-format="yyyy-MM-dd"
              type="date"
              placeholder="请选择失效时间">
            </el-date-picker>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="220">
          <template slot-scope="scope">
            <div class="table-button-box">
              <p class="table-button-null"></p>
              <p class="table-button-p" v-if="(scope.row.userType=='学生' && !admittance && !scope.row.isretry) || (scope.row.userType=='教师' && !whiteList) && !scope.row.isretry"  @click="handleClick('',scope.row,'again')">手动<i style="color: #0183FA;cursor: pointer;font-style: normal;text-decoration:underline" @click="handleClick('',scope.row,'retry')">重试</i></p>
              <p class="table-button-p" v-if="scope.row.userType=='学生' && admittance"  @click="handleClick('',scope.row,'again')"  >安全准入<i style="color: #0183FA;cursor: pointer;font-style: normal;text-decoration:underline" @click="handleClick('',scope.row,'retry')" v-if="!scope.row.isretry">重试</i></p>
              <p class="table-button-p" v-if="scope.row.userType=='教师' && whiteList" @click="handleClick('',scope.row,'again')" >白名单<i style="color: #0183FA;cursor: pointer;font-style: normal;text-decoration:underline" @click="handleClick('',scope.row,'retry')" v-if="!scope.row.isretry">重试</i></p>
              <p class="table-button-p" v-if="(scope.row.userType=='学生' && !admittance) || (scope.row.userType=='教师' && !whiteList)"@click="handleClick('',scope.row,'delete')">删除</p>
              <p class="table-button-null"></p>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div style="display: flex;height:32px;margin-top:15px;">
        <div style="flex:5;">
          <pagination :page-sizes="[20, 30, 40, 50]"
                      v-show="total>0"
                      :total="total"
                      style="margin:0;"
                      :page.sync="queryParams.page"
                      :limit.sync="queryParams.pageSize"
                      @pagination="getList"
          />
        </div>
      </div>
      <div style="text-align: center;">
        <el-button class="color_ff back_one" style="width: 300px;" @click="loseTimeSubmitForm()">提交</el-button>
      </div>

    </div>
    <!--关联实验室弹框-->
    <el-dialog :title=dialogTitle @close="handleClose" :visible.sync="dialogVisible" width="80%">
      <el-form :model="dialogForm" ref="dialogForm" :inline="true" label-width="140px">
        <el-form-item label="关键字" prop="name" >
          <el-input
            v-model="dialogForm.searchValue"
            placeholder="请输入名称/联系方式"
            clearable
            size="small"
          />
        </el-form-item>
        <el-form-item label="所属单位" prop="deptId" label-width="80px">
          <el-select v-model="dialogForm.deptId" clearable placeholder="请选择学院">
            <el-option
              v-for="item in collegeOptions"
              :key="item.deptId"
              :label="item.deptName"
              :value="item.deptId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <p class="inquire-button-one" style="margin-left:20px;" @click="onSearch">查询</p>
          <p class="reset-button-one" style="margin-left:20px;" @click="resetForm">重置</p>
        </el-form-item>
      </el-form>
      <div class="btn_list">
        <i class="el-icon-warning"></i>
        <i>已选择 {{labWhiteJoinSubList.length}} 项目</i>
        <i @click="toggleSelection(dialogTable)">全选本页</i>
        <i></i>
        <i @click="toggleSelection()">清除选项</i>
      </div>
      <el-table ref="multipleTable"  border tooltip-effect="dark" :row-key="getRowKeys" :data="dialogTable"
                highlight-current-row @selection-change="handleSelectionChange" style="cursor: pointer;height:500px;">
        <el-table-column type="selection"  width="55" :reserve-selection="true" align="center"></el-table-column>
        <el-table-column label="所属单位" align="left" prop="deptName"/>
        <el-table-column label="姓名" align="left" prop="nickName" />
        <el-table-column label="导师" align="left" prop="tutorUserName" v-if="userType==1"/>
        <el-table-column label="专业" align="left" prop="major" v-if="userType==1"/>
        <el-table-column label="身份" align="left" prop="positionName" v-if="userType==2"/>
        <el-table-column label="验证方式" align="left" prop="verifyMode">
          <template slot-scope="scope">
            <el-select v-model="scope.row.verifyMode" @change="verifyModeFun(scope.row)" clearable >
              <el-option
                v-for="item in verifyWayList"
                :key="item.key"
                :label="item.value"
                :value="item.key">
              </el-option>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column label="失效时间" align="left" prop="invalidTime">
          <template slot-scope="scope">
            <el-date-picker
              @blur="invalidTimeFun(scope.row,$event)"
              :picker-options="pickerOptions0"
              v-model="scope.row.invalidTime"
              value-format="yyyy-MM-dd"
              type="date"
              placeholder="请选择失效时间">
            </el-date-picker>
          </template>
        </el-table-column>
      </el-table>
      <pagination :page-sizes="[20, 30, 40, 50]"
                  v-show="total>0"
                  :total="total"
                  :page.sync="dialogForm.page"
                  :limit.sync="dialogForm.pageSize"
                  @pagination="getUserList"
      />
      <div class="configuration">
        <el-form  :model="configuration" ref="queryForm" :inline="true" v-if="unifyDeploy">
          <el-form-item label="验证方式:" prop="name">
            <el-select v-model="configuration.verifyMode" clearable >
              <el-option
                v-for="item in verifyWayList"
                :key="item.key"
                :label="item.value"
                :value="item.key">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="失效时间:" prop="name">
            <el-date-picker
              :picker-options="pickerOptions0"
              v-model="configuration.invalidTime"
              value-format="yyyy-MM-dd"
              type="date"
              placeholder="请选择失效时间">
            </el-date-picker>
          </el-form-item>
        </el-form>
        <p :class="unifyDeploy?'add-button-one-120':'inquire-button-one'"  @click="unifyDeployFun()">{{unifyDeploy?'取消统一配置':'统一配置'}}</p>
        <el-button class="color_ff back_one" style="height: 42px" @click="submitForm()">提交</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listUser} from '@/apiDemo/permissionRequired'
import { listDepartments } from '@/apiDemo/system/dept'
import advancedSearch from "@/components/ZDcomponents/advancedSearch.vue"
import {
  AddImpowerHaikang,
  delUserHaikang,
  editImpowerHaikang,
  getHaikangQueryTypes,
  getHaikangUserList, retryImpowerHaikang
} from '@/apiDemo/laboratory/subject'

export default {
  name: "Approval",

  components: {
    advancedSearch
  },
  props:{
    pageData:{},
  },
  data() {
    return {
      loading:false,
      // 查询参数
      queryParams: {
        page: 1,
        pageSize:20,
        searchValue:'',
        userType:'',
        hardId:'',
        startTime:'',
        endTime:'',
      },
      total:0,
      tableData:[],
      dateRange:[],
      dialogForm:{
        page: 1,
        pageSize: 20,
        userType: '',
        searchValue:'',
        deptId:'',
      },
      dialogTitle:'选择学生',
      dialogVisible:false,
      collegeOptions:[],//学院
      labWhiteJoinSubList:[],
      dialogTable:[],
      radioList:[],
      userType:1,//判断是学生 1 教职工2
      verifyWayList:[],
      configuration:{
        invalidTime:'',
        verifyMode:'',
      },
      unifyDeploy:false,
      //提交
      form:{},
      // 设置只能选择当前日期及之后的日期
      pickerOptions0: {
        disabledDate(time) {
          return time.getTime() < Date.now();//如果没有后面的-8.64e7就是不可以选择今天的
        }
      },
      impowerList:[],//授权列表选中
      admittance:false,//智能门禁有没有勾选安全准入
      whiteList:false,//智能门禁有没有勾选白名单
      searchData:{
        buttonList:[//按钮数组没有则为空
          {
            name:"批量重试",//按钮名称 只有再状态 1 时需要
            type:"1", //按钮类型 1.按钮 2.导入 3.导出
            parameter:"batchAgain",//按钮字符用于返回方法时的判断
            hasPermiRouter:"", // 权限字段 如果没有则传空字符 hasPermiRouter:"",
            isHasPermi:false//判断是否需要使用权限字符
          },
        ],
        searchList:[//搜索数组
          {
            name:"关键字",//描述名称
            key:"searchValue",//键名 用于返回数据
            value:"",//内容 用于组件内绑定数据
            placeholder:"请输入姓名/工号/学号",//输入提示
            level:"1",//1.普通搜索 2.高级搜索  普通搜索默认会在高级搜索时显示
            type:"1",//类型 1.input 2.select 3.TimePicker
            universal:'20',//通用参数 input时为最大长度 //TimePicker时可不传
            width:'260',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
          },
          {
            name:"类别",//描述名称
            key:"userType",//键名 用于返回数据
            value:"",//内容 用于组件内绑定数据
            placeholder:"请选择类别",//输入提示
            level:"1",//1.普通搜索 2.高级搜索  普通搜索默认会在高级搜索时显示
            type:"2",//类型 1.input 2.select 3.TimePicker
            universal:[ //通用参数 select时为列表数据 //TimePicker时可不传
              {label:"学生",value:"2"},{label:"教师",value:"1"},
            ],
            width:'175',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
          },
          {
            name:"授权时间段",//描述名称
            key:"dateRange",//键名 用于返回数据
            value:"",//内容 用于组件内绑定数据
            placeholder:"请选择",//输入提示
            level:"2",//1.普通搜索 2.高级搜索  普通搜索默认会在高级搜索时显示
            type:"3",//类型 1.input 2.select 3.TimePicker
            width:'260',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
          },
          {
            name:"分类",//描述名称
            key:"state",//键名 用于返回数据
            value:"",//内容 用于组件内绑定数据
            placeholder:"请选择分类",//输入提示
            level:"2",//1.普通搜索 2.高级搜索  普通搜索默认会在高级搜索时显示
            type:"2",//类型 1.input 2.select 3.TimePicker
            universal:[ //通用参数 select时为列表数据 //TimePicker时可不传
              {label:"全部",value:""},{label:"授权验证成功",value:true},{label:"授权验证失败",value:false},
            ],
            width:'175',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
          },
        ],
      },
    };


  },
  methods: {

      //弹出层表格里验证方式改变重新赋值
      verifyModeFun(d){
        let _this=this;
        this.dialogTable.forEach(function(item,index){
          if(item.userId==d.userId){
            _this.$set(_this.dialogTable,index,d)
          }
        })
      },
      //弹出层表格里失效时间改变重新赋值
        invalidTimeFun(item,e){
          this.dialogTable.splice(1,0);

      },
    //获取当前日期
      getdate() {
        const dates = new Date()
        dates.setMonth(dates.getMonth() + 1)
        var pastMonth = dates.getMonth() + 1
        var pastDay = dates.getDate()
        if (pastMonth >= 1 && pastMonth <= 9) {
          pastMonth = '0' + pastMonth
        }
        if (pastDay >= 0 && pastDay <= 9) {
          pastDay = '0' + pastDay
        }
        const endDate = dates.getFullYear() + '-' + pastMonth + '-' + pastDay
        return endDate
      },
      //查询
      onSearch() {
        this.dialogForm.pageNo = 1;
        this.getUserList();
      },
      //重置
      resetForm() {
        this.dialogForm.searchValue = '';
        this.dialogForm.deptId = '';
        this.onSearch();
      },
      //统一配置
      unifyDeployFun(){
          this.unifyDeploy=!this.unifyDeploy
          if(this.unifyDeploy==false){
            this.configuration.invalidTime='';
            this.configuration.verifyMode='';
          }
      },
      getRowKeys(row) {
        return row.userId;   //指定row-key的一个标识
      },
      getRowKeys2(row) {
        return row.id;   //指定row-key的一个标识
      },
      //监听关联记录弹窗关闭
      handleClose(){
        this.$refs.multipleTable.clearSelection();
        this.dialogForm.searchValue='';
        this.dialogForm.page=1;
        this.dialogForm.deptId='';
        this.configuration.invalidTime='';
        this.configuration.verifyMode='';
      },
      //取消选中
      toggleSelection(rows) {
        let _this=this;
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row,true);
          });

        } else {
          this.$refs.multipleTable.clearSelection();
        }
      },
      //选中实验室
      handleSelectionChange(val){
        let _this=this;
        this.labWhiteJoinSubList=[];
        this.labWhiteJoinSubList=val;

      },
     //已授权列表
      handleSelectionChange2(val){
        let _this=this;
        this.impowerList=[];
        this.impowerList=val;

      },

      handleClick(index,row,doType){
        let _this=this;
        if(doType=='delete'){//删除
          let _this=this
          this.$confirm('是否确认删除['+row.nickName+']门禁授权?', "警告", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          }).then(function() {
            delUserHaikang(row.id).then( response => {
              _this.msgSuccess("删除成功");
              _this.getList();
            });
          }).then(() => {
            _this.getList();

          }).catch(() => {});
        }else if(doType=='retry'){
          let arr=[];
          arr.push({'id':row.id})
          _this.retryImpowerHaikang(arr)
        }
      },
      //获取学院列表
      listDepartments(){
        listDepartments().then(response => {
          this.collegeOptions = response.data;
        });
      },
      /** 弹框查询列表 */
      getUserList() {//type 1学生 2教职工
        let _this=this;
        this.loading = true;
        if(_this.userType==1){
          this.dialogForm.userType=22
          listUser(this.addDateRange(this.dialogForm, this.dateRange)).then(response => {
              this.dialogTable = response.rows;
              this.total = response.total;
              this.loading = false;
              this.dialogTable.forEach(function(item) {
                  item.verifyMode='faceOrFpOrCardOrPw'
                  item.invalidTime=_this.getdate()
              })
            }
          );
        }else if(_this.userType==2){
          this.dialogForm.userType=11
          listUser(this.addDateRange(this.dialogForm, this.dateRange)).then(response => {
              this.dialogTable = response.rows;
              this.total = response.total;
              this.loading = false;
              this.dialogTable.forEach(function(item) {
                item.verifyMode='faceOrFpOrCardOrPw'
                item.invalidTime=_this.getdate()
              })
            }
          );

        }
      },
      /** 查询门禁授权类型 */
      getHaikangQueryTypes(){
        getHaikangQueryTypes().then(response => {
          if(response.code==200){
            this.verifyWayList=response.data
          }
        });
      },

      //返回
      backPage(){
        this.$parent.handleClick('','','back');
        this.$parent.getList();
      },
      //父组件必要此方法用于接收参数
      searchClick(type,data){
        let _this = this;
        if(type == 1){ //type  1.查询
          this.queryParams = JSON.parse(JSON.stringify(data));
          if(data.dateRange){
            this.queryParams.startTime = data.dateRange[0];
            this.queryParams.endTime = data.dateRange[1];
            delete this.queryParams.dateRange
          }else{
            delete this.queryParams.dateRange
          }
          this.queryParams.hardId=this.pageData.hardId;
          this.queryParams.page = 1;
          this.queryParams.pageSize = 20;
          this.getList();
        }else if(type == 2) { //type  1.重置
          this.queryParams = {
            page: 1,
            pageSize: 20,
            hardId:this.pageData.hardId
          };
          this.getList();
        }else if(type=='addStudent'){
          _this.unifyDeploy=false;
          _this.dialogVisible=true;
          _this.dialogTitle='选择学生';
          _this.userType=1;
          this.getUserList();
        }else if(type=='addTeacher'){
          _this.unifyDeploy=false;
          _this.dialogVisible=true;
          _this.dialogTitle='选择教职工';
          _this.userType=2;
          this.getUserList();
        }else if(type=='batchAgain'){
          if(_this.impowerList.length<=0){
            _this.msgError("请选择需要授权的数据!");
          }else{
            let arr=[];
            this.impowerList.forEach(function(item){
              arr.push({'id':item.id})
            })
            _this.retryImpowerHaikang(arr)

          }

        }
      },
      getList(){
        let _this=this;
        getHaikangUserList(_this.queryParams).then( response => {
          let res=response.rows;
          _this.tableData=res;
          _this.total=response.total;
          //先判断是或还是+,如果是或,判断有哪几种,并且判断每种显示红色还是绿色,如果是加,判断是否每个都是true,如果有一个不是那就是红色,入股都是那是绿色

          _this.tableData.forEach(function(item) {
            let verifyList=[];
            let isVerify=true;//判断验证方式显示颜色
            let isretry=true;//判断是否需要显示重试按钮
            if(item.verifyMode.indexOf('或')!=-1){//或

              if(item.verifyMode.search('密码')!=-1){
                verifyList.push({verifyStatus:item.state,name:'密码'})
                if(!item.state){
                  isretry=false
                }
              }
              if(item.verifyMode.search('人脸')!=-1){
                verifyList.push({verifyStatus:item.ifFace,name:'人脸'})
                if(!item.ifFace){
                  isretry=false
                }
              }
              if(item.verifyMode.search('刷卡')!=-1){
                verifyList.push({verifyStatus:item.ifCard,name:'刷卡'})
                if(!item.ifCard){
                  isretry=false
                }
              }
              if(item.verifyMode.search('指纹')!=-1){
                verifyList.push({verifyStatus:item.ifFinger,name:'指纹'})
                if(!item.ifFinger){
                  isretry=false
                }
              }
              item.verifyList=verifyList;
              item.isretry=isretry;

            }else if(item.verifyMode.indexOf('+')!=-1){//+

              if(item.verifyMode.search('密码')!=-1){
                if(!item.state){
                  isVerify=false;
                  isretry=false;
                }
              }
              if(item.verifyMode.search('人脸')!=-1){
                if(!item.ifFace){
                  isVerify=false;
                  isretry=false;
                }
              }
              if(item.verifyMode.search('刷卡')!=-1){
                if(!item.ifCard){
                  isVerify=false;
                  isretry=false;
                }
              }
              if(item.verifyMode.search('指纹')!=-1){
                if(!item.ifFinger){
                  isVerify=false;
                  isretry=false;
                }
              }
              verifyList.push({verifyStatus:isVerify,name:item.verifyMode})
              item.verifyList=verifyList;
              item.isretry=isretry;
            }else{//其他单个
              if(item.verifyMode.search('密码')!=-1){
                verifyList.push({verifyStatus:item.state,name:'密码'})
                if(!item.state){
                  isretry=false
                }
              }
              if(item.verifyMode.search('人脸')!=-1){
                verifyList.push({verifyStatus:item.ifFace,name:'人脸'})
                if(!item.ifFace){
                  isretry=false
                }
              }
              if(item.verifyMode.search('刷卡')!=-1){
                verifyList.push({verifyStatus:item.ifCard,name:'刷卡'})
                if(!item.ifCard){
                  isretry=false
                }
              }
              if(item.verifyMode.search('指纹')!=-1){
                verifyList.push({verifyStatus:item.ifFinger,name:'指纹'})
                if(!item.ifFinger){
                  isretry=false
                }
              }
              item.verifyList=verifyList;
              item.isretry=isretry;
            }
          })
        });
      },
      //失效时间修改后提交
      loseTimeSubmitForm(){
        let _this=this;
        let arr=[];
        _this.tableData.forEach(function(item2) {
          arr.push({'invalidTime':item2.invalidTime,'userId':item2.userId,'verifyMode':item2.verifyMode,id:item2.id})
        })
        _this.form.detailList=arr;
        setTimeout(function () {
          editImpowerHaikang(_this.form).then(response => {
            if(response.code==200){
              _this.msgSuccess("修改成功");
              _this.getList();
            }
          });
        },100)
      },
      //重试
      retryImpowerHaikang(arr){
        let _this=this;
        _this.form.detailList=arr;
        retryImpowerHaikang(_this.form).then(response => {
          if(response.code==200){
            _this.msgSuccess("重试成功");
            _this.dialogVisible=false;
            _this.$refs.multipleTable2.clearSelection();
            _this.getList();
          }else if(response.code==205){
            _this.$confirm(response.msg, "警告", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning"
            }).then(function() {
              _this.dialogVisible=false;
              _this.getList();
            }).then(() => {
              _this.dialogVisible=false;
              _this.getList();
            }).catch(() => {});
          }
        });
      },
      /* 新增授权*/
      submitForm(){
        let _this=this;
        let arr=[];
        if(this.labWhiteJoinSubList.length>0){
          if(_this.configuration.invalidTime && _this.configuration.verifyMode){//统一配置
            this.labWhiteJoinSubList.forEach(function(item){
              arr.push({'invalidTime':_this.configuration.invalidTime,'userId':item.userId,'verifyMode':_this.configuration.verifyMode})
            })
          }else{
            this.labWhiteJoinSubList.forEach(function(item){
              arr.push({'invalidTime':item.invalidTime,'userId':item.userId,'verifyMode':item.verifyMode})
            })
          }
          _this.form.detailList=arr;
          AddImpowerHaikang(_this.form).then(response => {
            if(response.code==200){
              _this.msgSuccess("新增成功");
              _this.dialogVisible=false;
              _this.getList();
            }else if(response.code==205){
              _this.$confirm(response.msg, "警告", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
              }).then(function() {
                _this.dialogVisible=false;
                _this.getList();
              }).then(() => {
                _this.dialogVisible=false;
                _this.getList();
              }).catch(() => {});
            }
          });
        }else{
          this.msgError("请先选择人员!");
        }



      },
  },
  mounted() {
    this.queryParams.hardId=this.pageData.hardId;
    this.form.hardId=this.pageData.hardId;
    this.admittance=this.pageData.controlScope.search("1") != -1
    this.whiteList=this.pageData.controlScope.search("2") != -1

    if(!this.admittance){//安全准入-学生授权
      this.searchData.buttonList.unshift( {
        name:"新增学生授权",//按钮名称 只有再状态 1 时需要
        type:"1", //按钮类型 1.按钮 2.导入 3.导出
        parameter:"addStudent",//按钮字符用于返回方法时的判断
        hasPermiRouter:"", // 权限字段 如果没有则传空字符 hasPermiRouter:"",
        isHasPermi:false//判断是否需要使用权限字符
      })
    }
    if(!this.whiteList){//白名单-教职工授权
      this.searchData.buttonList.unshift({
        name:"新增教职工授权",//按钮名称 只有再状态 1 时需要
        type:"1", //按钮类型 1.按钮 2.导入 3.导出
        parameter:"addTeacher",//按钮字符用于返回方法时的判断
        hasPermiRouter:"", // 权限字段 如果没有则传空字符 hasPermiRouter:"",
        isHasPermi:false//判断是否需要使用权限字符
      })
    }
    this.listDepartments();
    this.getHaikangQueryTypes()
    this.getList()
  }
};
</script>

<style lang="scss">
.supplier{
  flex:1;
  display: flex;
  flex-direction: column;

  /*顶部*/
  .supplier-title{
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E0E0E0;
    height: 90px;
    p:nth-child(1){
      line-height:60px;
      color: #0045AF;
      font-size:14px;
      margin:0 12px 0 20px;
    }
    p:nth-child(2){
      margin-right:20px;
    }
  }
  .supplier-page{
    flex:1;
    display: flex!important;
    flex-direction: column;
   // box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
    padding:20px 20px 20px!important;
    border-radius:10px;
  }
  /*弹框*/
  .btn_list{
    width: 100%;
    height: 40px;
    background: rgba(1,131,250,0.1);
    border-radius: 6px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 32px;
    >i{
      font-style: normal;
      display: inline-block;
      cursor: pointer;
    }
    >i:nth-of-type(1){
      font-size: 20px;
      color: #0045AF;
      margin: 0 16px 0 14px;
    }
    >i:nth-of-type(2){
      font-size: 16px;
      font-family: Source Han Sans CN;
      font-weight: bold;
      color: #999999;
      line-height: 16px;
    }
    >i:nth-of-type(3){
      font-size: 16px;
      font-family: Source Han Sans CN;
      font-weight: bold;
      color: #0045AF;
      line-height: 16px;
      margin: 0 28px 0 46px;
    }
    >i:nth-of-type(4){
      font-size: 16px;
      font-family: Source Han Sans CN;
      font-weight: bold;
      color: #0045AF;
      line-height: 16px;
    }
    >i:nth-of-type(5){
      font-size: 16px;
      font-family: Source Han Sans CN;
      font-weight: bold;
      color: #FFA312;
      line-height: 16px;
      margin: 0 40px 0 28px;
    }
    .bottom-button-box{
      display: flex;
      width:220px;
      margin: 0;
      p{
        font-size:14px;
        height:30px;
        width:100px;
        line-height:30px;
        text-align: center;
        border-radius:4px;
      }
      p:nth-child(1){
        border:1px solid #E0E0E0;
        margin-right:20px;
      }
      p:nth-child(2){
        border:1px solid #0045AF;
      }
    }
  }
  .configuration{
    height: 70px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid #D8D8D8;
    .el-form-item{
      margin-bottom: 0!important;
    }
  }
  /*验证方式*/
  .verify-green{
    color: #46D417;
    margin-right: 10px;
  }
  .verify-red{
    color: #FF0000;
    margin-right: 10px;
  }
}
</style>
