guoshilong
2023-10-27 2311b03aee9db1bebacdd2ced13c071efda6a011
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
<template>
    <view>
        <!-- <view class="place"></view> -->
        <view class="main">
            <view class="itme-box">
                <view class="h-table">
                    <view class="h-tr h-tr-6 h-thead ">
                        <view class="h-td column-0">序号</view>
                        <view class="h-td column-1">水库</view>
                        <view class="h-td column-2">测点</view>
                        <view class="h-td column-3">时间</view>
                        <view class="h-td column-4">渗透压力(kpa)</view>
                        <view class="h-td column-5">渗压水位(m)</view>
                    </view>
                    <scroll-view scroll-y style="height: 74vh;width: 100%;" @scrolltolower="scrolltolower">
                        <view class="h-tr h-tr-6" v-for="(item,index) in tableList" :key="index">
                            <view class="h_box h-tr h-tr-6">
                                <view class="h-td column-0">{{index+1}}</view>
                                <view class="h-td column-1 name ">
                                    <view @click.stop="goReservoirDetail(item)"> {{item.res_nm}}</view>
                                </view>
                                <view class="h-td column-2">{{item.cd}}</view>
                                <view class="h-td column-3">{{item.tm}}</view>
                                <view class="h-td column-4">{{item.oms_pressure}}</view>
                                <view class="h-td column-5">{{item.sw_val}}</view>
                            </view>
                        </view>
                    </scroll-view>
                </view>
            </view>
            <u-loading-icon text="加载中" textSize="18" :show="showLoading"></u-loading-icon>
        </view>
        <u-loading-page :loading="pageLoading"></u-loading-page>
    </view>
</template>
 
<script>
    import {
        getSyList
    } from "@/api/dataCenter/dbSafety/dbSafety"
    export default {
        props: {
            res_nm: {
                type: String,
                default: "",
            },
        },
        data() {
            return {
                tableList: [],
                isShow: false,
                pages: {
                    pageNo: 1,
                    pageSize: 25
                },
                region: {},
                showLoading: false,
                pageLoading: false,
            }
        },
        created() {
            this.getSyListData()
        },
        options: {
            styleIsolation: 'shared'
        },
        methods: {
            showCity() {
                this.isShow = !this.isShow
            },
 
            getSyListData() {
                let regionData = uni.getStorageSync("adCodeBase")
                if (!regionData) return
                let params = {
                    pageSize: this.pages.pageSize,
                    pageNo: this.pages.pageNo,
                    res_nm: this.res_nm
                }
                if (!this.region.label && !this.region.value) {
                    if (regionData.adGrad == 1) {
                        params.province_cd = regionData.adCode
                    } else if (regionData.adGrad == 2) {
                        params.city_cd = regionData.adCode
                    } else if (regionData.adGrad == 3) {
                        params.county_cd = regionData.adCode
                    }
                    params.bas_guid = this.region.name
                } else {
                    params[this.region.label] = this.region.value
                    params.bas_guid = this.region.name
                }
                this.getSyList(params)
            },
 
            // 渗压列表
            getSyList(params) {
                this.pageLoading = true
                getSyList(params).then(res => {
                    console.log(res, "res====")
                    this.tableList = res.data.data
                    this.tableList.forEach(e => {
                        e.tm = e.tm.substring(5, 16)
                        // let tm = new Date(e.tm)
                        // let formatter = dateFormat(tm, 'MM-dd hh:mm')
                        // e.tm = formatter
                    })
                    this.pageLoading = false
                    uni.stopPullDownRefresh()
                })
            },
 
            scrolltolower() {
                this.pages.pageNo += 1
                this.showLoading = true
                let params = {
                    pageSize: this.pages.pageSize,
                    pageNo: this.pages.pageNo,
                    res_nm: this.res_nm
                }
 
 
                params[this.region.label] = this.region.value
                getSyList(params).then(res => {
                    let data = res.data.data
                    data.forEach(v => {
                        v.tm = v.tm.substring(5, 16)
                    })
                    this.tableList = this.tableList.concat(data)
                    this.showLoading = false
                })
            },
 
            // 搜索
            search() {
                this.pages.pageNo = 1
                this.getSyListData()
            },
 
 
            //跳转到水库详情页
            goReservoirDetail(item) {
                let data = {
                    id: item.res_cd,
                    name: item.res_nm
                }
                let dataStr = JSON.stringify(data)
                let url = "/subPackage/realtimeMonitor/reservoir/detail?item=" + dataStr
                this.$u.func.globalNavigator(url, "navTo")
            },
 
 
        }
    }
</script>
 
<style scoped lang="scss">
    /* 引入表格样式表 */
    @import "@/subPackage/rainWaterCondition/static/style/helang-table.scss";
 
    ::v-deep .h-table .h-tr {
        flex-wrap: wrap;
    }
 
    .place {
        height: 200rpx;
    }
 
 
    .h-table {
        .h-thead {
            color: #51A4FA;
            background-color: #E1F3FF;
            justify-content: space-between;
        }
 
        .h-td {
            border-right-width: 0;
            font-size: 25rpx;
        }
 
        .show_city {
            width: 100% !important;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            padding: 0 26rpx;
            background: #f5f5f5;
            transition: width 150ms ease-in;
        }
 
        .h_box {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
        }
 
        .h-tr {
            border-width: 0;
            text-align: center;
 
            .column-0 {
                width: 10%;
            }
 
            .column-1 {
                width: 24%;
            }
 
            .column-2 {
                width: 10%;
            }
 
            .column-3 {
                width: 24%;
            }
 
            .column-4 {
                width: 16%;
            }
 
            .column-5 {
                width: 16%;
            }
        }
 
        .name {
            color: #3c9cff;
        }
 
        .differ {
            color: #ff0000;
        }
 
 
 
    }
</style>