OA/pages/employees/index.vue

436 lines
8.4 KiB
Vue

<template>
<view>
<view class="content-middle">
<view class="content-middle-title">
<view class="content-middle-search">
<text class='iconfont icon-sousuo2'></text>
<input type='text' :value='keyword' placeholder='搜索关键字' placeholder-class='placeholder'
@input="setValue"></input>
</view>
<view class="search" @click="search">
搜索
</view>
</view>
<view class="content-middle-one">
<view class="middle-one" v-for="(item,j) in list" :key='j'>
<view class="middle-onea">
<view class="middle-onea-title">
<view class="middle-onea-img">
<image :src="`${httpRequestUrl}`+item.thumb" mode=""></image>
</view>
<view class="middle-onea-txt">{{item.name}}</view>
</view>
<view class="middle-onea-time">
{{item.entry_time}}
</view>
</view>
<view class="middle-oneb">
<view class="middle-oneb-a">
<view class="threeb-a-b">
<view class="achor">性别:<text>{{item.sex==1?'男':'女'}}</text></view>
<view class="achor">联系方式:<text>{{item.mobile}}</text></view>
<view class="achor">邮箱:<text>{{item.email}}</text></view>
<view class="achor">职位:<text>{{item.position}}</text></view>
<view class="achor">所在部门:<text>{{item.department}}</text></view>
<view class="achor">员工类型:<text>{{item.status==1?'正式':item.status==2?'试用':'实习'}}</text>
</view>
<view class="achor">账号状态:<text>{{item.type==0?'禁止登录':item.type==2?'正常':'离线'}}</text>
</view>
<view class="achor">职位:{{item.position}}</view>
<view class="achor">员工简介:</view>
<view class="textare-three">
<textarea :value="item.desc" placeholder="" />
</view>
<view class="middle-edit" @click="editpart(item)">
编辑
</view>
<!-- <view class="middle-delete" @click="clickItem(item)">
删除
</view> -->
</view>
</view>
</view>
</view>
</view>
</view>
<view class="content-bootom" @click="adddepart">
<view class="content-bootom-one">
<image src="@/static/images/ja.png" mode=""></image>
</view>
<view class="content-bootom-two">添加企业员工</view>
</view>
<u-empty v-if="loadConfig.status=='nomore'&& list.length==0" text="没有信息"
icon="/static/empty/data.png"></u-empty>
<u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
:loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" />
</view>
</template>
<script>
import {
comanyerlist,
leavedelete
} from '@/api/oa.js'
import {
HTTP_REQUEST_URL
} from '@/config/app.js'
import {
Toast
} from '@/libs/uniApi.js'
export default {
data() {
return {
show: false,
btnList: [{
id: '2',
name: '删除',
width: '100rpx',
bgColor: '#ed656d',
color: '#FFFFFF',
fontSize: '28rpx'
}],
loadConfig: {
page: 1,
limit: 5,
loadingText: '努力加载中',
loadmoreText: '轻轻上拉',
nomoreText: '我也是有底线的~~',
status: 'loadmore'
},
keyword: '',
list: [],
};
},
computed: {
httpRequestUrl() {
return HTTP_REQUEST_URL;
}
},
onLoad() {
},
onShow() {
this.getDocumentList()
},
onReachBottom() {
this.getDocumentList()
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
methods: {
//获取人事调动
async getDocumentList() {
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await comanyerlist({
page: this.loadConfig.page,
limit: this.loadConfig.limit,
keyword: this.keyword
})
console.log(res.data.data)
this.loadConfig.status = "loadmore"
if (res.data.data.length < this.loadConfig.limit) {
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
this.list = [...this.list, ...res.data?.data]
},
//添加人事调动
adddepart() {
uni.navigateTo({
url: '/pages/addemployees/index?type=' + 0
})
},
//删除弹窗
clickItem(data) {
// console.log(e)
uni.showModal({
content: '确定要删除吗',
success: (e) => {
if (e.confirm) {
this.deleteDepartment(data.id)
}
}
})
},
//删除
async deleteDepartment(id) {
const res = await leavedelete({
id: id
})
if (res.code == 0) {
this.getDocumentList()
}
Toast(res.msg);
},
//编辑人事调动
editpart(item) {
uni.navigateTo({
url: '/pages/addemployees/index?type=' + 1 + "&data=" + item.id
})
},
//查询
search() {
this.getDocumentList()
},
//输入监听
setValue(e) {
this.keyword = e.detail.value
if (this.keyword.length == 0) {
this.getDocumentList()
}
}
}
};
</script>
<style lang="scss" scoped>
page {
position: relative;
}
.content-middle {
.content-middle-title {
width: 100%;
background-color: #FFFFFF;
padding-top: 20rpx;
display: flex;
.search {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
width: 149rpx;
line-height: 63rpx;
height: 63rpx;
background: #FFFFFF;
text-align: center;
border-radius: 35rpx 35rpx;
border: 2rpx solid #E6E5E5;
margin-left: 18rpx;
}
.content-middle-search {
display: flex;
width: 527rpx;
height: 63rpx;
line-height: 63rpx;
padding-left: 30rpx;
background: #F7F7F7;
border-radius: 35rpx 35rpx;
font-size: 25rpx;
input {
width: 527rpx;
height: 63rpx;
line-height: 63rpx;
padding-left: 30rpx;
}
.placeholder {
font-size: 25rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
padding-left: 30rpx;
}
}
}
.content-middle-title {
height: 98rpx;
line-height: 98rpx;
background: #FFFFFF;
font-size: 35rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
padding-left: 28rpx;
}
.content-middle-one {
.middle-one {
background-color: #FFFFFF;
padding: 28rpx 28rpx;
margin: 28rpx 28rpx;
.middle-onea {
display: flex;
justify-content: space-between;
border-bottom: 1rpx solid #CCCCCC;
padding-bottom: 20rpx;
.middle-onea-title {
display: flex;
}
.middle-onea-img {
width: 50rpx;
height: 50rpx;
margin-right: 20rpx;
image {
width: 100%;
height: 100%;
}
}
}
.middle-oneb {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
.middle-oneb-a {
.threeb-a-b {
.achor {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
margin-top: 20rpx;
margin-bottom: 20rpx;
}
.middle-edit {
width: 645rpx;
height: 63rpx;
line-height: 63rpx;
background: #e6e5d9;
text-align: center;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #000;
margin-bottom: 20rpx;
}
.middle-delete {
width: 645rpx;
height: 63rpx;
line-height: 63rpx;
background: #F02828;
text-align: center;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
}
}
}
.middle-oneb-b {
width: 80rpx;
height: 80rpx;
margin-top: 45rpx;
image {
width: 100%;
height: 100%;
}
}
}
}
}
}
.content-bootom {
width: 485rpx;
height: 88rpx;
text-align: center;
line-height: 88rpx;
background: #3274F9;
border-radius: 60px 60px 60px 60px;
display: flex;
left: 50%;
margin-left: -252.5rpx;
position: absolute;
bottom: 150rpx;
z-index: 9999 !important;
position: fixed;
.content-bootom-one {
margin-left: 92rpx;
margin-top: 5rpx;
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
image {
width: 100%;
height: 100%;
}
}
.content-bootom-two {
font-size: 35rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
}
</style>