linwe
2024-08-08 3c738f4fe2762bba8087e5a22fc0dc06560eab0e
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
<template>
    <view>
        <u-sticky>
            <view class="bgc-ff">
                <view class="tab">
                    <u-tabs :list="tabList" :current="tabIndex" @click="changeTab" :inactiveStyle="{color:'#999999'}"
                        :activeStyle="{color:'#017BFC'}" :scrollable="false">
 
                    </u-tabs>
                    <view class="search flex j-c-s-b a-i-c">
                        <view class="tab-filter flex j-c-c a-i-c" @click="showDateModal">
                            <text class="f-28">时间筛选</text>
                            <u-icon name="arrow-down"></u-icon>
                        </view>
                        <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="(i,k) in list" :key="k" @click="navTo(i.id,i.status)">
                <view class="item-title flex a-i-c j-c-s-b mb-20">
                    <text class="f-32 fw">{{i.name}}</text>
                    <u-tag v-if="i.status == 1" text="待处理" type="warning" plain plainFill></u-tag>
                    <u-tag v-if="i.status == 2" text="已处理" type="success" plain plainFill></u-tag>
                </view>
                <view class="item-row flex a-i-c j-c-s-b">
                    <text class="f-28">时间</text>
                    <text class="f-28 c-66">{{i.createTime}}</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">{{i.phone}}</text>
                </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">{{i.address || ""}}</text>
                </view>
            </view>
        </view>
        <u-toast ref="uToast"></u-toast>
        <u-loadmore :status="loadingStatus" loadmoreText="开始加载" loadingText="数据加载中" nomoreText="没有更多了" line />
 
        <date-range-modal ref="dateRane" @comfirm="handleComfirmDate" @rest="handleRestDate" />
    </view>
</template>
 
<script>
    import {
        getWorkLogList
    } from "@/api/workLog/workLog.js"
    import dateRangeModal from '@/components/dateRangeModal/modal.vue';
    export default {
        components: {
            dateRangeModal
        },
        data() {
            return {
                tabList: [{
                        name: "全部",
                        status: "",
                    },
                    {
                        name: "待处理",
                        status: 1
                    },
                    {
                        name: "已处理",
                        status: 2
                    }
                ],
                tabIndex: 0,
                currentStatus: "",
                list: [],
                loadingStatus: 'nomore',
                currentPage: 1,
                frequency: '',
                reportType: "",
                selectDate: [],
                houseCode: "",
                keyword: ""
            }
        },
 
        onLoad(option) {
            if (option.code) {
                this.houseCode = option.code;
            }
            this.getList()
        },
        onReachBottom() {
            this.currentPage++
            this.getList()
        },
 
        methods: {
 
 
            searchConfirm() {
                this.resetParams()
                this.getList()
            },
            clearConfirm() {
                this.keyWord = ''
                this.searchConfirm()
            },
            changeTab(e) {
                this.tabIndex = e.index;
                this.currentStatus = e.status;
                this.resetParams();
                this.getList();
            },
            resetParams() {
                this.list = [];
                this.currentPage = 1;
            },
            getList() {
                this.$nextTick(() => {
                    this.loadingStatus = 'loadingmore'
                    this.$refs.uToast.show({
                        type: 'loading',
                        message: '正在加载',
                        duration: 9999999
                    })
                })
                let params = {
                    current: this.currentPage,
                    size: 20,
                    status: this.currentStatus,
                    frequency: this.frequency,
                    roleName: uni.getStorageSync('activeRole').roleName
                }
                if (this.selectDate.length) {
                    params.startTime = this.selectDate[0]
                    params.endTime = this.selectDate[1]
                }
                if (this.houseCode) {
                    params.houseCode = this.houseCode;
                }
 
                if (this.reportType) {
                    params.reportType = this.reportType
                }
                if (this.keyword) {
                    params.name = this.keyword;
                }
 
                getWorkLogList(params).then(res => {
                    if (res.code != 200) {
                        uni.showToast({
                            title: '数据请求失败',
                            icon: 'error'
                        })
                        return
                    }
                    let records = res.data.records;
                    this.list = [...this.list, ...records]
                    this.$nextTick(() => {
                        this.$refs.uToast.isShow = false
                    })
                    this.loadingStatus = 'nomore'
                })
            },
            navTo(id, status) {
                if (status == 1) {
                    this.$u.func.globalNavigator(`/subPackage/workbench/views/workLog?id=${id}`)
                } else {
                    this.$u.func.globalNavigator(`workLogDetail?id=${id}`)
                }
            },
 
            showDateModal() {
                this.$refs.dateRane.open();
            },
 
            handleRestDate() {
                this.selectDate = [];
                this.resetParams();
                this.getList()
            },
            handleComfirmDate(val) {
                this.selectDate = val;
                this.resetParams();
                this.getList()
            }
 
        }
    }
</script>
 
<style lang="scss">
    page {
        background-color: #F5F5F5;
    }
 
 
 
    .tab {
        // width: 100%;
 
    }
 
    .search {
        padding: 20rpx 20rpx;
    }
 
    // .tab /deep/.u-tabs__wrapper__nav__item {
    //     flex: 1;
    // }
    .tab-filter {
        padding: 0 20rpx;
    }
 
    .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>