| | |
| | | <template>
|
| | | <div id="mainDiv">
|
| | | <el-container>
|
| | | <el-header :height="headerHeight">
|
| | | <el-row>
|
| | | <el-col :span="5">员工编号: |
| | | <el-input v-model="queryParams.empNumb" placeholder="请输入内容" style="width:80px" /> |
| | | <template> |
| | | <div id="mainDiv"> |
| | | <el-header :height="headerHeight"> |
| | | <el-form> |
| | | <el-row style="height: 45px;"> |
| | | <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="4">姓名: |
| | | <el-input v-model="queryParams.empName" placeholder="请输入内容" style="width:80px" /> |
| | | <el-col :span="10" style="height: 100%;"> |
| | | <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-input v-model="queryParams.deptName" placeholder="请输入内容" style="width:80px" /> |
| | | <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-col :span="4">
|
| | | <el-button type="primary" @click="search">查询</el-button> |
| | | </el-col>
|
| | | </el-row>
|
| | | </el-header>
|
| | | <el-container>
|
| | | <el-main>
|
| | | <el-table |
| | | ref="multipleTable" |
| | | :data="list" |
| | | row-key="prop1" |
| | | width="50%" |
| | | @selection-change="handleSelectionChange"
|
| | | @row-dblclick="rowDblclick" |
| | | >
|
| | | <el-table-column type="selection" :reserve-selection="false" width="55" />
|
| | | <el-table-column v-if="show" prop="empId" label="员工Id" />
|
| | | <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 v-if="show" prop="jobId" label="岗位Id" />
|
| | | <el-table-column prop="jobName" label="岗位" />
|
| | | <el-table-column prop="empTypeName" label="员工类别" />
|
| | | <el-table-column prop="sexName" label="性别" width="50" />
|
| | | </el-table>
|
| | | <!--
|
| | | page.sync 当前页
|
| | | limit.sync 每页显示数量 只能是5,10,20,30,50
|
| | | pagination 翻页的事件
|
| | | -->
|
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="pagination.num" |
| | | :limit.sync="pagination.size"
|
| | | @pagination="search" |
| | | />
|
| | | <el-button type="primary" @click="sureChoose">确定</el-button>
|
| | | <el-button type="danger" @click="cancleChoose">取消</el-button>
|
| | | </el-main>
|
| | | </el-container>
|
| | | </el-container>
|
| | | </div>
|
| | | </template>
|
| | | <script>
|
| | | // 引用翻页组件
|
| | | import Pagination from '@/components/Pagination'
|
| | | export default {
|
| | | components: {
|
| | | Pagination
|
| | | },
|
| | | props: {
|
| | | multipleselect: {
|
| | | type: Boolean,
|
| | | default: true
|
| | | }
|
| | | },
|
| | | data() {
|
| | | return {
|
| | | show: false,
|
| | | headerHeight: '70px',
|
| | | deptTree: [],
|
| | | selection: [],
|
| | | multipleSelection: [],
|
| | | total: 0, // 总数量
|
| | | queryParams: {}, // 查询参数
|
| | | sort: {}, // 排序
|
| | | pagination: { // 分页参数
|
| | | size: 5,
|
| | | num: 1
|
| | | },
|
| | | list: [], // 给table显示的数据
|
| | | defaultProps: {
|
| | | children: 'children',
|
| | | label: 'label'
|
| | | }
|
| | | }
|
| | | },
|
| | | mounted() {
|
| | | this.search()
|
| | | },
|
| | | methods: {
|
| | | // 翻页方法
|
| | | search() {
|
| | | this.fetch({
|
| | | ...this.queryParams,
|
| | | ...this.sort
|
| | | })
|
| | | },
|
| | | fetch(params = {}) {
|
| | | var that = this
|
| | | params.pageSize = this.pagination.size
|
| | | params.pageNum = this.pagination.num
|
| | | this.$get('hr/empBaseInfo/list', {
|
| | | ...params
|
| | | }).then((r) => {
|
| | | const data = r.data.data
|
| | | that.total = data.total
|
| | | that.list = data.rows
|
| | | })
|
| | | },
|
| | | </el-row> |
| | | <el-row style="text-align: right;height: 45px;line-height: 45px"> |
| | | <el-button type="primary" @click="sureChoose">确定</el-button> |
| | | <el-button type="danger" @click="cancleChoose">取消</el-button> |
| | | </el-row> |
| | | </el-form> |
| | | </el-header> |
| | | <el-main> |
| | | <el-table |
| | | ref="multipleTable" |
| | | :data="list" |
| | | row-key="prop1" |
| | | :cell-style="{padding:'7px 0','text-align':'center'}" |
| | | :header-cell-style="{'height':'5.3vh','background-color':'#e6e6e6','text-align':'center'}" |
| | | stripe |
| | | border |
| | | style="width: 100%;color: #000;" |
| | | @selection-change="handleSelectionChange" |
| | | @row-dblclick="rowDblclick" |
| | | @sort-change="changeSort" |
| | | > |
| | | <el-table-column show-overflow-tooltip type="selection" :reserve-selection="false" width="50" /> |
| | | <el-table-column v-if="show" show-overflow-tooltip prop="empId" label="员工Id" /> |
| | | <el-table-column show-overflow-tooltip prop="empNumb" label="编号" width="80" /> |
| | | <el-table-column show-overflow-tooltip prop="empName" label="姓名" width="110" /> |
| | | <el-table-column show-overflow-tooltip prop="certificateNumb" label="身份证号码" /> |
| | | <el-table-column v-if="show" show-overflow-tooltip prop="deptId" label="部门Id" width="60" /> |
| | | <el-table-column show-overflow-tooltip prop="allDeptName" label="护卫点" width="400" sortable="custom" :sort-orders="['ascending', 'descending']" /> |
| | | <el-table-column v-if="show" show-overflow-tooltip prop="jobId" label="岗位Id" width="80" /> |
| | | <el-table-column show-overflow-tooltip prop="jobName" label="岗位" width="100" /> |
| | | <el-table-column show-overflow-tooltip prop="empTypeName" label="员工类别" width="80" /> |
| | | <el-table-column show-overflow-tooltip prop="sexName" label="性别" width="60" /> |
| | | </el-table> |
| | | <!-- |
| | | page.sync 当前页 |
| | | limit.sync 每页显示数量 只能是5,10,20,30,50 |
| | | pagination 翻页的事件 |
| | | --> |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="pagination.num" |
| | | :limit.sync="pagination.size" |
| | | @pagination="search" |
| | | /> |
| | | |
| | | </el-main> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | // 引用翻页组件 |
| | | import Pagination from '@/components/Pagination' |
| | | export default { |
| | | components: { |
| | | Pagination |
| | | }, |
| | | props: { |
| | | multipleselect: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | show: false, |
| | | headerHeight: '70px', |
| | | deptTree: [], |
| | | selection: [], |
| | | multipleSelection: [], |
| | | total: 0, // 总数量 |
| | | queryParams: { |
| | | baseKey: '', |
| | | empStatus: [] |
| | | }, // 查询参数 |
| | | sort: {}, // 排序 |
| | | pagination: { // 分页参数 |
| | | size: 15, |
| | | num: 1 |
| | | }, |
| | | list: [], // 给table显示的数据 |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'label' |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.search() |
| | | }, |
| | | methods: { |
| | | // 翻页方法 |
| | | search() { |
| | | 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) => { |
| | | const data = r.data.data |
| | | that.total = data.total |
| | | that.list = data.rows |
| | | }) |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | if (!this.multipleselect) {
|
| | | if (selection.length > 1) {
|
| | | this.$refs.multipleTable.clearSelection()
|
| | | this.$refs.multipleTable.toggleRowSelection(selection.pop())
|
| | | }
|
| | | }
|
| | | this.multipleSelection = selection
|
| | | },
|
| | | sureChoose() {
|
| | | this.$emit('selectedUser', this.multipleSelection)
|
| | | this.$refs.multipleTable.clearSelection()
|
| | | },
|
| | | cancleChoose() {
|
| | | this.$emit('cancleChooseUser')
|
| | | this.$refs.multipleTable.clearSelection()
|
| | | },
|
| | | rowDblclick(row, column, event) {
|
| | | this.$refs.multipleTable.toggleRowSelection(row, true)
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
| | | <style lang="scss" scoped>
|
| | | #mainDiv {
|
| | | height: 550px;
|
| | | overflow: scroll;
|
| | | }
|
| | |
|
| | | .link_button {
|
| | | color: #169BD5;
|
| | | }
|
| | |
|
| | | .del_button {
|
| | | color: #D9001B;
|
| | | }
|
| | | if (!this.multipleselect) { |
| | | if (selection.length > 1) { |
| | | this.$refs.multipleTable.clearSelection() |
| | | this.$refs.multipleTable.toggleRowSelection(selection.pop()) |
| | | } |
| | | } |
| | | this.multipleSelection = selection |
| | | }, |
| | | sureChoose() { |
| | | this.$emit('selectedUser', this.multipleSelection) |
| | | this.$refs.multipleTable.clearSelection() |
| | | }, |
| | | cancleChoose() { |
| | | this.$emit('cancleChooseUser') |
| | | this.$refs.multipleTable.clearSelection() |
| | | }, |
| | | rowDblclick(row, column, event) { |
| | | this.$refs.multipleTable.toggleRowSelection(row, true) |
| | | this.sureChoose() |
| | | }, |
| | | changeSort(val) { |
| | | this.sort.field = val.prop |
| | | this.sort.order = val.order |
| | | this.search() |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | .link_button { |
| | | color: #169BD5; |
| | | } |
| | | |
| | | .del_button { |
| | | color: #D9001B; |
| | | } |
| | | </style> |