258 lines
4.6 KiB
Vue
258 lines
4.6 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view class="container">
|
|
<view class="haers">
|
|
<view style="width: 30%; text-align: left;" @click="goback()">
|
|
<u-icon name="arrow-left" color="#fff" size="18"></u-icon>
|
|
</view>
|
|
<view style="width: 30%; text-align: center; font-size: 18px; ">
|
|
员工管理
|
|
</view>
|
|
<view style="width: 30%;text-align: right;" @click="goadd()">
|
|
新增
|
|
</view>
|
|
</view>
|
|
<view class="box-list" v-for="item in dataList">
|
|
<view style="display: flex;font-size: 30rpx">
|
|
<view class="title2">工号: {{item.staffNo}}</view>
|
|
<view class="title1">姓名: {{item.staffName}}</view>
|
|
</view>
|
|
|
|
<view class="title3">联系方式:{{item.staffPhone}}</view>
|
|
<view class="bottom-box">
|
|
<view class="d-s" @click="delStaff(item.id)">
|
|
<view class="">删除</view>
|
|
</view>
|
|
<view class="d-s" @click="goDeviceList(item.id)">
|
|
<view class="">设备列表</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-loadmore :status="status" v-if="show == true" />
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import headers from '../../components/header/headers.vue'
|
|
import request from '../../utils/request.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
dataList: [],
|
|
page: 1,
|
|
limit: 10,
|
|
totalPage: 0
|
|
}
|
|
},
|
|
onShow() {
|
|
this.dataList = []
|
|
this.page = 1
|
|
this.getDataList()
|
|
},
|
|
onPullDownRefresh() {
|
|
this.page = 1,
|
|
this.limit = 10,
|
|
this.totalPage = 0,
|
|
this.dataList = [],
|
|
this.getDataList();
|
|
|
|
uni.stopPullDownRefresh()
|
|
},
|
|
onReachBottom() {
|
|
// 触底加载
|
|
if (this.page < this.totalPage) {
|
|
this.page++
|
|
this.getDataList()
|
|
|
|
} else {
|
|
uni.showToast({
|
|
title: '没有下一页数据',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
},
|
|
components: {
|
|
headers
|
|
|
|
},
|
|
methods: {
|
|
delStaff(id) {
|
|
let that = this
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '确定删除该员工',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
request({
|
|
url: 'app/uaMer/delStaff/' + id,
|
|
method: 'post',
|
|
}).then(res => {
|
|
that.page = 1,
|
|
that.limit = 10,
|
|
that.totalPage = 0,
|
|
that.dataList = [],
|
|
that.getDataList()
|
|
uni.showToast({
|
|
title: '删除成功',
|
|
icon: 'none'
|
|
})
|
|
|
|
})
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
},
|
|
getDataList() {
|
|
uni.showLoading({
|
|
title: '加载中'
|
|
});
|
|
request({
|
|
url: 'app/uaMer/staffList',
|
|
method: 'post',
|
|
data: {
|
|
limit: this.limit,
|
|
page: this.page
|
|
},
|
|
}).then(res => {
|
|
if (res.data) {
|
|
if (this.page != 1) {
|
|
this.dataList = this.dataList.concat(res.data)
|
|
} else {
|
|
this.dataList = res.data
|
|
}
|
|
this.totalPage = res.pages
|
|
|
|
}
|
|
|
|
}).finally(rrr => {
|
|
uni.hideLoading()
|
|
})
|
|
},
|
|
goadd() {
|
|
uni.navigateTo({
|
|
url: '/homePages/StaffManagement/add'
|
|
})
|
|
},
|
|
goDeviceList(staffId) {
|
|
uni.navigateTo({
|
|
url: '/homePages/StaffManagement/deviceList?staffId=' + staffId
|
|
})
|
|
},
|
|
goback() {
|
|
uni.navigateBack()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
input {
|
|
&::-webkit-input-placeholder,
|
|
/* WebKit browsers*/
|
|
&:-moz-input-placeholder,
|
|
/* Mozilla Firefox 4 to 18*/
|
|
&::-moz-input-placeholder,
|
|
/* Mozilla Firefox 19+*/
|
|
&:-ms-input-placeholder
|
|
|
|
/* Internet Explorer 10+*/
|
|
{
|
|
color: #fff !important;
|
|
}
|
|
}
|
|
|
|
.content {
|
|
background: #f4f4f4;
|
|
height: 100vh;
|
|
}
|
|
|
|
.container {
|
|
width: 100%;
|
|
background: #f4f4f4;
|
|
box-sizing: border-box;
|
|
padding-top: 98px;
|
|
}
|
|
|
|
.haers {
|
|
width: 100%;
|
|
background: #E4612E;
|
|
height: 88px;
|
|
box-sizing: border-box;
|
|
padding: 0px 15px;
|
|
padding-top: 40px;
|
|
color: white;
|
|
z-index: 99999;
|
|
background: #E4612E;
|
|
position: fixed;
|
|
top: 0px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.input-box {
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 65%;
|
|
height: 25px;
|
|
border-radius: 50px;
|
|
border: 1px solid #fff;
|
|
color: white;
|
|
|
|
input {
|
|
width: 80%;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
.box-list {
|
|
width: 95%;
|
|
border-radius: 20rpx;
|
|
background: #fff;
|
|
margin: 10px auto;
|
|
box-sizing: border-box;
|
|
padding: 15rpx 25rpx;
|
|
}
|
|
|
|
.d-s {
|
|
width: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.bottom-box {
|
|
height: 50px;
|
|
border-top: 1px solid #f4f4f4;
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.title1 {
|
|
width: 100%;
|
|
//text-align: center;
|
|
margin-bottom: 5px;
|
|
|
|
}
|
|
|
|
.title2 {
|
|
width: 100%;
|
|
//text-align: center;
|
|
}
|
|
|
|
.title3 {
|
|
width: 100%;
|
|
margin-top: 25px;
|
|
margin-bottom: 15px;
|
|
}
|
|
</style>
|