linwe
2023-11-12 b77cc2d2012ecb4b876538ac7aee3edac7db8a2f
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
<template>
    <view>
        <u-sticky>
            <view class="tab">
                <view class="tab">
                    <u-tabs :list="tabList" :scrollable="false" :current="tabIndex" @click="changeTab"
                        :inactiveStyle="{color:'#999999'}" :activeStyle="{color:'#017BFC'}"></u-tabs>
                    <view class="search">
                        <u-search placeholder="请输入场所名称" v-model="keyWord" :clearabled="true" :showAction="true"
                            :animation="true" @search="searchConfirm" @clear="clearConfirm"></u-search>
                    </view>
                </view>
            </view>
        </u-sticky>
        <view class="list">
            <view class="list-item bgc-ff mb-20" v-for="item in siteList" :key="item.id" @click="pushPage(item.placeId, item.id)">
                <view class="item-title flex a-i-c j-c-s-b mb-20">
                    <text class="f-32 fw">{{ item.placeName ? item.placeName : '场所信息未完善' }}</text>
                    <!-- <u-tag text="待审批" type="warning" plain plainFill></u-tag> -->
                    <u-tag class="u_tag" size="mini" :text="findObjValue(item.confirmFlag, tabList).name" :type="findObjValue(item.confirmFlag, tabList).type" plain plainFill></u-tag>
                    <!-- <u-tag text="审核拒绝" type="error" plain plainFill></u-tag> -->
                </view>
                <view class="item-row flex a-i-c j-c-s-b">
                    <text class="f-28">地址</text>
                    <text class="address f-28 c-66">{{ item.localtion }}</text>
                </view>
                <view class="item-row flex a-i-c j-c-s-b">
                    <text class="f-28">法人信息</text>
                    <text class="f-28 c-66">{{ item.legalPerson }}</text>
                </view>
            </view>
        </view>
        <u-loadmore :status="loadingStatus" loadmoreText="开始加载" loadingText="数据加载中" nomoreText="没有更多了" line />
    </view>
</template>
 
<script>
    import {
        getSiteMaintenanceData
    } from '@/api/placeExp/placeExp.js'
    export default {
        data() {
            return {
                siteList: [],
                pagingParams: {
                    current: 1,
                    size: 10
                },
                tabList: [{
                        name: "待审核",
                        status: 1,
                        type: 'warning'
                    },
                    {
                        name: "审核通过",
                        status: 2,
                        type: 'success'
                    },
                    {
                        name: "审核不通过",
                        status: 3,
                        type: 'error'
                    },
                ],
                tabIndex: 0,
                tabStatus: 1,
                keyWord: '',
                loadingStatus: 'nomore',
                clickInfo: {},
                currentRole: {}
            }
        },
        onShow() {
            this.currentRole = uni.getStorageSync("activeRole")
            this.resetParams()
            this.getSiteList()
        },
        onReachBottom() {
            this.pagingParams.current++
            this.getSiteList()
        },
        methods: {
            async getSiteList() {
                this.loadingStatus = 'loadingmore'
                const params = {
                    placeName: this.keyWord,
                    confirmFlag: this.tabStatus
                }
                const { roleName } = this.currentRole
                const res = await getSiteMaintenanceData({
                    ...params,
                    roleName,
                    ...this.pagingParams
                })
                console.log(res);
                const {
                    code,
                    data: {
                        records
                    }
                } = res
                if (code !== 200) {
                    uni.showToast({
                        title: '数据请求失败',
                        icon: 'error'
                    })
                    return
                }
                this.siteList = [...this.siteList, ...records]
                this.loadingStatus = 'nomore'
            },
            changeTab(e) {
                this.tabStatus = e.status;
                this.resetParams()
                this.getSiteList()
            },
            searchConfirm() {
                this.resetParams()
                this.getSiteList()
            },
            clearConfirm() {
                this.keyWord = ''
                this.resetParams()
                this.searchConfirm()
            },
            resetParams() {
                this.siteList = []
                this.pagingParams.current = 1
            },
            findObjValue(value, obj) {
                const res = obj.find(item => {
                    return item.status == value
                })
                return res
            },
            pushPage(placeId, id) {
                const { roleAlias } = this.currentRole
                if (roleAlias === "inhabitant") {
                    return
                }
                this.$u.func.globalNavigator(`/subPackage/workbench/views/examine?id=${id}&placeId=${placeId}`)
            }
        }
    }
</script>
 
<style lang="scss">
    page {
        background-color: #F5F5F5;
    }
 
    .tab {
        background-color: #fff;
 
        .search {
            padding: 20rpx 70rpx;
        }
    }
 
    .list {
        margin: 20rpx 30rpx 0;
    }
 
    .list-item {
        padding: 0 30rpx 20rpx;
        border-radius: 8rpx;
 
        .item-title {
            padding: 30rpx 0;
            border-bottom: 1px solid #F5F5F5;
        }
 
        .item-row {
            padding: 10rpx 0;
 
            .address {
                width: 65%;
                text-align: right;
            }
        }
    }
</style>