<template> <view class="page"> <u-navbar title="设备故障" :border-bottom="false" :background="bgc" title-color='#fff' back-icon-color="#fff" title-size='36' height='50'></u-navbar> <view class="box"> <view class="nav"> <view class="top"> <u-search placeholder="搜索" input-align="center" @custom="sousuo" v-model="keyword"></u-search> <view class="yc" @click="btnyc">上报异常</view> </view> </view> <view class="lists" @scrolltolower="onReachBottom" v-for="(item,index) in wateringList" :key="index"> <view class="dahe"> <text class="shen">设备编号</text> <text class="qian">{{item.deviceNo}}</text> </view> <view class="dahe"> <text class="shen">故障原因</text> <text class="qian">{{item.content}}</text> </view> <view class="dahe"> <text class="shen">上报时间</text> <text class="qian">{{item.createTime}}</text> </view> </view> <view class="" v-if="showflag" style="width: 100%;height: 200rpx;margin: auto;margin-top: 170rpx;text-align: center;"> <image style="width: 200rpx;height: 200rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uZFUpcz0YZZ4f4RjvGg2" mode=""></image> <view class="" style="font-size: 28rpx;color: #808080;margin-top: 30rpx;">暂无更多故障记录...</view> </view> </view> </view> </template> <script> export default { data() { return { bgc: { backgroundColor: " #8883F0", }, pagenum: 1, wateringList: [], pagesize: 10, // 一页多少数据 isLoading: false, // 是否正在加载数据 noMoreData: false, // 是否没有更多数据 total: 0, keyword:'', showflag: false } }, onLoad() { }, // 分享到好友(会话) onShareAppMessage: function () { return { title: '创想物联', path: '/pages/shouye/index' } }, // 分享到朋友圈 onShareTimeline: function () { return { title: '创想物联', query: '', path: '/pages/shouye/index' } }, onShow() { this.wateringList = [] this.pagenum = 1 this.getlist() }, methods: { change(index) { this.current = index; }, getlist(){ this.$u.get('/app/abnormal/list?pageNum=' + this.pagenum + '&pageSize='+this.pagesize + '&keyword='+this.keyword).then((res) => { if (res.code == 200) { this.total = res.total if (this.total > 0) { this.showflag = false } else { this.showflag = true } if (res.rows.length > 0) { // 有数据,追加到列表 this.wateringList = this.wateringList.concat(res.rows) this.pagenum++ } else { // 没有更多数据 this.noMoreData = true; } this.isLoading = false; } }) }, onReachBottom() { let sum = this.total / this.pagesize if (this.pagenum-1 < sum) { this.getlist(); // 上拉加载更多 } else { uni.showToast({ title: '没有更多记录了', icon: 'none', duration: 1000 }); } }, sousuo(){ this.keyword = String(this.keyword) this.pagenum = 1 console.log(this.keyword); this.$u.get('/app/abnormal/list?pageNum=' + this.pagenum + '&pageSize='+this.pagesize + '&keyword='+this.keyword).then((res) => { if (res.code == 200) { this.total = res.total if (res.rows.length > 0) { // 有数据,追加到列表 this.wateringList = [] this.wateringList = this.wateringList.concat(res.rows) this.pagenum++ } else { this.wateringList = [] uni.showToast({ title: '没有相关记录了', icon: 'none', duration: 1000 }); // 没有更多数据 this.noMoreData = true; } this.isLoading = false; } }) }, btnyc(){ uni.navigateTo({ url:'/page_fenbao/statulist/fault/yichang/index' }) } } } </script> <style lang="scss"> /deep/ .u-title{ padding-bottom: 22rpx; } /deep/ .uicon-nav-back{ padding-bottom: 22rpx; } page { // background: linear-gradient(180deg, #8883F0 0%, rgba(255, 255, 255, 0) 100%); background: #F4F5F7; } .page { width: 750rpx; // position: fixed; // top: 0; // left: 0; .box{ width: 750rpx; // height: 1624rpx; background: #F4F5F7; padding-top: 170rpx; padding-bottom: 200rpx; box-sizing: border-box; .lists{ width: 680rpx; height: 228rpx; background: #FFFFFF; border-radius: 20rpx 20rpx 20rpx 20rpx; margin: auto; padding: 32rpx 24rpx; padding-top: 6rpx !important; box-sizing: border-box; margin-top: 20rpx; .dahe{ display: flex; justify-content: space-between; margin-top: 26rpx; .shen{ font-size: 28rpx; color: #3D3D3D; } .qian{ font-size: 26rpx; color: #808080; } } } .nav{ width: 750rpx; // height: 180rpx; background: #FFFFFF; padding: 50rpx 36rpx; box-sizing: border-box; // margin-bottom: 26rpx; position: fixed; top: 170rpx; .top{ .yc{ width: 178rpx; height: 68rpx; background: #8883F0; border-radius: 20rpx; color: #FFFFFF; line-height: 68rpx; text-align: center; margin-left: 28rpx; } display: flex; justify-content: space-between; /deep/ .u-content{ border: 1px solid #ccc; border-radius: 50rpx 0 0 50rpx !important; } /deep/ .u-action{ border-radius: 0 50rpx 50rpx 0 !important; width: 112rpx; height: 65rpx; line-height: 65rpx; border: 2rpx solid #ccc; margin-left: 0; color: #3D3D3D; background-color: #f2f2f2; } } } } } </style>