Liuyi
2024-12-20 d470e67ac1997882502b75cbfdaf359626cfaaa8
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
<script setup>
    import { ref ,onMounted } from 'vue';
    import { searchBreakdownApi,editExamineApi } from '../../api/index.js'
    import { BASE_URL } from '../../config/baseUrl.js';
    
    const baseUrl = ref(BASE_URL)
    const breakdownList = ref([])
     async function searchBreakdown(){
         await searchBreakdownApi({limit:10000,page:1}).then((res) =>{
             if(res.code == 200){
                 breakdownList.value = []
                breakdownList.value = res.data.list 
                breakdownList.value.forEach((item) =>{
                    item.imageList = item.url.split(',')
                })
                console.log('000',breakdownList.value)
             }
         })
     }
     async function handleBreakdown(item){
        uni.showModal({
            title:'提示',
                content:'确定已处理完成该上报问题',
                success:async(res) =>{
                    if(res.confirm){
                        await setBreakdown(item)
                    }
                },
                fail:() =>{}
        }) 
     }
     async function setBreakdown(item){
        let postParams = JSON.parse(JSON.stringify(item))
        postParams.isSolve = 1
         await editExamineApi(postParams).then(async(res) =>{
            if(res.code == 200){
                console.log(13,postParams)
                await searchBreakdown()
            }
         })
     }
     //图片预览
     function clickImg(imgList,imgItem){
         console.log(333,imgList)
         let imgUrl = baseUrl.value + '/upload' + imgItem
         let imgUrlList = []
         imgList.forEach((item) =>{
             imgUrlList.push(baseUrl.value + '/upload' + item) 
         })
         console.log(123,imgUrlList)
        uni.previewImage({
            urls:imgUrlList,  //需要预览的图片http链接列表
            current: imgUrl, // 当前显示图片的http链接,默认是第一个
            indicator:'default',
            loop:true,
            success: function(res) {},
            fail: function(res) {
                console.log('error',res)
            },
            complete: function(res) {},
        })
    }
     onMounted(async() =>{
        await searchBreakdown() 
     })
</script>
<template>
    <view class="container">
        <navbar title = '上报记录'></navbar>
        <view class="content">
            <view class="main">
                <view v-for="(item,index) in breakdownList" class="item">
                    <view class="item-child">
                        <text class="text">设备编号:</text>
                        <text class="value">{{item.facilityCode}}</text>
                    </view>
                    <view class="item-child">
                        <text class="text">故障类型:</text>
                        <text class="value">{{item.typeName}}</text>
                    </view>
                    <view class="item-child">
                        <text class="text">联系方式:</text>
                        <text class="value">{{item.userPhone}}</text>
                    </view>
                    <view class="item-child">
                        <text class="text">故障描述:</text>
                        <text class="value">{{item.describe}}</text>
                    </view>
                    <view class="item-child handle-item">
                        <view>
                            <text class="text">处理状态:</text>
                            <text class="value">{{item.isSolveView}}</text>
                        </view>
                        <view v-if ="item.isSolve == 0" class="handle-btn" @click="handleBreakdown(item)">核实处理</view>
                        <view v-else class="handle-status">已处理</view>
                    </view>
                    <view class="item-child-image">
                        <view class="text">故障图片:</view>
                        <view class="imgList">
                            <view class="child-img" v-for="(itemChild,index) in item.imageList" :key="index"  @click="clickImg(item.imageList,itemChild)">
                                <image class="img" :src="baseUrl + '/upload' + itemChild" mode="aspectFit"></image>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>
<style lang="scss" scoped>
    .container{
        width:100%;
        box-sizing: border-box;
        .content{
            height:calc(100vh - 176rpx);
            background: linear-gradient(to bottom,#8BC1FC 0%,#D2F2FE 30%,#D2F2FE 100%);
            padding:30rpx 20rpx 100rpx;
            box-sizing: border-box;
            .main{
                width:100%;
                height:100%;
                background: #f3fbfe;
                padding:20rpx;
                box-sizing: border-box;
                overflow: scroll;
                .item{
                    width:100%;
                    height: 550rpx;
                    box-shadow: 0 0 3rpx 1rpx #bac1c8;
                    margin-top:30rpx;
                    display: flex;
                    flex-direction: column;
                    padding:10rpx 20rpx;
                    box-sizing: border-box;
                    .item-child{
                        margin-top:6rpx;
                        .text{
                            color: #616266;
                            margin-right:10rpx;
                        }
                        .value{
                            color: #5687c7;
                        }
                    }
                    .handle-item{
                        display: flex;
                        justify-content: space-between;
                        align-items: center;
                        .handle-btn{
                            width:120rpx;
                            height:60rpx;
                            background: rgba(110, 151, 245, 0.8);
                            border-radius:15rpx;
                            text-align: center;
                            line-height:60rpx;
                            color: #fff;
                            font-size:28rpx;
                        }
                        .handle-status{
                            width:120rpx;
                            height:60rpx;
                            background: rgba(110, 151, 245, 0.4);
                            border-radius:15rpx;
                            text-align: center;
                            line-height:60rpx;
                            color: #fff;
                            font-size: 30rpx;
                        }
                    }
                    .item-child-image{
                        display: flex;
                        flex-direction: column;
                        .text{
                            color: #616266;
                        }
                        .imgList{
                            display: flex;
                            justify-content: space-between;
                            align-items: center;
                            margin-top:20rpx;
                            .child-img{
                                width: 180rpx;
                                height:180rpx;
                                border-radius:20rpx;
                                border:1rpx dashed #b7d4ff;
                                margin-bottom: 10rpx;
                                display: flex;
                                justify-content: center;
                                align-items: center;
                                overflow: hidden;
                                .img{
                                    width: 170rpx;
                                    height:170rpx;
                                }
                            }
                        }
                    // }
                    }
                }
            }
        }
    }
           
</style>