<template lang="html">
<div :class='$style.memberIndex'>
<Search class='animated flipInY' placeholder='请输入姓名或身份证号' @getValue='getVal' />
<XCircle @getId='getTabId' />
<MemberList :items='MemberList' />
<vue-top right='10px'>
<i class="font_family icon-jiantoushang" style='padding: 15px;background: #ccc;border-radius: 50%;' aria-hidden="true"></i>
</vue-top>
<infinite-loading :identifier="infiniteId" @infinite="infiniteHandler" spinner="spiral">
<div style='margin-top: 20px;' slot="no-more">客观,没有更多数据了哦</div>
<div style='margin-top: 20px;' slot="no-results">客观,暂无数据!</div>
</infinite-loading>
</div>
</template>
<script>
import InfiniteLoading from 'vue-infinite-loading';
import Search from '../public/search'
import XCircle from './Xcircle'
import MemberList from './memberList'
export default {
name: 'memberIndex',
components: {
Search,
XCircle,
MemberList,
InfiniteLoading,
},
data() {
return {
// newsType: 'story',
infiniteId: +new Date(),//重置上拉加载组件
percent: 60,
MemberList: [], //成员数据数组
PageIndex: 1, //当前页数
PageSize: 10, //当前页数要获取的数量
keyWord: '', //搜索关键词
StaffStatusCode: 0, //tab状态,所有人员--0,持证人员--1,高工人员--2,注册人员--3
}
},
methods: {
//初始化data
initData(param, method) {
if(!param) {
this.PageIndex = 1;
var method = 'EntManage/EntStaffList';
var param = {
StaffStatusCode: this.StaffStatusCode,
PageIndex: this.PageIndex,
PageSize: this.PageSize,
}
}
this.$axios.post(method, param).then((res) => {
if(!this.xq.isNull(res.data) || !this.xq.isNull(res.data.EntityList)) {
let data = '';
if(this.xq.isNull(res.data.EntityList)) {
data = res.data;
} else {
data = res.data.EntityList;
}
data.forEach((val) => {
val.Photo = this.handlePhoto(val);
});
this.MemberList = data;
} else {
this.Component.toast('暂无数据', 'warn');
}
})
},
//获取职位搜索关键词
getVal(value) {
if(!this.xq.isNull(value)) {
this.keyWord = value;
this.PageIndex = 1;
var param = {
KeyId: this.keyWord,
PageIndex: this.PageIndex,
PageSize: this.PageSize,
}
this.initData(param, 'EntManage/EntStaffSearch');
} else {
this.Component.toast('请输入关键词', 'warn');
}
},
//处理图片地址
handlePhoto(val) {
if(!this.xq.isNull(val.Photo)) {
return this.xq.imgUrl + val.Photo;
} else {
return;
}
},
//获取tabid
getTabId(id) {
this.StaffStatusCode = id;
this.keyWord = '';
this.PageIndex = 1;
this.MemberList = [];
this.infiniteId += 1;
},
//上拉加载数据
infiniteHandler($state) {
console.log('上啦加载'+this.PageIndex)
var method = '';
var param = {
StaffStatusCode: this.StaffStatusCode,
PageIndex: this.PageIndex,
PageSize: this.PageSize,
// tags: this.newsType,
}
method = 'EntManage/EntStaffList';
// }
this.$axios.post(method, param).then((res) => {
if(!this.xq.isNull(res.data.EntityList) || !this.xq.isNull(res.data)) {
this.PageIndex += 1;
let data = '';
if(this.xq.isNull(res.data.EntityList)) {
data = res.data;
} else {
data = res.data.EntityList;
}
data.forEach((val) => {
val.Photo = this.handlePhoto(val);
});
this.MemberList.push(...data);
$state.loaded();
} else {
$state.complete();
}
});
},
},
mounted() {
}
}
</script>
<style lang="scss" module>
@import '../../css/layout.scss';
.memberIndex {
height: 100%;
background: #fff;
}
</style>
网友评论