luoyb
2021-03-10 f2d3481e35de95fd119e23e46e5f277e6f00d3ea
src/views/user/selectuser.vue
@@ -1,29 +1,45 @@
<template>
  <div id="mainDiv">
    <el-header :height="headerHeight">
      <el-row>
        <el-col :span="8">
          <el-input v-model="queryParams.empNumb" placeholder="请输入内容" style="width:200px" />
          <el-button type="primary" @click="search">查询</el-button>
        </el-col>
      </el-row>
      <el-form>
        <el-row>
          <el-col :span="10">
            <el-form-item label="关键字">
              <el-input v-model="queryParams.baseKey" placeholder="请输入内容" style="width:200px" />
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="员工状态">
              <el-checkbox-group v-model="queryParams.empStatus">
                <el-checkbox :label="0">在职</el-checkbox>
                <el-checkbox :label="1">离职</el-checkbox>
                <el-checkbox :label="2">退休</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-button size="mini" class="hr-but-all" type="primary" @click="vagueSearch">查询</el-button>
            <el-button size="mini" class="hr-but" type="danger" @click="resetSearch">重置</el-button>
          </el-col>
        </el-row>
      </el-form>
    </el-header>
    <el-main>
      <el-table
        ref="multipleTable"
        :data="list"
        row-key="prop1"
        width="50%"
        width="80%"
        @selection-change="handleSelectionChange"
        @row-dblclick="rowDblclick"
      >
        <el-table-column type="selection" :reserve-selection="false" width="55" />
        <el-table-column type="selection" :reserve-selection="false" width="50" />
        <el-table-column v-if="show" prop="empId" label="员工Id" />
        <el-table-column prop="empNumb" label="员工编号" />
        <el-table-column prop="empNumb" label="编号" />
        <el-table-column prop="empName" label="姓名" />
        <el-table-column prop="certificateNumb" label="身份证号码" width="180" />
        <el-table-column v-if="show" prop="deptId" label="部门Id" />
        <el-table-column prop="deptName" label="护卫点" />
        <el-table-column prop="deptName" label="护卫点" width="180" />
        <el-table-column v-if="show" prop="jobId" label="岗位Id" />
        <el-table-column prop="jobName" label="岗位" />
        <el-table-column prop="empTypeName" label="员工类别" />
@@ -68,11 +84,12 @@
      multipleSelection: [],
      total: 0, // 总数量
      queryParams: {
        empNumb: ''
        baseKey: '',
        empStatus: []
      }, // 查询参数
      sort: {}, // 排序
      pagination: { // 分页参数
        size: 20,
        size: 15,
        num: 1
      },
      list: [], // 给table显示的数据
@@ -88,18 +105,29 @@
  methods: {
    // 翻页方法
    search() {
      this.queryParams.empName = this.queryParams.empNumb
      this.queryParams.deptName = this.queryParams.empNumb
      this.queryParams.delFlag = 0
      this.fetch({
        ...this.queryParams,
        ...this.sort
      })
    },
    vagueSearch() {
      this.fetch({
        baseKey: this.queryParams.baseKey,
        empStatus: this.queryParams.empStatus
      })
    },
    resetSearch() {
      this.queryParams = {
        baseKey: '',
        empStatus: []
      }
      this.search()
    },
    fetch(params = {}) {
      var that = this
      params.pageSize = this.pagination.size
      params.pageNum = this.pagination.num
      params.delFlag = 0
      this.$get('hr/empBaseInfo/list', {
        ...params
      }).then((r) => {
@@ -127,6 +155,7 @@
    },
    rowDblclick(row, column, event) {
      this.$refs.multipleTable.toggleRowSelection(row, true)
      this.sureChoose()
    }
  }
}