OA/pages/jobtitle/index.vue

301 lines
5.5 KiB
Vue

<template>
<view>
<view class="content-middle">
<view class="content-middle-one" v-if="list.length>0">
<view class="middle-one" v-for="(items,j) in list" :key='j'>
<liu-swipe-action :index="j" @clickItem="clickItem(items)" :btnList='btnList'>
<view class="middle-oneb">
<view class="middle-oneb-a">
<view class="threeb-a-a">
<image src="@/static/images/gw.png" mode=""></image>
</view>
<view class="threeb-a-b">
<view class="name"> <text>{{items.title}}</text></view>
<view class="achor">{{items.remark}}</view>
</view>
</view>
<view class="middle-oneb-b" @click="editpart(items)">
<image src="@/static/images/bianji.png" mode=""></image>
</view>
</view>
</liu-swipe-action>
</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 {
userposition,
deleteuserposition
} from '@/api/oa.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'
},
list: [],
};
},
onShow() {
this.initList()
},
onReachBottom() {
this.getDocumentList()
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
methods: {
async initList() {
this.loadConfig.page = 1;
this.loadConfig.status = "loadmore";
this.list = [];
await this.getDocumentList();
},
//获取人事调动
async getDocumentList() {
if (this.loadConfig.status == "nomore") return;
this.loadConfig.status = "loading"
let res = await userposition({
page: this.loadConfig.page,
limit: this.loadConfig.limit,
})
//console.log(res.data)
this.loadConfig.status = "loadmore"
if (res.data.length < this.loadConfig.limit) {
this.loadConfig.status = "nomore"
} else {
this.loadConfig.page++;
}
this.list = [...this.list, ...res?.data]
},
//添加岗位
adddepart() {
uni.navigateTo({
url: '/pages/addjobtitle/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 deleteuserposition({
id: id
})
if (res.code == 0) {
this.initList()
}
Toast(res.msg);
},
//编辑岗位
editpart(item) {
uni.navigateTo({
url: '/pages/addjobtitle/index?type=' + 1 + "&data=" + encodeURIComponent(JSON.stringify(
item))
})
},
setValue() {
}
}
};
</script>
<style lang="scss" scoped>
page {
position: relative;
}
.content-middle {
.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;
color: #3274F9;
}
.content-middle-one {
margin-top: 26rpx;
background-color: #FFFFFF;
padding: 28rpx 28rpx;
.middle-one {
.middle-oneb {
display: flex;
justify-content: space-between;
margin-bottom: 25rpx;
.middle-oneb-a {
display: flex;
.threeb-a-a {
width: 98rpx;
height: 98rpx;
border-radius: 11rpx 11rpx;
margin-right: 25rpx;
image {
width: 100%;
height: 100%;
}
}
.threeb-a-b {
.name {
font-size: 35rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
text {
font-size: 25rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #CCCCCC;
}
}
.achor {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
}
}
}
.middle-oneb-b {
width: 80rpx;
height: 80rpx;
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: 152rpx;
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>