张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
<template>
    <view class="datum_index">
        <view class="datum_headers">
            <view @click="startClick()" style="width: 100%;">
                <u--input placeholder="值班日期" disabled disabledColor="#FFFFFF" placeholderStyle="color:#999999;padding-left:10px"   v-model="search.dutyDate"  suffixIcon="calendar" suffixIconStyle="color: #666666;font-size:30px;"></u--input>
            </view>
            <view style="width:60px;">
                <u-button type="primary" color="#1977FF" text="查询" @click="searchDutyList"></u-button>
            </view>
        </view>
        <view class="datum_main">
            <scroll-view
                scroll-y="true"
                class="datum_index_scroll"
                :scroll-top="scrollTop" 
                refresher-enabled="true" 
                refresher-background="#EAEAEA"
                :refresher-triggered="triggered" 
                @refresherpulling="refresherrefresh"
                @scrolltolower="scrolltoLower">
                <view class="staff_main_list" v-for="(item,index) in dutyLists" :key="index">
                    <view class="staff_headers">
                        <view class="staff_headers_titles">{{item.dutyDate}}</view>
                        <view class="staff_headers_btns" >{{item.dutyUserName}}</view>
                    </view>
                    <view class="staff_contents">
                        <view class="staff_contents_items">
                            <view class="staff_contents_text">联系电话:</view>
                            <view class="staff_contents_data">{{item.phone}}</view>
                        </view>
                        <view class="staff_contents_items">
                            <view class="staff_contents_text">值班内容:</view>
                            <view class="staff_contents_data">{{item.dutyContent}}</view>
                        </view>
                        <view class="staff_contents_items">
                            <view class="staff_contents_text">备注:</view>
                            <view class="staff_contents_data">{{item.remark ===null?'':item.remark}}</view>
                        </view>
                    </view>
                </view>
                <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
            </scroll-view>
        </view>
        <u-datetime-picker
            :show="showStart"
            v-model="startTime"
            mode="date"
            @confirm="changeStart"
            @cancel="showStart = false"
        ></u-datetime-picker>
    </view>
</template>
 
<script>
    import { throttle,changeTime} from '../../plugins/public.js';
    export default{
        data(){
            return{
                showStart:false,//是否显示起始时间
                startTime:Number(new Date()),//起始时间默认当天
                search:{},//查询条件
                dutyLists:[
                ],//值班列表
                pageNum: 1,
                pageSize: 10,
                loadPage: 0,
                scrollTop: 0,
                triggered: true,
                status: 'loading',
                loadText: {
                    loading: '努力加载中',
                    nomore: '没有更多数据了'
                },
            }
        },
        onLoad() {
            this.searchDutyList()
        },
        methods:{
            //点击弹出选择起始时间
            startClick(){
                this.showStart = true
                this.$set(this.search,'dutyDate','')
            },
            //确定选择的起始时间
            changeStart({value}){
                this.showStart = false
                this.$set(this.search,'dutyDate',changeTime(value))
            },
            //查询列表
            searchDutyList(){
                this.triggered = true;
                this.dutyLists = [];
                let params = Object.assign({},this.search,{
                    pageNum: this.pageNum,
                    pageSize:this.pageSize,
                })
                this.$api.reboSystem.getDutyLists(params).then(res=>{
                    if(res.statusMsg === 'ok'){
                        this.dutyLists = res.data.list
                        this.loadPage = res.data.pages;
                        this.triggered = false;
                        this.status = 'nomore';
                    }else{
                        uni.$u.toast(res.statusMsg);
                    }
                }).catch((err) => {
                    uni.$u.toast('请检查网络服务或联系管理员!')
                })
            },
            //自定义下拉刷新
            refresherrefresh: throttle(function() {
                this.status = 'loading';
                this.pageNum = 1;
                this.searchDutyList();
                uni.$u.toast('刷新成功');
            }, 500),
            //触底刷新
            scrolltoLower: throttle(function() {
                this.status = 'loading';
                if(this.pageNum >= this.loadPage) {
                    setTimeout(() => {
                        this.status = 'nomore'
                        uni.$u.toast('没有更多数据了');
                    },1000)
                    return
                } else {
                    this.pageNum+=1
                    let params = Object.assign({},this.search,{
                        pageNum: this.pageNum,
                        pageSize:this.pageSize,
                    })
                    this.$api.reboSystem.getDutyLists(params).then(res=>{
                        if(res.statusMsg === 'ok'){
                            this.dutyLists.push(...res.data.list)
                            this.loadPage = res.data.pages;
                            this.triggered = false;
                            this.status = 'nomore';
                        }else{
                            uni.$u.toast(res.statusMsg);
                        }
                    }).catch((err) => {
                        uni.$u.toast('请检查网络服务或联系管理员!')
                    })
                }
            }, 1500),
        }
    }
</script>
 
<style scoped lang="scss">
    .datum_index{
        background-color: #F6F6F6;
        height: 100vh;
        padding: 10px 15px;
        overflow: hidden;
        
        .datum_headers{
            padding: 5px 10px;
            height: 10vh;
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            background-color: #FFFFFF;
            border-radius: 6px;
            
        }
        .datum_main{
            height: calc(100vh - 85px);
            .datum_index_scroll{
                height: 90%;
                
                .staff_main_list{
                    margin-bottom: 15px;
                    border-radius: 6px;
                    background-color: #FFFFFF;
                    
                    .staff_headers{
                        line-height: 45px;
                        border-bottom: 1px solid #EAEAEA;
                        display: flex;
                        justify-content: space-between;
                        align-items: center;
                        flex-direction: row;
                        .staff_headers_titles{
                            padding-left: 45px;
                            color: #333333;
                            font-size: 17px;
                            position: relative;
                            &::before{
                                position: absolute;
                                content: "";
                                top: 10px;
                                left: 10px;
                                width: 50px;
                                height: 50px;
                                background: url('../../static/duty_icon.png') no-repeat;
                            }
                        }
                        .staff_headers_btns{
                            padding-right: 10px;
                            font-size: 17px;
                            color: #1977FF;
                            display: flex;
                        }
                    }
                    .staff_contents{
                        padding: 10px 0px 10px 10px;
                        .staff_contents_items{
                            display: flex;
                            line-height: 30px;
                            .staff_contents_text{
                                font-size: 15px;
                                color: #999999;
                            }
                            .staff_contents_data{
                                color: #333333;
                                font-size: 15px;
                            }
                        }
                    }
                }
            }
        }
    }
    ::v-deep .u-border{
        border-top-right-radius: 0px!important;
        border-bottom-right-radius: 0px!important;
        border-color: #1977FF!important;
        padding-top: 5px!important;
        padding-bottom: 9px!important;
    }
    ::v-deep .u-button--square{
        border-top-left-radius: 0px!important;
        border-bottom-left-radius: 0px!important;
    }
</style>
<style scoped>
    .icon_style /deep/.u-icon__icon{
        top: 17px!important;
    }
</style>