| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <template>
- <view>
- <view class="status_bar"></view>
- <view class="" style="position: relative;top: 40px;">
- <view style="position: fixed;z-index: 100;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回"
- size="16">
- <view class="bases_search">
- <view class="bases_search_text" @click="clickRight">
- <u-icon name="search" class="search" @click="search"></u-icon>
- <input type="text" v-model="data.search" placeholder="设备ID搜索" disabled/>
- </view>
- </view>
- </uni-nav-bar>
- </view>
- <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/prevention/1.png'" mode="" class="image"></image>
- <view class="prevents">
- <view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
- <image :src="item.is_online==1?'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/6.png':'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/7.png'"
- mode="" class="prevents_item_img"></image>
- <view class="prevents_item_top">
- <p>设备名称:{{item.device_name==""?"无":item.device_name}}</p>
- <p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
- </view>
- <view class="prevents_item_bot">
- <p>设备 ID:{{item.imei}}</p>
- <p>最新上报时间:{{item.addtime|timeFormat()}}</p>
- </view>
- </view>
- </view>
- </view>
- <view class="top">
- <view class="backtop" @click="top" v-if="isTop">
- <image src="../../static/images/1.png" mode="" class="img0"></image>
- </view>
- <view class="more">
- <view class="box" @click="online" v-show="filtrateTF">
- <p>在线</p>
- </view>
- <view class="box" @click="offline" v-show="filtrateTF">
- <p>离线</p>
- </view>
- <view class="box" @click="complete" v-show="filtrateTF">
- <p>全部</p>
- </view>
- <view @click="filtrate">
- <image src="../../static/images/b0bcdb0e3fe8690520f743aa8303bf2.png" mode="" class="img1"></image>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- page: 1,
- size: 10,
- eqlistdata: [],
- isTop:false,
- filtrateTF:false,
- device_status:""
- }
- },
- methods: {
- async eqlist() { //设备列表
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
- data: {
- device_type_id: 2,
- page: this.page,
- size: this.size,
- device_status:this.device_status
- }
- })
- this.eqlistdata = this.eqlistdata.concat(res.data)
- console.log(this.eqlistdata)
- },
- clickLeft() {
- uni.switchTab({
- url: "../index/index"
- })
- },
- clickRight() {
- uni.navigateTo({
- url: "./search"
- })
- },
- eqdetails(data) {
- uni.navigateTo({
- url: "./equipmentdetails?shebei=" + JSON.stringify(data)
- })
- },
- filtrate(){
- this.filtrateTF = !this.filtrateTF
- },
- top() {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 500
- })
- },
- online(){
- this.eqlistdata=[]
- this.page = 1
- this.device_status = 1
- this.eqlist()
- this.filtrateTF = !this.filtrateTF
- },
- offline(){
- this.eqlistdata=[]
- this.page = 1
- this.device_status = 0
- this.eqlist()
- this.filtrateTF = !this.filtrateTF
- },
- complete(){
- this.eqlistdata=[]
- this.page = 1
- this.device_status = ""
- this.eqlist()
- this.filtrateTF = !this.filtrateTF
- }
- },
- onLoad() {
- this.eqlist()
- },
- onReachBottom() {
- this.page++
- this.eqlist()
- },
- onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
- if (e.scrollTop > 200) { //距离大于200时显示
- this.isTop = true
- } else { //距离小于200时隐藏
- this.isTop = false
- }
- }
- }
- </script>
- <style lang="scss">
- /deep/.uni-icons {
- font-size: 40rpx !important;
- }
- .image {
- position: fixed;
- top: 83px;
- width: 100%;
- height: 160rpx;
- z-index: 555;
- }
-
- .bases_search {
- width: 60%;
- background-color: #FFFFFF;
- position: absolute;
- top: 10rpx;
- left: 50%;
- margin-left: -33%;
- .bases_search_text {
- width: 90%;
- margin: 0 auto;
- background-color: #F8F8F8;
- height: 60rpx;
- border-radius: 30rpx;
- display: flex;
- line-height: 60rpx;
-
- .search {
- padding: 0 20rpx;
- font-size: 34rpx;
- }
-
- input {
- width: 80%;
- margin-top: 10rpx;
- font-size: 28rpx;
- }
- }
- }
- .prevents {
- width: 100%;
- position: absolute;
- top: 140px;
- .prevents_item {
- width: 95%;
- margin: 0 auto 30rpx;
- border-radius: 10rpx;
- box-shadow: 0 0 10rpx #bcb9ca;
- padding: 20rpx 40rpx 20rpx 80rpx;
- position: relative;
- box-sizing: border-box;
- .prevents_item_img {
- width: 30rpx;
- height: 50rpx;
- position: absolute;
- top: -4rpx;
- left: 30rpx;
- }
- .prevents_item_top {
- display: flex;
- justify-content: space-between;
- height: 60rpx;
- border-bottom: 2rpx solid #F4F4F4;
- line-height: 60rpx;
- font-size: 26rpx;
- .red {
- color: #ff0000;
- }
- .green {
- color: #7DBB91;
- }
- }
- .prevents_item_bot {
- margin-top: 20rpx;
- font-size: 26rpx;
- color: #BDBDBD;
- }
- }
- }
- .top {
- position: fixed;
- right: 10px;
- bottom: 40px;
- z-index: 100;
- image {
- width: 100rpx;
- height: 100rpx;
- }
- .backtop{
- display: flex;
- justify-content: flex-end;
- margin-bottom: 10rpx;
- }
- .more{
- display: flex;
- }
- .box{
- width: 80rpx;
- height: 80rpx;
- background-color: rgba(161,161,161,0.45);
- border-radius: 50%;
- text-align: center;
- line-height: 80rpx;
- box-sizing: border-box;
- margin: 14rpx 10rpx 0 0;
- color: #fff;
- }
- }
- </style>
|