瀏覽代碼

扫到二维码,跳转设备详情页

yunxing 4 年之前
父節點
當前提交
6247786876
共有 2 個文件被更改,包括 18 次插入8 次删除
  1. 9 2
      src/components/Navbar.vue
  2. 9 6
      src/views/equipmentFacilities/LowVoltageCabinet.vue

+ 9 - 2
src/components/Navbar.vue

@@ -26,7 +26,7 @@ window.__scanCallback = function (data) {
         // 扫描的⾮设备⼆维码
         case 0:
         case '0':
-            Toast('扫描的⾮设备⼆维码')
+            // Toast('扫描的⾮设备⼆维码')
             store.commit('SCANASSETID', null)
             break
         // 扫码的是设备二维码
@@ -55,7 +55,14 @@ export default {
     computed: {
         ...mapGetters(['appTitle', 'scanAssetid']),
     },
-    watch: {},
+    watch: {
+        // 扫到二维码,跳转设备详情页
+        scanAssetid(newV, oldV) {
+            if (newV) {
+                this.$router.push({ name: 'AssetDetail', query: { assetid: newV } })
+            }
+        },
+    },
     beforeMount() {},
     mounted() {},
     methods: {

+ 9 - 6
src/views/equipmentFacilities/LowVoltageCabinet.vue

@@ -61,7 +61,7 @@
                     </div>
                     <van-list
                         v-model='item.loading'
-                        v-show='!item.loadMore && item.list.length'
+                        v-show='!item.loadMore && item.list && item.list.length'
                         :finished='item.finished'
                         :immediate-check='false'
                         @load='locationOnLoad(item,index)'
@@ -231,8 +231,8 @@ export default {
                     plazaId: this.plazaId,
                 },
                 postParams: {
-                    locflList: ['5201', '5204', '5209'], //低压柜
                     // location: '',
+                    locflList: ['5201', '5204', '5209'], //低压柜
                     pageable: {
                         pageNumber: 1,
                         pageSize: this.innerSize,
@@ -254,8 +254,11 @@ export default {
                 console.log(error)
             }
             // mockData
-            res = require('./mockData').queryDygjcxlineData
-            res.data.map((item, index, arr) => {
+            // res = require('./mockData').queryDygjcxlineData
+            if (!res?.data?.data) {
+                return false
+            }
+            res.data.data.map((item, index, arr) => {
                 if (item?.count > 5) {
                     // console.log(item)
                     arr[index] = {
@@ -271,8 +274,8 @@ export default {
                     item.loadMore = false
                 }
             })
-            this.list = [...this.list, ...res.data]
-            this.count = res.count
+            this.list = [...this.list, ...res.data.data]
+            this.count = res.data.count
         },
 
         /**