yunxing 4 年之前
父节点
当前提交
e5896c7ec5
共有 2 个文件被更改,包括 33 次插入16 次删除
  1. 32 15
      src/views/equipmentFacilities/LowVoltageCabinet.vue
  2. 1 1
      src/views/equipmentFacilities/index.vue

+ 32 - 15
src/views/equipmentFacilities/LowVoltageCabinet.vue

@@ -12,7 +12,14 @@
         </div>
         <!-- 配电室 -->
         <!-- 一个van-list内再嵌套一个van-list,处理较为复杂 -->
-        <van-list class='switch-room-container' v-model='loading' :finished='finished' @load='onLoad' finished-text='没有更多了' v-if='1'>
+        <van-list
+            class='switch-room-container'
+            :class='{"one-list":list.length === 1}'
+            v-model='loading'
+            :finished='finished'
+            @load='onLoad'
+            finished-text
+        >
             <div class='switch-room' v-for='(item,index) in list' :key='index'>
                 <div class='title'>{{item.wzjc}}</div>
                 <!-- 一个低压柜信息 -->
@@ -184,6 +191,7 @@ export default {
     created() {
         // 查询筛选条件(右弹窗)
         this.getFilterList()
+        // this.onLoad()
     },
     beforeMount() {},
     mounted() {},
@@ -195,13 +203,17 @@ export default {
          *
          */
         async onLoad() {
+            console.log('onLoad')
             if (this.page > 1) {
                 await sleep(1000)
             }
             await this.getList()
             // list无数据,不执行后续分页查询
+            console.log(this.list)
+            console.log(this.count)
             if (!this.list.length) {
                 this.finished = true
+                this.loading = false
                 return true
             }
             this.page++
@@ -214,16 +226,6 @@ export default {
          * 查询低压柜list
          */
         async getList() {
-            // 请求地址 POST /data/sms_dygjcxline/queryDygjcxline?plazaId=1000772&page=1&size=10&keyword=123:drawernum,outspec
-            // 参数说明
-            // {
-            //     "locfl": 1003,//分类内码
-            //     "locflList": [],//分类内码
-            //     "pageable:{    //低压出线柜条数
-            //        "pageNumber":1,
-            //        "pageSize":50
-            //      }
-            // }
             let queryData = {
                 data: {
                     page: this.page,
@@ -259,7 +261,8 @@ export default {
                 return false
             }
             res.data.data.map((item, index, arr) => {
-                if (item?.count > 5) {
+                console.log(item)
+                if (item?.count > 5 || item?.data.length >= 5) {
                     // console.log(item)
                     arr[index] = {
                         ...item,
@@ -347,8 +350,14 @@ export default {
                 console.log(error)
             }
             // mockData
-            res = require('./mockData').queryDygjcxlineData1
-            currentList.list = [...currentList.list, ...res.data[0].data]
+            // res = require('./mockData').queryDygjcxlineData1
+            console.log('=============')
+            console.log(res)
+            console.log('=============')
+            if (!res?.data?.data[0]?.data) {
+                return false
+            }
+            currentList.list = [...currentList.list, ...res.data.data[0].data]
             this.$set(this.list, index, currentList)
             console.log('====================')
             console.log(this.list)
@@ -448,7 +457,8 @@ export default {
          *  初始化数据,查询列表
          */
         initData() {
-            this.finished = false
+            // this.finished = false
+            // this.loading = false
             this.page = 1
             this.count = 0
             this.list = []
@@ -572,6 +582,13 @@ export default {
             }
         }
     }
+    // 只有一个出线柜时,样式
+    .one-list {
+        height: calc(100% - 100px) !important;
+        .switch-room {
+            height: 100% !important;
+        }
+    }
     // 空状态
     .m-empty {
         // position: fixed;

+ 1 - 1
src/views/equipmentFacilities/index.vue

@@ -499,7 +499,7 @@ export default {
             let currentSystem = this.listData[this.smsxt]
             let fbt = currentSystem.filter((v) => v.dataType === 'fbt')[0]
             if (!fbt || fbt.count === '无') {
-                // return false
+                return false
             }
             const { categoryId, text } = item
             this.SETCATEGORYID(categoryId)