<template>
  <div class="page-container rectificationUserPage">
    <div class="page-form-title-box">
      <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true">
        <el-form-item label="" prop="searchValue" label-width="80px">
          <el-input
            maxLength="30"
            v-model="queryParams.searchValue"
            placeholder="实验室/房间号/姓名"
            clearable
            style="width: 200px"/>
        </el-form-item>
        <el-form-item label="" prop="deptId" label-width="50px">
          <el-select v-model="queryParams.deptId" clearable placeholder="请选择学院">
            <el-option
              v-for="item in deptSelectList"
              :key="item.deptId"
              :label="item.deptName"
              :value="item.deptId">
            </el-option>
          </el-select>
        </el-form-item>
        <p class="page-inquire-common-style-button" @click="handleQuery" style="margin-right:10px;">查询</p>
        <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
        <p class="page-add-common-style-button"
           style="width:100px;float: right;"
           @click="configButton(1)"
        >整改者配置</p>
      </el-form>
    </div>
    <div class="page-content-box">
      <el-table class="table-box" border :data="tableList" ref="multipleTable">
        <el-table-column label="序号" align="center"  type="index" width="60" />
        <el-table-column label="实验室" align="center" prop="subName" show-overflow-tooltip/>
        <el-table-column label="学院" align="center" prop="deptName" show-overflow-tooltip width="300"/>
        <el-table-column label="整改人" align="center" prop="nickNames" show-overflow-tooltip width="500"/>
        <el-table-column label="操作人" align="center" prop="createName" show-overflow-tooltip width="200"/>
        <!--<el-table-column label="操作时间" align="center" prop="createTime" show-overflow-tooltip width="300"/>-->
      </el-table>
      <pagination :page-sizes="[20, 30, 40, 50]"
                  v-show="total>0"
                  :total="total"
                  :page.sync="queryParams.page"
                  :limit.sync="queryParams.pageSize"
                  @pagination="getList"
      />
    </div>
    <configDialog v-if="configDialogType" :configDialogData="queryParams"></configDialog>
  </div>
</template>

<script>
  import { checkStaffList } from '@/api/safetyCheck/index'
  import configDialog from './configDialog.vue'
  import { getDeptDropList } from '@/api/commonality/permission'
  export default {
    name: 'rectificationUserPage',
    components: {
      configDialog
    },
    data(){
      return{
        // 组件数据
        configDialogType:false,
        configDialogData:{
          configType:2,//1.检查人员配置 2.整改人员配置
        },
        //查询数据
        deptSelectList:[],
        queryParams:{
          page:1,
          staffType:2,
          pageSize:20,
          searchValue:"",
          deptId:""
        },
        tableList:[],
        total:0,
      }
    },
    created(){

    },
    mounted(){
      this.listDepartments();
      this.getList();
    },
    methods:{
      //配置按钮
      configButton(type){
        if(type == 1){
          this.$set(this,'configDialogType',true);
        }else if(type == 2){
          this.$set(this,'configDialogType',false);
        }else if(type == 3){
          this.getList();
          this.$set(this,'configDialogType',false);
        }
      },
      //获取数据列表
      getList(){
        checkStaffList(this.queryParams).then(response => {
          this.total = response.data.total;
          this.tableList = response.data.records;
        });
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.$set(this.queryParams,'page',1);
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.$set(this,'queryParams',{
          page:1,
          staffType:2,
          pageSize:20,
          searchValue:"",
          deptId:""
        });
        this.handleQuery();
      },
      //获取学院列表
      listDepartments(){
        getDeptDropList({deptName:"",level:2,deptType:1}).then(response => {
          this.$set(this, 'deptSelectList', response.data)
        });
      },
    }
  }
</script>

<style scoped lang="scss">
  .rectificationUserPage{
  }
</style>
