xiaohaizhao 1 rok pred
rodič
commit
5c53d2b9e8

+ 36 - 31
pages/facility/index.vue

@@ -73,6 +73,7 @@ export default {
     },
     onLoad(options) {
         this.getlist();
+        this.$Http.updateFacilityList = this.getlist.bind(this);
         setTimeout(() => this.loadElement(), 100)
     },
     methods: {
@@ -95,38 +96,42 @@ export default {
             if (page.uninitialized || forcedUpdating) page.init();
         },
         getlist() {
-            this.$Http.basic({
-                "id": 20230711144102,
-                "content": {
-                    "pageNumber": 1,
-                    "pageSize": 99999,
-                    where: this.where
-                }
-            }).then(res => {
-                console.log("设备列表", res)
-                if (this.cutoff(res.msg)) return;
-                this.empty = res.data.length == 0;
-                this.$refs.Search.onFinish();
-                this.markers = res.data.filter(v => v.latitude).map(v => {
-                    v.id = v.w_deviceid - 0;
-                    v.title = v.devicename;
-                    if (this.usePort == 'h5') v.iconPath = require("../../static/img/location.png");
-                    v.customCallout = { display: 'BYCLICK', anchorY: -10 }
-                    return v
-                });
-                this.list = res.data.map(v => {
-                    switch (v.status) {
-                        case '在线':
-                            v.bgColor = "#3C9CFF";
-                            break;
-                        case '禁用':
-                            v.bgColor = "#F56C6C";
-                            break;
-                        default:
-                            v.bgColor = "#F9AE3D";
-                            break;
+            return new Promise((resolve) => {
+                this.$Http.basic({
+                    "id": 20230711144102,
+                    "content": {
+                        nocache: true,
+                        "pageNumber": 1,
+                        "pageSize": 99999,
+                        where: this.where
                     }
-                    return v
+                }).then(res => {
+                    console.log("11设备列表", res)
+                    if (this.cutoff(res.msg)) return;
+                    resolve(res.msg == '成功')
+                    this.empty = res.data.length == 0;
+                    this.$refs.Search.onFinish();
+                    this.markers = res.data.filter(v => v.latitude).map(v => {
+                        v.id = v.w_deviceid - 0;
+                        v.title = v.devicename;
+                        if (this.usePort == 'h5') v.iconPath = require("../../static/img/location.png");
+                        v.customCallout = { display: 'BYCLICK', anchorY: -10 }
+                        return v
+                    });
+                    this.list = res.data.map(v => {
+                        switch (v.status) {
+                            case '在线':
+                                v.bgColor = "#3C9CFF";
+                                break;
+                            case '禁用':
+                                v.bgColor = "#F56C6C";
+                                break;
+                            default:
+                                v.bgColor = "#F9AE3D";
+                                break;
+                        }
+                        return v
+                    })
                 })
             })
         },

+ 10 - 2
pages/facility/list.vue

@@ -1,6 +1,6 @@
 <template>
     <view>
-        <My_listbox ref="List" :pullDown="false" :empty='empty'>
+        <My_listbox ref="List" :empty='empty' @getlist="getlist">
             <navigator v-for="item in list" :key="item.w_deviceid" class="item"
                 :url="'/pages/facility/detail?id=' + item.w_deviceid">
                 <view class="name u-line-1">设备:{{ item.devicename || ' --' }}</view>
@@ -16,6 +16,7 @@
     </view>
 </template>
 <script>
+
 export default {
     props: {
         list: Array,
@@ -31,7 +32,14 @@ export default {
         init() {
             this.uninitialized = false;
             this.$refs.List.setHeight();
-        }
+        },
+        getlist() {
+            if (this.$Http.updateFacilityList) {
+                this.$Http.updateFacilityList().then(res => this.$refs.List.RefreshToComplete())
+            } else {
+                this.$refs.List.RefreshToComplete();
+            }
+        },
     }
 }
 </script>

+ 4 - 5
pages/facility/modules/control.vue

@@ -17,7 +17,7 @@ export default {
     name: "control",
     props: {
         detail: Object,
-		onUpdate:Function
+        onUpdate: Function
     },
     data() {
         return {
@@ -73,10 +73,9 @@ export default {
                             content: '设备控制参数已更新',
                             showCancel: false,
                         }) */
-						this.$emit("onUpdate",true)
-                    }else{
-						console.log("设备未更新")
-					}
+                        this.$emit("onUpdate", true);
+                        this.$Http.updateFacilityList && this.$Http.updateFacilityList();
+                    }
                 })
             }, 5000);
         }