王飞
2025-03-07 c5e49c10499435802a6551b98772f95660c6f85a
pages/index/equipment.vue
@@ -2,7 +2,7 @@
   <view class="template-job tn-safe-area-inset-bottom tn-skeleton">
      <!-- 顶部自定义导航 -->
      <tn-nav-bar fixed style="position: absolute;z-index: 999999999;">
      <tn-nav-bar fixed :isBack="false" style="position: absolute;z-index: 999999999;">
         <text v-if="isAchor==false" class="title_linespan" style="color: #00aaff;text-decoration: underline;"
            @click="goAchor">基站</text>
         <text v-else class="title_linespan" @click="goAchor">基站</text>
@@ -10,16 +10,17 @@
      </tn-nav-bar>
      <view v-show="lock==false" class="page-wrap u-skeleton">
         <view style="display: flex;width: 50%;left: 5%":style="{display:'flex', top: topheight+'px',position: 'absolute',width: '50%',left: '5%'}">
         <view style="display: flex;width: 50%;left: 5%"
            :style="{display:'flex', top: topheight+'px',position: 'absolute',width: '50%',left: '5%'}">
            <view style="color: #00aaff;">在线:{{online}}</view>
            <view style="color: #00aaff;margin-left: 20px;">离线:{{offline}}</view>
         </view>
         <!-- <u-search class="searchbg" shape="true" bg-color="rgba(255, 255, 255, 0.5)" placeholder="请输入名称" :show-action="false" v-model="keyword" @search="searchxinxi"
                  :style="{top: topheight+'px',position: 'absolute',width: '90%',left: '5%'}"></u-search> -->
         <data-list :width = "width" class="data-list" ref="list" @load="handleLoad" @refresh="handleRefresh"
         <data-list :width="width" class="data-list" ref="list" @load="handleLoad" @refresh="handleRefresh"
            style="margin-top: 100px;">
            <view v-for="(item, index) in list" :key="index">
               <!-- <view class="avatar"></view> -->
@@ -30,8 +31,7 @@
               <view style="display: flex;margin-bottom: 10px;" class="flex flex-direction">
                  <u-badge v-if="item.anchormode==1" style="margin-top: 8px;margin-right: 8px;" :isDot="true"
                     type="success"></u-badge>
                  <u-badge v-else style="margin-top: 8px;margin-right: 8px;" :isDot="true"
                     type="info"></u-badge>
                  <u-badge v-else style="margin-top: 8px;margin-right: 8px;" :isDot="true" type="info"></u-badge>
                  <view>编号:{{item.anchorid}}</view>
                  <view v-if="item.anchormode==1" style="margin-left: 20px;">在线</view>
                  <view v-else style="margin-left: 20px;">离线</view>
@@ -51,17 +51,9 @@
               <u-line style="margin-left: 14px;margin-bottom: 10px;"></u-line>
               <!-- <view style="margin-left: 10px; background-color: rgba(255, 181, 166, 1.0); " >{{item.type}}</view> -->
               <!-- </view> -->
            </view>
         </data-list>
      </view>
      <tn-skeleton :show="showSkeleton"></tn-skeleton>
      <successCom ref="refSuccess"></successCom>
      <!-- <u-empty text="暂未开放" mode="list" style="width: 90%; top: 30%;left: 5%; position: absolute; "></u-empty> -->
@@ -93,7 +85,7 @@
      },
      data() {
         return {
            width:'40%',
            width: '40%',
            online: 0,
            offline: 0,
            isAchor: false,
@@ -142,7 +134,6 @@
         }
      },
      mounted() {
         console.log("打印数据=======》》》》》》》》》");
         this.topheight = this.vuex_custom_bar_height + 15
         setTimeout(() => {
            this.showSkeleton = false
@@ -166,16 +157,10 @@
         goAchor() {
            // this.isAchor = true
            this.lock = false
            console.log(2323323);
         },
         goTag() {
            this.isAchor = false
            this.lock = true
            console.log(2323323);
            // findTag
            // uni.reLaunch({
            //    url: '/pages/index/tag'
            // });
         },
         // 模拟请求加载数据
@@ -185,109 +170,90 @@
               size: data.size,
               company: this.company,
            }
            findAchor(params).then((res) => {
               console.log(res);
               this.online = res.online
               this.offline = res.offline
               if (res.code == 0) {
                  let list = [];
                  setTimeout(() => {
            if (this.vuex_is_login) {
               findAchor(params).then((res) => {
                  this.online = res.online
                  this.offline = res.offline
                  if (res.code == 0) {
                     let list = [];
                     for (var i = 0; i < res.data.records.length; i++) {
                        list.push(res.data.records[i]);
                     }
                     console.log(list);
                     this.list = [...this.list, ...list];
                     callback({
                        list: this.list,
                        total: res.data.total
                     });
                  }, 1500);
               }
            })
                     setTimeout(() => {
                        let list = [];
                        for (var i = 0; i < res.data.records.length; i++) {
                           list.push(res.data.records[i]);
                        }
                        this.list = [...this.list, ...list];
                        callback({
                           list: this.list,
                           total: res.data.total
                        });
                     }, 1500);
                  }
               })
            }else{
               callback({
                  list: [],
                  total: 0
               });
            }
         },
         handleSearch(data, callback) {
            console.log(555555555);
            const params = {
               current: 1,
               size: 10,
               objectid: this.keyword,
               company: this.company,
            }
            findAchor(params).then((res) => {
               console.log(res);
               this.online = res.online
               this.offline = res.offline
               this.list = []
               if (res.code == 0) {
                  let list = [];
                  setTimeout(() => {
            if (this.vuex_is_login) {
               findAchor(params).then((res) => {
                  this.online = res.online
                  this.offline = res.offline
                  this.list = []
                  if (res.code == 0) {
                     let list = [];
                     for (var i = 0; i < res.data.records.length; i++) {
                        list.push(res.data.records[i]);
                     }
                     console.log(list);
                     this.list = [...this.list, ...list];
                     callback({
                        list: this.list,
                        total: res.data.total
                     });
                  }, 1500);
               }
            })
            // let name = this.keyword
            // console.log();
            // findPerson(name).then((res) => {
            //    if (res.code == 0) {
            //       this.perlist = res.data
            //       console.log(this.perlist);
            //    } else {
            //       this.$refs.refSuccess.showBox({
            //          type: 'error',
            //          txt: res.msg
            //       });
            //    }
            // })
                     setTimeout(() => {
                        let list = [];
                        for (var i = 0; i < res.data.records.length; i++) {
                           list.push(res.data.records[i]);
                        }
                        this.list = [...this.list, ...list];
                        callback({
                           list: this.list,
                           total: res.data.total
                        });
                     }, 1500);
                  }
               })
            }
         },
         // 模拟请求数据刷新
         handleRefresh(data, callback) {
            console.log(555555555555555);
            const params = {
               current: data.page,
               size: data.size,
               objectid: data.objectid,
               company: this.company,
            }
            console.log(data);
            findAchor(data).then((res) => {
               this.online = res.online
               this.offline = res.offline
               if (res.code == 0) {
                  let list = [];
                  setTimeout(() => {
            if (this.vuex_is_login) {
               findAchor(params).then((res) => {
                  this.online = res.online
                  this.offline = res.offline
                  if (res.code == 0) {
                     let list = [];
                     for (var i = 0; i < res.data.records.length; i++) {
                        list.push(res.data.records[i]);
                     }
                     console.log(list);
                     this.list = []
                     this.list = [...this.list, ...list];
                     console.log(this.list);
                     callback({
                        list: this.list,
                        total: res.data.total
                     });
                  }, 1500);
               }
            })
            // console.log(2222222222);
            // setTimeout(() => {
            //    this.list = [];
            //    for (var i = 0; i < 3; i++) {
            //       this.list.push(i);
            //    }
            //    callback({ list: this.list, total: 30 });
            // }, 1500);
                     setTimeout(() => {
                        let list = [];
                        for (var i = 0; i < res.data.records.length; i++) {
                           list.push(res.data.records[i]);
                        }
                        this.list = []
                        this.list = [...this.list, ...list];
                        callback({
                           list: this.list,
                           total: res.data.total
                        });
                     }, 1500);
                  }
               })
            }
         },
      }
   }