<template>
|
<view class="check_index">
|
<view class="check_select">
|
<view @click="startClick()">
|
<u--input placeholder="举报起始时间" disabled disabledColor="#FFFFFF" placeholderStyle="color:#999999;padding-left:10px" v-model="search.startTime" border="none" suffixIcon="calendar" suffixIconStyle="color: #666666;font-size:30px;"></u--input>
|
</view>
|
<view @click="endClick()">
|
<u--input placeholder="举报截止时间" disabled disabledColor="#FFFFFF" placeholderStyle="color:#999999;padding-left:10px" v-model="search.endTime" border="none" suffixIcon="calendar" suffixIconStyle="color: #666666;font-size:30px;"></u--input>
|
</view>
|
<view style="width:60px">
|
<u-button type="primary" color="#1977FF" text="查询" @click="searchCheckList()"></u-button>
|
</view>
|
</view>
|
<view class="hidden_add">
|
<u-button type="primary" color="#1977FF" text="添加" @click="goAddHidden()"></u-button>
|
</view>
|
<view class="check_main">
|
<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="check_card_index" v-for="(item,index) in hiddenDatas" :key="index">
|
<view class="check_card_header">
|
<view class="check_header_times">{{item.createTime}}</view>
|
<view class="check_header_names" @click="goDetailsPage(item)">详情></view>
|
</view>
|
<view class="check_card_main">
|
<view class="check_main_items">
|
<view class="check_main_items_titles">隐患地点</view>
|
<view class="check_main_items_datas">{{item.dangerLocation}}</view>
|
</view>
|
<view class="check_main_items">
|
<view class="check_main_items_titles">隐患标题</view>
|
<view class="check_main_items_datas">{{item.title}}</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>
|
<u-datetime-picker
|
:show="showEnd"
|
v-model="endTime"
|
mode="date"
|
@confirm="changeEnd"
|
@cancel="showEnd = false"
|
></u-datetime-picker>
|
<u-popup :show="showResult" @close="closeResult" mode="center" :round="6" :closeable="true">
|
<view class="result_main_style">
|
{{resultContent===null?'':resultContent}}
|
</view>
|
</u-popup>
|
</view>
|
</template>
|
|
<script>
|
import {changeTime,throttle} from '@/plugins/public.js'
|
export default{
|
data(){
|
return{
|
showResult:false,//是否展示检查结果弹框
|
resultContent:"",//检查结果内容
|
search:{},//查询条件
|
showStart:false,//是否显示起始时间
|
showEnd:false,//是否展示截止时间弹框
|
startTime:Number(new Date()),//起始时间默认当天
|
endTime:Number(new Date()),//截止时间默认当天
|
hiddenDatas:[{}],//列表数据
|
pageNum: 1,
|
pageSize: 10,
|
loadPage: 0,
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
}
|
},
|
onLoad(options) {
|
this.searchCheckList()
|
},
|
methods:{
|
//关闭弹框
|
closeResult(){
|
this.showResult = false
|
},
|
//跳转详情页
|
goDetailsPage(val){
|
uni.navigateTo({
|
url: `./detailsHidden?id=${val.id}`
|
})
|
},
|
//跳转隐患举报添加按钮
|
goAddHidden(){
|
uni.navigateTo({
|
url: `./addHidden`
|
})
|
},
|
//查询列表
|
searchCheckList(){
|
this.triggered = true;
|
this.hiddenDatas = [];
|
let params =Object.assign({},{
|
startTime:this.search.startTime?this.search.startTime+' 00:00:00':'',
|
endTime:this.search.endTime?this.search.endTime+' 23:59:59':'',
|
pageNum: this.pageNum,
|
pageSize:this.pageSize,
|
})
|
this.$api.reboSystem.searchHiddenLists(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.hiddenDatas = 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.searchCheckList();
|
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.searchHiddenLists(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.hiddenDatas.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),
|
//点击弹出选择起始时间
|
startClick(){
|
this.showStart = true
|
this.$set(this.search,'startTime','')
|
},
|
//确定选择的起始时间
|
changeStart({value}){
|
this.showStart = false
|
this.$set(this.search,'startTime',changeTime(value))
|
},
|
//点击弹出选择截止时间
|
endClick(){
|
this.showEnd = true
|
this.$set(this.search,'endTime','')
|
},
|
//确定选择的起始时间
|
changeEnd({value}){
|
this.showEnd = false
|
this.$set(this.search,'endTime',changeTime(value))
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.check_index{
|
height: 100vh;
|
background-color: #F6F6F6;
|
padding: 10px 15px;
|
|
.hidden_add{
|
width: 100%;
|
line-height:20px;
|
margin-bottom: 10px;
|
}
|
|
.check_select{
|
display: flex;
|
margin-bottom: 10px;
|
}
|
.check_main{
|
height: calc(100% - 135px);
|
.check_index_scroll{
|
height: 95%;
|
|
.check_card_index{
|
height: 120px;
|
background-color: #FFFFFF;
|
border-radius: 6px;
|
margin-bottom: 10px;
|
.check_card_header{
|
line-height: 40px;
|
border-bottom: 1px solid #F2F2F2;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
.check_header_times{
|
font-size: 15px;
|
padding-left: 28px;
|
color: #333333;
|
position: relative;
|
&::before{
|
width: 15px;
|
height: 15px;
|
content: "";
|
background: url('../../static/times.png') no-repeat;
|
position: absolute;
|
top: 13px;
|
left: 10px;
|
}
|
}
|
.check_header_names{
|
padding-right: 15px;
|
font-size: 17px;
|
color: #1977FF;
|
}
|
}
|
.check_card_main{
|
display: flex;
|
flex-direction: column;
|
justify-content: space-around;
|
.check_main_items{
|
display: flex;
|
line-height: 30px;
|
.check_main_items_titles{
|
padding-left: 15px;
|
width: 80px;
|
flex: none;
|
color: #999999;
|
font-size: 15px;
|
}
|
.check_main_items_datas{
|
padding-right: 10px;
|
color: #333333;
|
font-size: 15px;
|
flex: 1;
|
text-align: left;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
::v-deep .u-input {
|
margin-right: 10px!important;
|
background-color: #FFFFFF;
|
border-radius: 0px;
|
height: 40px;
|
}
|
.result_main_style{
|
width: 200px;
|
height: 200px;
|
padding: 30px 15px 15px;
|
overflow: auto;
|
margin-right: 15px;
|
}
|
</style>
|