228 lines
4.4 KiB
Vue
228 lines
4.4 KiB
Vue
<template>
|
|
<view class="select_member">
|
|
<view class="member">
|
|
<u-search v-model="name" @change="queryList" :show-action="false" placeholder="请输入搜索关键词" />
|
|
<view class="list">
|
|
<view class="li" v-for="(item,index) in list" :key="index">
|
|
<label class="radio">
|
|
<view class="li_name" @click="selectItem(index)">
|
|
<radio color="#008EFF" :value="String(item.id)" :checked="item.isSelect" v-if="item.isSelect"/>
|
|
<image :src="item.img" class="staffimg" mode=""></image>
|
|
<view class="name">{{item.name?item.name:''}}</view>
|
|
<view class="post">{{item.post?item.post:''}}</view>
|
|
</view>
|
|
</label>
|
|
</view>
|
|
<view style="height: 150rpx;"></view>
|
|
<u-empty v-if="list.length == 0" text="暂无更多"></u-empty>
|
|
</view>
|
|
<view class="bottomli">
|
|
<view class="botselect" v-if="type != 1">
|
|
<view class="se_text" v-if="!allSelect" @click="selectAll">全选</view>
|
|
<view class="se_text" v-else @click="removeSelect">取消全选</view>
|
|
</view>
|
|
<view class="remove btn" @click="quxiao">取消</view>
|
|
<view class="sure btn" @click="queding">确定</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
netStaffList
|
|
} from '@/api/kehu.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
list: [],
|
|
name: '',
|
|
selectInfo: [],
|
|
type: null, //选择上级
|
|
allSelect:false,
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
if (options.type) {
|
|
this.type = options.type
|
|
}
|
|
},
|
|
onShow() {
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
getList() {
|
|
let params = {
|
|
name: this.name
|
|
}
|
|
netStaffList(params).then(res => {
|
|
res = res.data
|
|
res.forEach(ele => {
|
|
ele.isDel = true
|
|
ele.isSelect = false
|
|
})
|
|
this.list = res
|
|
})
|
|
},
|
|
selectItem(index) {
|
|
if (this.type == 1) {
|
|
let arr = this.list
|
|
arr.forEach(ele => {
|
|
ele.isSelect = false
|
|
})
|
|
this.list = arr
|
|
}
|
|
let obj = this.list[index]
|
|
obj.isSelect = !obj.isSelect
|
|
this.$set(this.list,index,obj)
|
|
},
|
|
queding() {
|
|
if (this.type == 1) {
|
|
let arr = this.list
|
|
let selectInfo = null
|
|
arr.forEach(ele => {
|
|
if (ele.isSelect) {
|
|
selectInfo = ele
|
|
}
|
|
})
|
|
uni.setStorageSync('parentinfo', selectInfo)
|
|
} else {
|
|
let arr = []
|
|
let x = uni.getStorageSync('remindlist')
|
|
if (x.length != 0) {
|
|
arr = arr.concat(x)
|
|
}
|
|
this.list.forEach(ele => {
|
|
if (ele.isSelect) {
|
|
arr.push(ele)
|
|
}
|
|
})
|
|
uni.setStorageSync('remindlist', arr)
|
|
}
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
},
|
|
|
|
quxiao() {
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
},
|
|
|
|
//搜索
|
|
queryList(e) {
|
|
this.name = e
|
|
this.getList()
|
|
},
|
|
//全选
|
|
selectAll() {
|
|
this.allSelect = true
|
|
let arr = this.list
|
|
arr.forEach(ele => {
|
|
ele.isSelect = true
|
|
})
|
|
this.list = arr
|
|
},
|
|
//取消全选
|
|
removeSelect() {
|
|
this.allSelect = false
|
|
let arr = this.list
|
|
arr.forEach(ele => {
|
|
ele.isSelect = false
|
|
})
|
|
this.list = arr
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.list {
|
|
padding: 20rpx 24rpx 150rpx;
|
|
background: #fff;
|
|
|
|
.li {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
padding: 20rpx 0;
|
|
border-bottom: 1rpx solid #EAEAEA;
|
|
|
|
.li_name {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
line-height: 55rpx;
|
|
}
|
|
.radio {
|
|
width: 100%;
|
|
}
|
|
.staffimg{
|
|
width:40rpx;
|
|
height:40rpx;
|
|
border-radius: 50%;
|
|
margin-left: 24rpx;
|
|
}
|
|
.name {
|
|
font-size: 24rpx;
|
|
color: #333333;
|
|
margin-left: 24rpx;
|
|
}
|
|
.post {
|
|
font-size: 24rpx;
|
|
color: #666666;
|
|
margin-left: 24rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.bottomli {
|
|
position: fixed;
|
|
left: 0;
|
|
bottom: 0;
|
|
width: 750rpx;
|
|
height: 120rpx;
|
|
display: flex;
|
|
justify-content: space-around;
|
|
align-items: center;
|
|
background: #fff;
|
|
border-top: 1rpx solid #EAEAEA;
|
|
.botselect{
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
.se_text{
|
|
font-size:26rpx;
|
|
color:$uni-text-color;
|
|
}
|
|
}
|
|
.btn {
|
|
width: 240rpx;
|
|
height: 80rpx;
|
|
font-size: 24rpx;
|
|
color: #666666;
|
|
text-align: center;
|
|
line-height: 80rpx;
|
|
border-radius: 40rpx;
|
|
}
|
|
|
|
.sure {
|
|
background: $uni-text-color;
|
|
color: #fff;
|
|
}
|
|
|
|
.remove {
|
|
border: 1rpx solid $uni-text-color;
|
|
color: $uni-text-color;
|
|
line-height: 78rpx;
|
|
}
|
|
}
|
|
|
|
.radio {
|
|
radio {
|
|
transform: scale(0.6);
|
|
}
|
|
}
|
|
</style>
|