<template>
|
<view class="container">
|
|
<u-search v-model='keyValue' placeholder='请输入保安员姓名' shape="round" class="u-search" input-align="center"
|
height="70" @search='searchValue' @custom='searchValue' @clear='clearValue' @change='changeValue'>
|
</u-search>
|
|
<view v-if="newsList.length > 0">
|
<view class="inTmain" v-for="(item,index) in newsList">
|
<u-card :title="item.realName" @click="goDetail(item)">
|
<view class="" slot="body">
|
<view>
|
<view style="margin-bottom: 10px;" class="u-body-item-title u-line-1">公司:{{item.deptName}}
|
</view>
|
</view>
|
<view>
|
<view class="u-body-item-title u-line-1">籍贯:{{item.nativeplace}}</view>
|
</view>
|
</view>
|
<view class="" slot="foot">
|
</u-icon>电话:{{item.phone}}</view>
|
</u-card>
|
</view>
|
<u-loadmore class='msg' :status="status" />
|
</view>
|
|
<view class="msg" v-else>
|
暂无数据
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
dataList: [],
|
newsList: [],
|
status: 'loadmore',
|
keyValue: '',
|
pagelist: 0,
|
pages: 0,
|
flag: true,
|
|
pullDown: false
|
};
|
},
|
onLoad() {
|
|
},
|
onReachBottom() {
|
var that = this;
|
|
if (that.flag == false) {
|
that.status = 'nomore';
|
return
|
}
|
// 后续将改为与后端联动
|
that.status = 'loading';
|
|
setTimeout(() => {
|
that.getCompany();
|
}, 1000);
|
|
|
},
|
|
onPullDownRefresh: function() {
|
this.pullDown = true;
|
this.pagelist = 0;
|
this.pages = 0;
|
this.flag = true;
|
this.dataList = [];
|
this.newsList = [];
|
this.status = 'loading';
|
this.keyValue = '';
|
setTimeout(() => {
|
this.getCompany();
|
}, 1000)
|
|
},
|
|
mounted() {
|
this.getCompany();
|
},
|
methods: {
|
getCompany() {
|
var that = this;
|
|
if (that.pagelist < that.pages || that.pagelist == 0) {
|
that.pagelist++
|
} else if (that.pagelist == that.pages) {
|
that.flag = false
|
that.status = 'nomore';
|
return
|
}
|
|
|
|
if (this.$store.state.UserData.rname[0] == '保安公司管理员') {
|
|
uni.request({
|
url: that.$store.state.piAPI + "/blade-user/pages",
|
method: "get",
|
data: {
|
current: that.pagelist,
|
size: 10,
|
deptId: this.$store.state.UserData.dept_id,
|
roleAlias: 111
|
},
|
success: (res) => {
|
that.pages = res.data.data.pages;
|
|
var resdata = res.data.data.records;
|
|
if (this.pullDown == true) {
|
this.pullDown = false;
|
uni.stopPullDownRefresh();
|
}
|
|
if (resdata.length == 0) {
|
that.flag = false
|
that.status = 'nomore';
|
return
|
} else {
|
resdata.forEach(item => {
|
that.newsList.push(item)
|
that.dataList.push(item)
|
})
|
}
|
|
if (that.pagelist == that.pages) {
|
that.flag = false
|
that.status = 'nomore';
|
return
|
}
|
|
}
|
});
|
|
} else {
|
|
uni.request({
|
url: that.$store.state.piAPI + "/blade-user/pages",
|
method: "get",
|
data: {
|
dispatch: 0,
|
status: 1,
|
roleAlias: 111,
|
jurisdiction: this.$store.state
|
.UserData.jurisdiction,
|
current: that.pagelist,
|
size: 10
|
},
|
success: (res) => {
|
that.pages = res.data.data.pages;
|
|
var resdata = res.data.data.records;
|
|
if (this.pullDown == true) {
|
this.pullDown = false;
|
uni.stopPullDownRefresh();
|
}
|
|
if (resdata.length == 0) {
|
that.flag = false
|
that.status = 'nomore';
|
return
|
} else {
|
resdata.forEach(item => {
|
that.newsList.push(item)
|
that.dataList.push(item)
|
})
|
}
|
|
if (that.pagelist == that.pages) {
|
that.flag = false
|
that.status = 'nomore';
|
return
|
}
|
|
}
|
});
|
|
}
|
},
|
goDetail(item) {
|
uni.navigateTo({
|
url: './information?detailData=' + JSON.stringify(item)
|
});
|
},
|
searchValue(value) {
|
var that = this;
|
var str = value.replace(/\s*/g, "");
|
if (str == '') {
|
return
|
} else {
|
that.newsList = [];
|
|
if (this.$store.state.UserData.rname[0] == '保安公司管理员') {
|
|
uni.request({
|
url: that.$store.state.piAPI + "/blade-user/pages",
|
method: "get",
|
data: {
|
current: 1,
|
size: 999999,
|
realName: str,
|
deptId: this.$store.state.UserData.dept_id,
|
roleAlias: 111
|
},
|
success: (res) => {
|
|
var resdata = res.data.data.records;
|
|
resdata.forEach(item => {
|
that.newsList.push(item)
|
})
|
|
}
|
});
|
|
} else {
|
|
uni.request({
|
url: that.$store.state.piAPI + "/blade-user/pages",
|
method: "get",
|
data: {
|
current: 1,
|
size: 999999,
|
realName: str,
|
dispatch: 0,
|
jurisdiction: this.$store.state
|
.UserData.jurisdiction,
|
},
|
success: (res) => {
|
|
var resdata = res.data.data.records;
|
|
resdata.forEach(item => {
|
that.newsList.push(item)
|
})
|
|
}
|
});
|
|
}
|
|
that.flag = false
|
that.status = 'nomore';
|
}
|
},
|
clearValue() {
|
this.keyValue = ''
|
this.newsList = [];
|
|
this.dataList.forEach(item => {
|
this.newsList.push(item)
|
})
|
|
if (this.pagelist < this.pages) {
|
this.flag = true;
|
this.status = 'loading';
|
} else {
|
this.flag = false;
|
this.status = 'nomore';
|
}
|
},
|
changeValue(value) {
|
if (value == '') {
|
this.newsList = [];
|
|
this.dataList.forEach(item => {
|
this.newsList.push(item)
|
})
|
|
if (this.pagelist < this.pages) {
|
this.flag = true;
|
this.status = 'loading';
|
} else {
|
this.flag = false;
|
this.status = 'nomore';
|
}
|
}
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss">
|
.u-card-wrap {
|
background-color: $u-bg-color;
|
padding: 1px;
|
}
|
|
.u-body-item {
|
font-size: 32rpx;
|
color: #333;
|
padding: 20rpx 10rpx;
|
}
|
|
.u-body-item image {
|
width: 120rpx;
|
flex: 0 0 120rpx;
|
height: 120rpx;
|
border-radius: 8rpx;
|
margin-left: 12rpx;
|
}
|
|
.u-search {
|
padding: 20rpx 30rpx 0 30rpx;
|
}
|
|
.inTmain {}
|
|
.msg {
|
height: 72rpx;
|
line-height: 72rpx;
|
text-align: center;
|
color: #999;
|
}
|
</style>
|