Procházet zdrojové kódy

Merge branch 'master' of http://git.ringzle.com:3000/lmc/witcarbon-app

lmc před 1 rokem
rodič
revize
28fb09b2d5
1 změnil soubory, kde provedl 43 přidání a 36 odebrání
  1. 43 36
      src/views/remoteControl.vue

+ 43 - 36
src/views/remoteControl.vue

@@ -72,7 +72,7 @@
     </div>
     <div class="check_info">
       <div class="info_list">
-        <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+        <!-- <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> -->
           <van-list
             v-model:loading="loading"
             :finished="finished"
@@ -174,7 +174,7 @@
                 </van-row>
               </template>
               <template v-if="deviceType == 'Ammeter'">
-                <div
+                <!-- <div
                   v-if="item.attributeList"
                   class="reduce_type"
                   :style="{
@@ -186,7 +186,7 @@
                   <span>{{
                     `${deviceStatus_filter(item.status)["label"]}`
                   }}</span>
-                </div>
+                </div> -->
                 <span class="header">{{ item.controlName }}</span>
                 <span>空间信息:{{ item.installSite }}</span>
                 <!-- <span>设备编号:{{ item.deviceId }}</span>
@@ -203,7 +203,7 @@
               </template>
             </div>
           </van-list>
-        </van-pull-refresh>
+        <!-- </van-pull-refresh> -->
       </div>
     </div>
     <van-popup v-model:show="showRepairPositionPicker" round position="bottom">
@@ -273,6 +273,7 @@ export default {
     const storeyId=ref('');
     const buildingId=ref('');
     const positionList = ref([]); //定位
+    const page=ref('1');
 
     function ms(data) {
       let text = "";
@@ -295,6 +296,7 @@ export default {
       return text;
     }
     return {
+      page,
       module,
       deviceId,
       controlList,
@@ -334,7 +336,7 @@ export default {
         { text: "连接中", value: 1 },
         { text: "断连中", value: 0 },
       ],
-      total: 3,
+      total:0,
       list: [],
       loading: false,
       refreshing: false,
@@ -359,19 +361,16 @@ export default {
   created() {
     this.getBuildList();
     this.setwendu();
-    this.getAircond();
+    //this.getAircond();
   },
   methods: {
     //定位完成
     confirmPosition(val) {
-      console.log(val);
       this.buildingId=val[0].orgId;
       this.storeyId=val[1].orgId;
       let storeyName=val[1].orgName=='全部'?'':val[1].orgName+'-';
       this.name="电商园四期-"+val[0].orgName+storeyName;
       this.showRepairPositionPicker=false;
-      console.log(this.buildingId);
-      console.log(this.storeyId);
     },
     //继电器下发指令开关
     changeElecSwitch(val, deviceId) {
@@ -480,19 +479,28 @@ export default {
         });
     },
     getElec() {
+      console.log(this.page)
       api
         .getElec({
           buildingId:this.buildingId,
           storeyId:this.storeyId,
-          page: 1,
+          page:this.page,
           limit: 10,
           status: this.deviceStatus,
           controlCategory: "CommonLighting",
         })
         .then((res) => {
+          console.log(res)
           if (res.code == 0) {
             this.total = res.data.total;
-            this.list = res.data.list;
+            this.list=this.list.concat(res.data.list);
+            this.loading = false;
+            if( res.data.list.length<10){
+              this.finished=true;
+            }else{
+              this.page++;
+            }
+            console.log(this.list)
             // for(let i=0;i<res.data.list.length;i++){
             //   if(res.data.list[i].attributeList&&res.data.list[i].attributeList.length!=0){
             //     this.list.push(res.data.list[i])
@@ -504,7 +512,7 @@ export default {
     getAircond() {
       api
         .airconditioner({
-          page: 1,
+          page:this.page,
           limit: 10,
           buildingId:this.buildingId,
           storeyId:this.storeyId,
@@ -512,7 +520,6 @@ export default {
         .then((res) => {
           if (res.code == 0) {
             this.total = res.data.total;
-            this.list = [];
             for (let i = 0; i < res.data.list.length; i++) {
               if (
                 res.data.list[i].attributeList &&
@@ -521,8 +528,13 @@ export default {
                 this.list.push(res.data.list[i]);
               }
             }
+            if( res.data.list.length<10){
+              this.finished=true;
+            }else{
+              this.page++;
+            }
+            this.loading = false;
           }
-          console.log(this.list);
         });
     },
     deviceStatus_filter(val) {
@@ -564,33 +576,28 @@ export default {
       });
     },
     onLoad() {
-      setTimeout(() => {
-        if (this.refreshing) {
-          this.list = [];
-          this.refreshing = false;
-        }
-        for (let i = 0; i < 10; i++) {
-          this.list.push(this.list.length + 1);
-        }
-        this.loading = false;
-
-        if (this.list.length >= 40) {
-          this.finished = true;
-        }
-      }, 1000);
-    },
-    onRefresh() {
-      // 清空列表数据
-      this.finished = false;
-
-      // 重新加载数据
-      // 将 loading 设置为 true,表示处于加载状态
       this.loading = true;
-      this.onLoad();
+      if(this.deviceType=='AirConditioner'){
+        this.getAircond()
+      }else{
+         this.getElec();
+      }
     },
+    // onRefresh() {
+    //  // 清空列表数据
+    //   finished.value = false;
+    //   // 重新加载数据
+    //   // 将 loading 设置为 true,表示处于加载状态
+    //   loading.value = true;
+    //   this.onLoad();
+    // },
     // change事件可以拿到的是value
     handelChange(type, lackTypeTitle, lackTypeList, val) {
       this[type] = val;
+      console.log(this.deviceType)
+      this.list=[];
+      this.page=1;
+      this.finished=true;
       if (this.deviceType == "Ammeter") this.getElec();
       if (this.deviceType == "AirConditioner") this.getAircond();
       // 显示中文名字