| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <template>
- <div>
- <div class="communal-list">
- <div class="communal-title">
- <div>员工列表</div>
- <div class="communal-box">
- <el-input @input="Inquireclick()" placeholder="请输入内容" v-model="input" clearable>
- </el-input>
- <el-button @click="Inquireclick()" type="primary"><i class="iconfont icon-sousuo"></i></el-button>
- </div>
- </div>
- <template>
- <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
- style="width: 100%" :row-class-name="rowClassName">
- <!-- <el-table-column type="expand">
- <template slot-scope="props">
- <el-form label-position="left" inline class="demo-table-expand">
- <el-form-item label="分机号">
- <span>{{ props.row.ext }}</span>
- </el-form-item>
- <el-form-item label="手机号">
- <span>{{ props.row.phone }}</span>
- </el-form-item>
- <el-form-item label="紧急联络电话">
- <span>{{ props.row.urgentPhone }}</span>
- </el-form-item>
- <el-form-item label="电子邮箱">
- <span>{{ props.row.email }}</span>
- </el-form-item>
- </el-form>
- </template>
- </el-table-column> -->
- <el-table-column prop="num" label="序 号" width="55">
- <template slot-scope="scope">
- {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
- </template>
- </el-table-column>
- <el-table-column prop="number" width="100" label="员工号">
- </el-table-column>
- <el-table-column width="100" prop="cnName" label="姓 名">
- </el-table-column>
- <el-table-column prop="companyName" label="分属公司" width="220">
- </el-table-column>
- <el-table-column prop="jobName" label="职 位" width="200">
- </el-table-column>
- <el-table-column prop="ext" label="分机号" width="100">
- </el-table-column>
- <el-table-column prop="phone" label="手机号" width="120">
- </el-table-column>
- <el-table-column prop="urgentPhone" label="紧急联络电话" width="120">
- </el-table-column>
- <el-table-column prop="email" label="电子邮箱">
- </el-table-column>
- </el-table>
- </template>
- <div class="block">
- <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
- :current-page="currentPage" :page-sizes="[10, 15, 20]" :page-size="pageSize"
- layout="total, sizes, prev, pager, next" :total="tableDatas.length">
- </el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { co, el } from '@fullcalendar/core/internal-common';
- export default {
- data() {
- return {
- tableDatas: [],
- tableData: [],
- currentPage: 1, // 当前页码
- pageSize: 15,// 每页的数据条数
- input: '',
- token: '',
- clientWidth:document.documentElement.clientWidth,
- }
- },
- methods: {
- //每页条数改变时触发 选择一页显示多少行
- handleSizeChange(val) {
- this.currentPage = 1;
- this.pageSize = val;
- },
- //当前页改变时触发 跳转其他页
- handleCurrentChange(val) {
- this.currentPage = val;
- },
- Inquireclick() {
- var newarr = [];
- if (this.input == "") {
- newarr = this.tableData;
- } else {
- for (var i = 0; i < this.tableData.length; i++) {
- if (this.tableData[i].number.indexOf(this.input) != -1) {
- newarr.push(this.tableData[i]);
- }
- else if (this.tableData[i].cnName.indexOf(this.input) != -1) {
- newarr.push(this.tableData[i]);
- }
- else if (this.tableData[i].jobName.indexOf(this.input) != -1) {
- newarr.push(this.tableData[i]);
- }
- else if (this.tableData[i].companyName.indexOf(this.input) != -1) {
- newarr.push(this.tableData[i]);
- }
- else if (this.tableData[i].ext.indexOf(this.input) != -1) {
- newarr.push(this.tableData[i]);
- }
- else if (this.tableData[i].phone.indexOf(this.input) != -1) {
- newarr.push(this.tableData[i]);
- }
- else if (this.tableData[i].urgentPhone.indexOf(this.input) != -1) {
- newarr.push(this.tableData[i]);
- }
- else if (this.tableData[i].email.indexOf(this.input) != -1) {
- newarr.push(this.tableData[i]);
- }
- }
- }
- this.tableDatas = newarr;
- this.currentPage = 1;
- },
- Getemployees() {
- var url = "/api/System/GetUserList"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + this.token
- },
- data: {
- portType: 1,
- }
- }).then(function (res) {
- if (res.data.code == 200) {
- that.tableData = res.data.data
- that.tableData.forEach(item => {
- if (item.cnName == null) {
- item.cnName = ''
- }
- if (item.companyId == null) {
- item.companyId = ''
- }
- if (item.companyName == null) {
- item.companyName = ''
- }
- if (item.depId == null) {
- item.depId = ''
- }
- if (item.depName == null) {
- item.depName = ''
- }
- if (item.email == null) {
- item.email = ''
- }
- if (item.ext == null) {
- item.ext = ''
- }
- if (item.id == null) {
- item.id = ''
- }
- if (item.jobName == null) {
- item.jobName = ''
- }
- if (item.jobPostId == null) {
- item.jobPostId = ''
- }
- if (item.number == null) {
- item.number = ''
- }
- if (item.phone == null) {
- item.phone = ''
- }
- if (item.urgentPhone == null) {
- item.urgentPhone = ''
- }
- })
- that.tableDatas = that.tableData;
- }
- })
- },
- rowClassName({ row, rowIndex }) {
- if (rowIndex % 2 === 0) {
- return 'warning-row';
- } else {
- return 'success-row';
- }
- },
- },
- // watch: {
- // clientWidth(news,olds) {
- // let that = this;
- // console.log("实时屏幕宽度:",news,olds, that.clientWidth );
- // }
- // },
- mounted() {
- this.token = JSON.parse(localStorage.getItem('userinif')).token;
- this.Getemployees();
- // this.clientWidth = document.body.clientWidth;
- // this.clientWidth = document.documentElement.clientWidth;
- // console.log(this.clientWidth);
- }
- }
- </script>
- <style>
- .el-table .warning-row {
- background: #f9f9f9;
- }
- .el-table .success-row {
- background: #efefef;
- }
- .communal-list {
- background-color: #fff;
- padding: 10px;
- box-shadow: 0 0 5px #0005;
- border-radius: 10px;
- }
- .communal-title {
- display: flex;
- font-size: 17px;
- font-weight: 600;
- color: #555;
- margin-top: 8px;
- margin-bottom: 2px;
- justify-content: space-between;
- align-items: center;
- }
- .communal-box {
- display: flex;
- }
- .communal-box>button {
- margin-left: 10px;
- padding: 8px 20px;
- }
- </style>
|