|
|
<template>
|
|
|
<view>
|
|
|
<!-- 弹框 -->
|
|
|
<uni-popup ref="share" type="share">
|
|
|
<view class="allcon">
|
|
|
<view class="hcon">
|
|
|
<view class="htitle">
|
|
|
<u-search class="searchinput" v-model="searchKey" @change="searchchange" @custom="searchcustom" placeholder="请输入人员名称查询"
|
|
|
shape="square" bg-color="#EFF4F9" :clearabled="true" :show-action="showAction" input-align="left" @clear="clear"></u-search>
|
|
|
</view>
|
|
|
<view class="rclose" @tap="_cancel">取消</view>
|
|
|
</view>
|
|
|
<view class="selcon">
|
|
|
<radio-group class="checklist-group" @change="chagne">
|
|
|
<view class="sitem" v-for="(item,index) in clistnow" :key="index">
|
|
|
<view class="conright">
|
|
|
<view class="sname">
|
|
|
{{item.yhms}}
|
|
|
</view>
|
|
|
<view class="adress">
|
|
|
{{item.lxdh}}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="selbtn">
|
|
|
<radio :value="item.yhdm" :checked="item.isChecked" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</radio-group>
|
|
|
<view class="lineb"></view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
props: {
|
|
|
value: {
|
|
|
type: String,
|
|
|
default: "",
|
|
|
},
|
|
|
clist:{
|
|
|
type:Array,
|
|
|
default:[],
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
clistnow:[],
|
|
|
clistall:[],
|
|
|
searchKey:"",
|
|
|
showAction:false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
clist(list) {
|
|
|
console.log('监视值的改变1');
|
|
|
this._initTree(list);
|
|
|
},
|
|
|
deep: true, // 深度监听
|
|
|
immediate: true, // 初次监听即执行
|
|
|
},
|
|
|
methods: {
|
|
|
searchchange(value) {
|
|
|
// 搜索框内容变化时,会触发此事件,value值为输入框的内容
|
|
|
if(value){
|
|
|
this.showAction=true;
|
|
|
this.$forceUpdate();
|
|
|
}
|
|
|
},
|
|
|
searchcustom(value) {
|
|
|
if (this.searchKey) {
|
|
|
this.clistall.forEach((v, i) => {
|
|
|
this.clistall[i].isChecked = false;
|
|
|
});
|
|
|
this.clistnow = this.clistall.filter((p) => {
|
|
|
//filter过滤的意思,这个是过滤函数,将每一项符合结果的值返回到personList
|
|
|
return ( p.yhms.indexOf(this.searchKey) !== -1 );
|
|
|
});
|
|
|
this.$forceUpdate();
|
|
|
}
|
|
|
},
|
|
|
clear() {
|
|
|
this.showAction=false;
|
|
|
this.clistnow=[];
|
|
|
this.clistall.forEach((v, i) => {
|
|
|
this.clistall[i].isChecked = false;
|
|
|
this.clistnow.push(this.clistall[i]);
|
|
|
});
|
|
|
},
|
|
|
_initTree(list){
|
|
|
this.clistall=list;
|
|
|
this.clistnow=[];
|
|
|
this.clistall.forEach((v, i) => {
|
|
|
if(this.value == v.yhdm){
|
|
|
this.clistall[i].isChecked = true;
|
|
|
}
|
|
|
else{
|
|
|
this.clistall[i].isChecked = false;
|
|
|
}
|
|
|
this.clistnow.push(this.clistall[i]);
|
|
|
});
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
chagne(e){
|
|
|
var rt= null;
|
|
|
if(e.detail.value){
|
|
|
this.clist.forEach(cell=>{
|
|
|
if(cell.yhdm==e.detail.value){
|
|
|
rt=cell;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
this.$emit("change", rt);
|
|
|
this._hide();
|
|
|
},
|
|
|
_show(id) {
|
|
|
this._initTree(this.clist);
|
|
|
this.$refs.share.open();
|
|
|
this.value=id;
|
|
|
this.clistnow.forEach(cell=>{
|
|
|
if(this.value == cell.yhdm){
|
|
|
cell.isChecked=true;
|
|
|
}
|
|
|
else{
|
|
|
cell.isChecked=false;
|
|
|
}
|
|
|
});
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
_hide() {
|
|
|
this.$refs.share.close();
|
|
|
},
|
|
|
_cancel() {
|
|
|
this._hide();
|
|
|
this.$emit("cancel", "");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
::v-deep.uni-radio-input-checked::before{
|
|
|
display: none!important;
|
|
|
}
|
|
|
.allcon{
|
|
|
height: calc((0.8*100vh));
|
|
|
min-height: 300rpx;
|
|
|
overflow: hidden;
|
|
|
background-color: #FFFFFF;
|
|
|
}
|
|
|
.hcon{
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
|
padding: 20rpx;
|
|
|
.htitle{
|
|
|
flex:1;
|
|
|
justify-content: flex-start;
|
|
|
font-size: 32rpx;
|
|
|
font-weight: 600;
|
|
|
letter-spacing: 5rpx;
|
|
|
padding-right: 20rpx;
|
|
|
}
|
|
|
.rclose{
|
|
|
width: 70rpx;
|
|
|
display: flex;
|
|
|
justify-content: flex-start;
|
|
|
align-items: center;
|
|
|
font-size: 28rpx;
|
|
|
color:#949494;
|
|
|
}
|
|
|
}
|
|
|
.checklist-group{
|
|
|
width: 100%;
|
|
|
}
|
|
|
.selcon{
|
|
|
padding: 20rpx;
|
|
|
position: relative;
|
|
|
display: block;
|
|
|
overflow-y: auto;
|
|
|
height: calc((100vh*0.9 - 230rpx));
|
|
|
.lineb{
|
|
|
height: 50rpx;
|
|
|
}
|
|
|
.sitem {
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
|
flex: 1;
|
|
|
background-color: #FFFFFF;
|
|
|
border-bottom: 1rpx solid #eeeeee;
|
|
|
padding: 10rpx 0;
|
|
|
.conright{
|
|
|
flex: 1;
|
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
|
width: 100%;
|
|
|
justify-content:flex-start;
|
|
|
}
|
|
|
.selbtn{
|
|
|
width: 80rpx;
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
}
|
|
|
.sname{
|
|
|
display: flex;
|
|
|
justify-content: flex-start;
|
|
|
align-items: center;
|
|
|
font-size: 28rpx;
|
|
|
font-weight: 600;
|
|
|
color: rgb(29, 29, 29);
|
|
|
padding: 10rpx 10rpx 10rpx 0;
|
|
|
}
|
|
|
.adress{
|
|
|
display: flex;
|
|
|
justify-content: flex-start;
|
|
|
align-items: center;
|
|
|
padding: 10rpx 10rpx 10rpx 10rpx;
|
|
|
font-size: 26rpx;
|
|
|
color:#949494;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
|