张晓波
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
<template>
    <view class="train_index">
        <scroll-view 
            scroll-y="true"
            class="incom_index_scroll"
            :scroll-top="scrollTop" 
            refresher-enabled="true" 
            refresher-background="#EAEAEA"
            :refresher-triggered="triggered" 
            @refresherpulling="refresherrefresh"
            @scrolltolower="scrolltoLower">
            <view class="train_main_list" v-for="(item,index) in noticeLists" :key="index">
                <view class="train_left">
                    <view class="train_left_title">{{item.inspectName}}</view>
                    <view class="train_left_contents">{{item.createTime}}</view>
                </view>
                <view class="train_right">
                    <view @click="startClick(item)" :class="{'train_right_btn':item.isState === 1,'train_right_btn1':item.isState === 2}">{{item.isState === 1?'待整改':'已整改'}}</view>
                </view>
            </view>
            <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
        </scroll-view>
    </view>
</template>
 
<script>
    import { throttle } from '../../plugins/public.js';
    export default {
        data(){
            return{
                pageNum: 1,
                pageSize: 10,
                loadPage: 0,
                scrollTop: 0,
                triggered: true,
                status: 'loading',
                loadText: {
                    loading: '努力加载中',
                    nomore: '没有更多数据了'
                },
                noticeLists:[
                ],//整改通知列表
            }
        },
        onLoad() {
            this.searchTrainList()
        },
        methods:{
            //点击跳转整改详情
            startClick(val){
                uni.navigateTo({
                    url: `./noticeDetails?secureInspectId=${val.secureInspectId}&isState=${val.isState}`
                })
            },
            //查询列表
            searchTrainList(){
                this.triggered = true;
                this.noticeLists = [];
                this.$api.reboSystem.searchNoticeLists({}).then(res=>{
                    if(res.statusMsg === 'ok'){
                        this.noticeLists = res.data
                        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.searchTrainList();
                uni.$u.toast('刷新成功');
            }, 500),
            //触底刷新
            scrolltoLower: throttle(function() {
                this.status = 'loading';
                this.pageNum = 1;
                this.searchTrainList();
            }, 1500),
        }
    }
</script>
 
<style scoped lang="scss">
    .train_index{
        height: 100vh;
        background-color: #FFFFFF;
        
        .incom_index_scroll{
            height: 90%;
            .train_main_list{
                display: flex;
                justify-content: space-between;
                padding: 10px 0px;
                margin: 0 15px;
                border-bottom: 1px solid #EAEAEA;
                .train_left{
                    .train_left_title{
                        color: #333333;
                        font-weight: 510;
                        font-size:17px ;
                    }
                    .train_left_contents{
                        width: 230px;
                        margin-top: 10px;
                        color: #999999;
                        font-size: 13px;
                        white-space: nowrap;
                        overflow: hidden; 
                        text-overflow: ellipsis;
                    }
                }
                .train_right{
                    margin-top: 15px;
                    .train_right_btn{
                        color: #FFFFFF;
                        font-size: 14px;
                        padding: 4px 10px;
                        border: 1px solid #EAEAEA;
                        background-color: #FC3E3E;
                        border-top-left-radius: 15px;
                        border-bottom-right-radius: 15px;
                    }
                    .train_right_btn1{
                        color: #FFFFFF;
                        font-size: 14px;
                        padding: 4px 10px;
                        border: 1px solid #1977FF;
                        background-color: #1977FF;
                        border-top-left-radius: 15px;
                        border-bottom-right-radius: 15px;
                    }
                }
            }
        }
    }
</style>