李旭东
2023-12-08 7efc6ed86025b610cab109a2e9f83362740d8ed4
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<template>
    <view class="check_add_index">
        <view style="height:90vh;overflow: auto;">
            <view class="check_details_matter">
                <view class="check_details_card" >
                    <view class="hidden_text">问题照片</view>
                    <view class="check_details_phone hidden_datas" v-for="(item,index) in hiddenPhone">
                        <!-- <u-image :src="`https://szpipe.thhy-tj.com/${item.imgPath}`" ></u-image> -->
                        <u-album :urls="[`https://szpipe.thhy-tj.com/${item.imgPath}`]"></u-album>
                    </view>
                </view>
                <view class="check_details_card">
                    <view class="hidden_text">举报时间</view>
                    <view class="hidden_datas">{{hiddenDetails.createTime}}</view>
                </view>
                <view class="check_details_card">
                    <view class="hidden_text">隐患地点</view>
                    <view class="hidden_datas">{{hiddenDetails.dangerLocation}}</view>
                </view>
                <view class="check_details_card">
                    <view class="hidden_text">隐患内容</view>
                    <view class="hidden_datas">{{hiddenDetails.title}}</view>
                </view>
                <view class="check_details_card">
                    <view class="hidden_text">提交人</view>
                    <view class="hidden_datas">{{hiddenDetails.reporter}}</view>
                </view>
            </view>
            <view class="check_details_matter" style="margin-top:15px" v-if="checkShow">
                <view class="check_details_card">
                    <view class="hidden_text">隐患等级</view>
                    <view class="hidden_datas">{{hiddenDetails.levelName}}</view>
                </view>
                <view class="check_details_card">
                    <view class="hidden_text">积分值</view>
                    <view class="hidden_datas">{{hiddenDetails.integral===null?'':hiddenDetails.integral}}</view>
                </view>
            </view>
            <u-form
                ref="form"
                :model="formCheck"
                :rules="rulesCkeck"
                labelWidth="auto"
                v-if="!checkShow"
                labelPosition="left">
                <u-form-item
                        label="隐患等级"
                        prop="level"
                        borderBottom
                        @click="changeLever()">
                    <u-input
                        v-model="formCheck.level"
                        placeholder="请选择隐患等级"
                        disabledColor="#FFFFFF"
                        disabled
                        border="none">
                    </u-input>
                    <u-icon
                        slot="right"
                        name="arrow-right">
                    </u-icon>
                </u-form-item>
                <u-form-item
                        label="积分值"
                        prop="integral"
                        borderBottom>
                    <u-input
                        v-model="formCheck.integral"
                        placeholder="请输入积分值"
                        disabledColor="#FFFFFF"
                        border="none">
                    </u-input>
                </u-form-item>
            </u-form>
            <view class="submit_bnt" v-if="hiddenBtn==='0'">
                <u-button type="primary" color="#1976FF" text="提交" @click="submitInsertForm()"></u-button>
            </view>
            <u-picker 
                :show="showLever" 
                :columns="leverColumns" 
                keyName="label"
                @cancel="showLever = false"
                @confirm="selectLever">
            </u-picker>
        </view>
    </view>
</template>
 
<script>
    import { throttle } from '../../plugins/public.js';
    import { basrUrl } from '@/api/http';
    export default{
        data(){
            return{
                hiddenBtn:0,//是否展示提交按钮 0:展示
                createUser:null,//创建人
                checkShow:false,//展示隐患等级和积分值是否可修改
                showLever: false,//隐患等级弹框显隐
                leverColumns: [
                    [
                        {
                            label:'一般隐患',
                            value:1
                        },
                        {
                            label:'重大隐患',
                            value:2
                        },
                        {
                            label:'不存在',
                            value:3
                        }
                    ]
                ],//所有隐患等级
                formCheck:{
                    imageList:[],//上传图片
                    levelId:'',//隐患等级id
                },
                hiddenDetails:[],//隐患举报详情
                hiddenPhone:[],//隐患举报图片
                rulesCkeck: {
                    level: [{
                        required: true,
                        message: '请选择隐患等级',
                        trigger: 'change'
                    }],
                    integral: [{
                        required: true,
                        message: '请输入积分',
                        trigger: 'blur'
                    }],
                }
            }
        },
        onLoad(option) {
            this.hiddenBtn = option.status
            this.createUser = option.createUser
            if(option.status==='0'){//0为审批页面、其他为详情页面
                this.checkShow = false
                this.getDetailsInfo(option.id,0)
            }else{
                this.checkShow = true
                this.getDetailsInfo(option.id,1)
            }
        },
        methods:{
            // 打开隐患等级选择
             changeLever() {
                 this.showLever = true;
                 this.$set(this.formCheck, 'levelId', '');
                 this.$set(this.formCheck, 'level','');
             },
            // 确认隐患等级
            selectLever({ value }) {
                 this.$set(this.formCheck, 'levelId', value[0].value);
                 this.$set(this.formCheck, 'level', value[0].label);
                 this.showLever = false;
            },
            //获取信息详情
            getDetailsInfo(val,num){
                this.$api.reboSystem.detailsHiddenInfo(val).then(res=>{
                    if(res.statusMsg === 'ok'){
                        this.hiddenDetails = res.data
                        this.hiddenPhone = res.data.imgEntities
                        if(num===1){
                            this.$set(this.formCheck,'level',res.data.level)
                            this.$set(this.formCheck,'integral',res.data.integral)
                        }
                    }else{
                        uni.$u.toast(res.statusMsg);
                    }
                })
            },
            //提交按钮
            submitInsertForm: throttle(function() {
                this.$refs.form.validate().then((valid) => {
                    if(valid) {
                        const params = Object.assign({},this.hiddenDetails);
                        params.level = this.formCheck.levelId
                        params.integral = this.formCheck.integral
                        params.createUser = this.createUser
                        this.$api.reboSystem.checkHiddenInfo(params).then((res) => {
                            if(res.success) {
                                uni.$u.toast("提交成功!");
                                uni.redirectTo({
                                    url: './checkHidden'
                                });
                            } else {
                                uni.$u.toast(res.statusMsg);
                            }
                        })
                    }
                })
            }, 3000),
        }
    }
</script>
 
<style lang="scss" scoped>
    .check_add_index{
        background-color: #F6F6F6;
        padding: 0 15px;
        position: relative;
        height: 100vh;
        overflow: hidden;
        
        .check_details_matter{
            // height: calc(100vh - 112px);
            background-color: #FFFFFF;
            border-radius: 6px;
            
            .check_details_card{
                padding: 15px 10px;
                display: flex;
                justify-content: space-between;
                
                .hidden_text{
                    color: rgba(153, 153, 153, 1);
                    font-size: 16px;
                    flex: none;
                }
                .hidden_datas{
                    color: rgba(51, 51, 51, 1);
                    font-size: 15px;
                    text-align: left;
                    flex: 1;
                    margin-left: 15px;
                }
            }
            .check_details_contents{
                height: calc(100% - 460px);
                margin: 15px;
                padding: 15px;
                display: flex;
                // align-items: center;
                background-color: #F6FAFF;
                color:#666666 ;
            }
            .check_details_phone{
                margin-top: 5px;
                margin-left: 15px;
                display: flex;
                justify-content: center;
                overflow: auto;
            }
        }
    }
    .submit_bnt {
        position: absolute;
        bottom: 5%;
        width: calc(100% - 30px);
    }
    
    ::v-deep image{
        width: 320px!important;
        height: 240px!important;
    }
    
    ::v-deep .u-input__content__field-wrapper__field {
        text-align: right !important;
    }
    ::v-deep .u-form-item{
        margin: 15px 0;
        padding: 0 10px;
        background-color: #FFFFFF;
        line-height: 40px;
        border-radius: 4px;
    }
    ::v-deep .u-textarea{
        background-color: #EFEFEF !important;
        color: #999999 !important;
    }
    
</style>
<style scoped>
    .items_tyle /deep/.u-form-item__body{
        flex-direction: column !important;
    }
    .upload_items /deep/.u-upload__wrap{
        flex-wrap: nowrap;
        align-items: center;
    }
</style>