346149741
2024-08-27 bfbced1434833586988c36fe2670527bb5b2274d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<template>
    <u-popup mode="button" :safeAreaInsetBottom="false" :show="show" @close="close" @open="open" z-index="8000" bgColor="#fff">
        <view class="bg-box">
            <view class="title">选择随行人员</view>
            <u-search v-model="nickName" @search="enforceList" @clear="clearContent" @confirm="enforceList" @custom="enforceList()"></u-search>
            <scroll-view scroll-y="true" style="height: 500rpx;margin-top: 20rpx; margin-bottom: 100rpx;">
                <view v-if="checkboxList1.length">
                    <u-checkbox-group     iconPlacement="right"  v-model="checkboxValue1" placement="column" @change="checkboxChange">
                        <u-checkbox :customStyle="{marginBottom: '40rpx', }" v-for="(item, index) in checkboxList1" :key="index"
                             :name="item.userId" :label="`${item.dept.deptName}--${item.nickName}`">
                        </u-checkbox>
                    </u-checkbox-group>
                </view>
                <view class="set-color" v-else>
                    <view class="set-center">
                        <u-icon name="file-text" size="30" color="gray"></u-icon>
                        <view style="width: 100%;margin-top: 20rpx;">暂无数据</view>
                    </view>
                </view>
            </scroll-view>
            <view class="set-flex set-flex-content-between down-options">
                <view class="button-per">
                    <u-button @click="close">取消</u-button>
                </view>
                <view class="button-per"  @click="enteryResult">
                    <u-button color="#1171E0">确认</u-button>
                </view>
            </view>
        </view>
    </u-popup>
</template>
 
<script>
    import { enforceList } from '@/api/policy.js'
    export default {
        // props: {
        //     list: {
        //         type: Array,
        //         default: () => []
        //     }
        // },
        data() {
            return {
                show: false,
                checkboxValue1: [],
                // 基本案列数据
                checkboxList1: [
                ],
                nickName: ""
            }
 
        },
        watch: {
            // list: {
            //     handler(n) {
            //         this.checkboxList1 = n
            //     },
            //     immediate: true
            // }
        },
        methods: {
            clearContent() {
                this.nickName = ""
                //this.enforceList()
            },
            checkboxChange(n) {
                // console.log('change', n);
            },
            close(){
                this.show = false
            },
            open(list) {
                this.show = true
                this.checkboxValue1 = []
                this.nickName = ""
                this.checkboxList1 = []
                this.enforceList()
            },
            enteryResult() {
                let list = []
                this.checkboxList1.forEach(item => {
                    if(this.checkboxValue1.includes(item.userId)) {
                        list.push({
                            peerDeptId: item.dept.deptId,
                            peerDeptName: item.dept.deptName,
                            peerId: item.userId,
                            peerPhone: item.phonenumber,
                            peerType: 2,
                            peerUser: item.nickName
                        })
                    }
                })
                this.$emit('selectValue', list)
                this.close()
            },
            enforceList() {
                // if(this.nickName==''){
                //     uni.showToast({
                //         title: '请输入关键字搜索',
                //         icon: 'none'
                //     })
                //     return
                // }
                const value = uni.getStorageSync('userInfo')
                const id = value.deptId
                enforceList({nickName:this.nickName,deptId:id}).then(val => {
                    this.checkboxList1 = val.data.data
                })
            }
        }
    }
</script>
 
<style scoped>
    .bg-box{
        position: fixed;
        bottom: 0;
        background-color: white;
        border-radius: 20rpx 20rpx 0 0;
        padding: 20rpx 32rpx 240rpx;
        z-index: 1000000;
        width: 100%;
        box-sizing: border-box;
        min-height: 400rpx;
        max-height: 800rpx;
    }
    .title{
        font-size: 36rpx;
        font-family: 500;
        margin-bottom: 40rpx;
    }
    .button-per{
        width: 48%;
    }
    .down-options{
        position: fixed;
        bottom: 40rpx;
        width: 100%;
        box-sizing: border-box;
        padding: 0 32rpx;
        left: 0;
    }
    .set-color{
        color: gray;
        text-align: center;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 300rpx;
    }
    .set-center{
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
    }
</style>