<template>
|
<view class="safe_check">
|
<scroll-view
|
scroll-y="true"
|
class="check_index_scroll"
|
:scroll-top="scrollTop"
|
refresher-enabled="true"
|
refresher-background="#EAEAEA"
|
:refresher-triggered="triggered"
|
@refresherpulling="refresherrefresh"
|
@scrolltolower="scrolltoLower">
|
<view class="safe_check_card" v-for="(item,index) in checkLists" :key="index">
|
<view class="safe_check_text">{{item.inspectName}}</view>
|
<view class="safe_check_btns" @click="btnClick('1',item)">详情与反馈</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
<view class="safe_check_btn">
|
<u-button type="primary" color="#1976FF" text="添加" @click="btnClick('2')"></u-button>
|
</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: '没有更多数据了'
|
},
|
checkLists:[//安全检查列表
|
],
|
}
|
},
|
onLoad() {
|
},
|
onReady() {
|
this.searchCheckList()
|
},
|
methods:{
|
//添加安全检查或详情与反馈按钮
|
btnClick(val,bol){
|
if(val === '1'){//跳转到详情页面
|
uni.navigateTo({
|
url: `./detailsCheck?secureInspectId=${bol.secureInspectId}`
|
})
|
}else{//跳转到添加页面
|
uni.navigateTo({
|
url: `./addCheck?secureId=${val}`
|
})
|
}
|
},
|
//查询安全检查列表
|
searchCheckList(){
|
this.triggered = true;
|
this.checkLists = [];
|
// let params = {
|
// pageNum: this.pageNum,
|
// pageSize:this.pageSize,
|
// }
|
this.$api.reboSystem.searchCheckLists({}).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.checkLists = res.data
|
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.searchCheckList();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLower: throttle(function() {
|
this.status = 'loading';
|
this.pageNum = 1;
|
this.searchCheckList()
|
uni.$u.toast('刷新成功');
|
// if(this.pageNum >= this.loadPage) {
|
// setTimeout(() => {
|
// this.status = 'nomore'
|
// uni.$u.toast('没有更多数据了');
|
// },1000)
|
// return
|
// } else {
|
// this.pageNum+=1
|
// let params = {
|
// pageNum: this.pageNum,
|
// pageSize:this.pageSize,
|
// }
|
// this.$api.reboSystem.searchCheckLists(params).then(res=>{
|
// if(res.statusMsg === 'ok'){
|
// this.checkLists.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 lang="scss" scoped>
|
.safe_check{
|
height: 100vh;
|
padding: 0 15px;
|
background-color: #FFFFFF;
|
.check_index_scroll{
|
height: 90%;
|
.safe_check_card{
|
height: 10vh;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
border-bottom: 1px solid #EAEAEA;
|
.safe_check_text{
|
width:240px;
|
color: #333333;
|
font-size: 520;
|
font-size: 17px;
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
}
|
.safe_check_btns{
|
flex: none;
|
border-radius: 4px;
|
border: 1px solid #4F97FF;
|
background-color: #EDF3FF;
|
color: #1977FF;
|
padding: 2px 5px;
|
}
|
}
|
}
|
.safe_check_btn{
|
}
|
}
|
</style>
|