177 lines
4.0 KiB
Vue
177 lines
4.0 KiB
Vue
<template>
|
|
<view class="slot-content">
|
|
<uv-popup mode="bottom" border-radius="38" ref="showRef" >
|
|
<view class="popup-title">
|
|
<view class="" style="width: 45px;">
|
|
</view>
|
|
<text class="">选择目标员工</text>
|
|
<view class="" @click="selectShowClose3" style="width: 45px;">
|
|
<uv-icon name="close" color="#909399" size="30"></uv-icon>
|
|
</view>
|
|
</view>
|
|
<uv-search margin="30rpx 20rpx" shape="square" v-model="adminkeyword" :show-action="false" :clearabled="true" placeholder="输入名称搜索" @change="adminSearch"></uv-search>
|
|
<scroll-view scroll-y style="height: 760rpx;width: 100%;" @scrolltolower="adminBottom">
|
|
<view class="list">
|
|
<block v-if="userList.length > 0">
|
|
<view class="mb-4">
|
|
<view class="item flex" v-for="(item,index) in userList" :key="index" @click="oncompany(item)">
|
|
<view class="title">{{item.nickname}}</view>
|
|
<view class="check-icon">
|
|
<uv-icon v-if="adminId == item.id" name="checkmark" color="#09b4f1" size="28"></uv-icon>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<uv-loadmore :status="adminStatus" ></uv-loadmore>
|
|
</block>
|
|
<uv-empty text="暂无数据" v-else margin-top="50" mode="list"></uv-empty>
|
|
</view>
|
|
</scroll-view>
|
|
<view class="bottom_btn flex justify-end">
|
|
<view>
|
|
<uv-button customStyle="padding:0 80rpx;" @click="selectShowClose3">取消</uv-button>
|
|
</view>
|
|
<view style="margin-left: 20rpx;">
|
|
<uv-button color="#09b4f1" customStyle="padding:0 80rpx;" @click="onCliskDivert" >转移</uv-button>
|
|
</view>
|
|
</view>
|
|
</uv-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
ref,
|
|
unref,
|
|
computed,
|
|
defineEmits
|
|
} from 'vue'
|
|
import { onLoad,onShow ,onReady} from '@dcloudio/uni-app'
|
|
import {
|
|
getSimpleUserList
|
|
} from '@/api/user'
|
|
const lastAdmin = ref(false)
|
|
const adminStatus = ref('nomore')
|
|
const adminkeyword = ref('')
|
|
const pageSize = ref(10)
|
|
const page = ref(1)
|
|
const userList = ref([])
|
|
const adminId = ref(0)
|
|
|
|
onShow(()=>{
|
|
getUserList()
|
|
})
|
|
|
|
const showRef = ref()
|
|
const doopen = () => {
|
|
showRef.value.open()
|
|
}
|
|
|
|
const selectShowClose3 = () => {
|
|
unref(showRef).close()
|
|
}
|
|
|
|
defineExpose({ doopen,selectShowClose3 })
|
|
|
|
const emit = defineEmits(['doTrans'])
|
|
|
|
const onCliskDivert = () => {
|
|
if(adminId.value == 0){
|
|
uni.showToast({
|
|
title: '请先选择目标员工',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return
|
|
}
|
|
emit('doTrans',adminId.value)
|
|
}
|
|
|
|
const oncompany = (val) => {
|
|
adminId.value = val.id
|
|
}
|
|
|
|
const adminSearch = () => {
|
|
lastAdmin.value = false
|
|
getUserList()
|
|
}
|
|
|
|
const getUserList = async(isNextPage,pages) => {
|
|
await getSimpleUserList({
|
|
pageNo: page.value,
|
|
pageSize: pageSize.value,
|
|
username:adminkeyword.value,
|
|
}).then(res => {
|
|
if(res) {
|
|
// 不够一页
|
|
if (res.list.length < 10) {
|
|
adminStatus.value = 'nomore'
|
|
}
|
|
// 最后一页
|
|
if(res.list.length == 0) {
|
|
lastAdmin.value = true
|
|
}
|
|
// 第二页开始
|
|
if(isNextPage) {
|
|
userList.value = userList.value.concat(res.list)
|
|
return
|
|
}
|
|
userList.value = res.list
|
|
}
|
|
})
|
|
}
|
|
|
|
// 滚动到底部加载更多
|
|
const adminBottom = () => {
|
|
// if(this.lastAdmin || this.adminStatus == 'loading') return ;
|
|
// this.adminStatus = 'loading'
|
|
// setTimeout(() => {
|
|
// if(this.lastAdmin) return ;
|
|
// this.onSelectpage(true,++this.adminPage)
|
|
// if(this.companyList.length >= 10) this.adminStatus = 'loadmore';
|
|
// else this.adminStatus = 'loading';
|
|
// }, 1200)
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.slot-content {
|
|
.search {
|
|
padding: 30rpx 25rpx;
|
|
}
|
|
.popup-title {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
position: relative;
|
|
font-size: 35rpx;
|
|
font-weight: 600;
|
|
text-align: center;
|
|
height: 50px;
|
|
padding-right: 25rpx;
|
|
}
|
|
.list {
|
|
padding-bottom: 45rpx;
|
|
.item {
|
|
padding: 0 25rpx;
|
|
justify-content: space-between;
|
|
height: 55px;
|
|
.title {
|
|
flex: 1;
|
|
font-size: 28rpx;
|
|
font-weight: 600;
|
|
}
|
|
.check-icon {
|
|
text-align: center;
|
|
width: 100rpx;
|
|
}
|
|
}
|
|
}
|
|
.bottom_btn {
|
|
text-align: right;
|
|
padding: 28rpx 10rpx 28rpx;
|
|
}
|
|
}
|
|
</style>
|