346149741
2024-09-03 0e9b58dea98030029d30e86a0460323c8e56b1ec
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<template>
    <view>
        <u-popup mode="bottm" :show="show"  :safeAreaInsetBottom="false">
            <view class="picker-view-box">
                <view class="options">
                    <view class="button" @click="cancel" size="mini">取消</view>
                    <view class="button entery" @click="add" color="#1171E0" size="mini">新增企业</view>
                </view>
                <view class="set-flex">
                    <u-search v-model="companyName" @search="companyList" @clear="clearContent" @confirm="companyList" @custom="companyList()"></u-search>
                    <text @click="entery">确定</text>
                </view>
                <view>
                    <picker-view immediate-change :value="value" @change="bindChange" class="picker-view">
                        <picker-view-column>
                            <view  class="text-center" v-for="(item,index) in columns" :key="index">{{item[keyName]}}</view>
                        </picker-view-column>
                    </picker-view>
                </view>
            </view>
        </u-popup>
        <u-popup mode="bottm" :show="showadd"  :safeAreaInsetBottom="false">
            <view class="picker-view-box">
                <view class="head">
                    新增临时企业
                </view>
                <view style="margin: 20rpx 0;">
                    <u-input v-model="name" placeholder="请输入企业名称"  type="text" />
                </view>
                <view class="bz">
                    备注:如企业搜索无结果或企业无二维码,则该企业未在平台内进行注册,可点击“新增”输入该企业名称新增临时企业,新增的企业只需要提交申请-审批通过后即可填报执法结果,无需扫企业二维码。如企业已有二维码,请返回搜索页搜索并选择该企业,不要新增临时企业。
                </view>
                <view class="down-button">
                    <view>
                        <u-button shape="circle" @click="close">取消</u-button>
                    </view>
                    <view>
                        <u-button shape="circle" color="#1171E0" @click="addContent">确定</u-button>
                    </view>
                </view>
            </view>
            
        </u-popup>
    </view>
</template>
 
<script>
    import { companyList } from '@/api/policy.js'
    export default {
        props: {
            keyName: {
                type: String,
                default: ''
            }
        },
        data() {
            return {
                columns: [],
                show: false,
                companyName: "",
                index: 0,
                value: [],
                showadd:false,
                name:''
            }
        },
        mounted() {
            this.companyList()
        },
        methods: {
            clearContent() {
                this.companyName = ""
                this.companyList()
            },
            cancel() {
                this.show = false
            },
            open() {
                this.show = true
            },
            bindChange(e) {
                this.index = e.detail.value[0]
            },
            companyList() {
                return companyList({companyName: this.companyName, companyStatus: 0, checkStatus: 2}).then(val => {
                    if(val.data.code == 200){
                        if(!val.data.rows.length || !val.data.rows){
                            // uni.showToast({
                            //     title: '没有符合的数据,请检查输入的执法对象',
                            //     icon: 'none',
                            //     duration: 3000
                            // })
                            this.columns = val.data.rows || []
                        } else {
                            this.columns = val.data.rows
                        }
                        
                    }
                })
            },
            entery() {
                const info = this.columns[this.index]
                this.$emit('confirm', info)
                this.show = false
            },
            close(){
                this.show = true
                this.showadd = false    
            },
            add() {
                this.show = false
                this.showadd = true
                // await this.companyList()
                // // console.log(this.columns.length)
                // if(this.columns.length) {
                    
                // } else {
                //     this.$emit('setCompany', this.companyName)
                //     this.show = false
                // }
            },
            addContent() {
                if(this.name==''){
                    uni.showToast({
                        title: '请输入企业名称',
                        icon: 'none',
                        duration: 3000
                    })
                    return
                }
                this.$emit('setCompany', this.name)
                this.show = false
                this.showadd = false
            }
            
        }
    }
</script>
 
<style lang="scss" scoped>
    .picker-view-box{
        position: fixed;
        z-index: 120000;
        background-color: white;
        height: 600rpx;
        padding: 40rpx 32rpx 0;
        bottom: 0;
        width: 100%;
        box-sizing: border-box;
        border-radius: 20rpx 20rpx 0 0;
    }
    .options{
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 40rpx;
        .button{
            padding: 10rpx 20rpx;
            border-radius: 10rpx;
            font-size: 28rpx;
        }
        .entery{
            background-color: $main-color;
            color: white;
            
        }
    }
    .text-center{
        text-align: center;
        line-height: 34px;
    }
        .picker-view {
            width: 100%;
            height: 500rpx;
            margin-top: 20rpx;
        }
        .set-flex{
            display: flex;
            justify-content: flex-start;
            align-items: center;
            text{
                display: inline-block;
                background-color: $main-color;
                color: white;
                border-radius: 5px;
                padding: 5px 15px;
                margin-left: 20rpx;
                font-size: 24rpx;
            }
        }
        .bz{
            font-size: 24rpx;
            color: #999;
        }
        .down-button{
            margin-top: 60rpx;
            display: flex;
            justify-content: space-between;
            align-items: center;
            &>view{
                width: 45%;
            }
        }
</style>