Pārlūkot izejas kodu

修改APP端分页问题

coys 1 gadu atpakaļ
vecāks
revīzija
07f7ea677c

+ 29 - 18
src/views/menu/monitoringCall/index.vue

@@ -56,7 +56,13 @@
     </van-row>
     <!-- 调阅列表 -->
     <div class="bigbox">
-      <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
+      <van-list
+        v-model="loading"
+        :immediate-check="false"
+        :finished="finished"
+        finished-text="没有更多了"
+        @load="onLoad"
+      >
         <van-cell-group>
           <van-cell
             @click.stop="linkHandler(item.status, item.id, item)"
@@ -68,8 +74,8 @@
             :is-link="item.status != 3"
           >
             <template #title>
-              <span class="custom-title"
-                >{{ item.taskName
+              <span class="custom-title">
+                {{ item.taskName
                 }}<van-tag class="resetDy" @click.stop="resetHandler(item.id)" v-if="item.status == 1" type="primary"
                   >重新调阅</van-tag
                 ></span
@@ -154,15 +160,14 @@ export default {
       return str
     }
   },
-  created() {
-    this.presentDate = this.presentDateCpd
-  },
+
   computed: {
     presentDateCpd() {
       return new Date(+newDateMonth().split('-')[0], +newDateMonth().split('-')[1] - 1)
     }
   },
   created() {
+    this.presentDate = this.presentDateCpd
     this.init()
   },
   mounted() {
@@ -222,11 +227,9 @@ export default {
         this.pageNum = 2
       }
       this.loading = true
-
       this.selectListAppHandler(1, () => {
         this.pageNum++
         this.loading = false
-       
       })
     },
     //清空查询条件
@@ -256,8 +259,9 @@ export default {
     selectListAppHandler(type = 0, callBack = () => {}) {
       if (!type) {
         this.pageNum = 1
+        this.taskList = []
       }
-      
+
       //获取任务列表
       selectListApp({
         pageNum: this.pageNum,
@@ -270,22 +274,29 @@ export default {
         if (code == 200) {
           if (type) {
             this.taskList.push(...rows)
-            if (rows.length == 0 || rows.length < 10) {
+
+            if (this.taskList.length >= total) {
               //已加载完全部数据
               this.finished = true
-            } 
-            callBack()
-            
+            } else {
+              callBack()
+            }
           } else {
+            
+            this.taskList.push(...rows)
             this.finished = false
-            this.taskList = rows || []
-            if (rows.length == 0) {
-              this.taskList = []
+            this.loading = false
+            if (this.taskList.length >= total) {
+              //已加载完全部数据
+              this.finished = true
             }
+            
+
+            // this.taskList = rows || []
           }
         } else {
-          this.finished = true
-          this.taskList = []
+          // this.finished = true
+          // this.taskList = []
         }
       })
     },

+ 23 - 16
src/views/menu/rehearsalTask/index.vue

@@ -96,11 +96,10 @@
             </div>
             <div class="mainItem" @click="goInfo(item.id)">
               <div>演练状态</div>
-              <div class="wj-title-blue" v-if="item.status == 0||item.status == 5" >{{ item.statusText }}</div>
-              <div class="wj-title-orange" v-else-if="item.status == 1||item.status == 2" >{{ item.statusText }}</div>
-              <div class="wj-title-green" v-else-if="item.status == 3" >{{ item.statusText }}</div>
-              <div class="wj-title-red" v-else-if="item.status == 4" >{{ item.statusText }}</div>
-              
+              <div class="wj-title-blue" v-if="item.status == 0 || item.status == 5">{{ item.statusText }}</div>
+              <div class="wj-title-orange" v-else-if="item.status == 1 || item.status == 2">{{ item.statusText }}</div>
+              <div class="wj-title-green" v-else-if="item.status == 3">{{ item.statusText }}</div>
+              <div class="wj-title-red" v-else-if="item.status == 4">{{ item.statusText }}</div>
             </div>
             <div class="mainItem" @click="goInfo(item.id)">
               <div>演练项目</div>
@@ -108,7 +107,9 @@
             </div>
             <div class="mainItem" @click="goInfo(item.id)">
               <div>演练时间</div>
-              <div v-if="item.drillStartTime&&item.drillEndTime">{{ item.drillStartTime }}-{{item.drillEndTime }}</div>
+              <div v-if="item.drillStartTime && item.drillEndTime">
+                {{ item.drillStartTime }}-{{ item.drillEndTime }}
+              </div>
             </div>
             <div class="mainItem">
               <div>签名情况</div>
@@ -248,7 +249,7 @@ export default {
           console.log(list.id, 'ssss')
           timefalg = true
         }
-        if(!list.planId){
+        if (!list.planId) {
           timefalg = true
         }
       }
@@ -326,6 +327,7 @@ export default {
       if (!type) {
         obj.pageNum = 1
         this.pageNum = 1
+        this.taskList = []
       }
       if (this.statusValue) {
         obj.status = this.statusValue
@@ -334,7 +336,7 @@ export default {
       obj.orgId = this.cascaderValue || JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + '' || ''
 
       if (this.currentDate) {
-        obj.date = this.currentDate +'-'+'01'
+        obj.date = this.currentDate + '-' + '01'
       }
       if (this.typeValue) {
         obj.type = this.typeValue
@@ -342,21 +344,27 @@ export default {
 
       //获取任务列表
       getdrillTask(obj).then(res => {
-        let { code, rows, msg } = res
+        let { code, rows, total } = res
         if (code == 200) {
           if (type) {
             this.taskList.push(...rows)
-            if (rows.length == 0 || rows.length < 10) {
+
+            if (this.taskList.length >= total) {
               //已加载完全部数据
               this.finished = true
+            } else {
+              callback()
             }
-            callback()
           } else {
+            this.taskList.push(...rows)
             this.finished = false
-            this.taskList=rows||[]
-            if(rows.length == 0){
-              this.taskList=[]
+            this.loading = false
+            if (this.taskList.length >= total) {
+              //已加载完全部数据
+              this.finished = true
             }
+
+            // this.taskList = rows || []
           }
         } else {
           this.finished = true
@@ -413,7 +421,7 @@ export default {
       m = m < 10 ? '0' + m : m
       var d = date.getDate()
       d = d < 10 ? '0' + d : d
-      return y+'-'+m
+      return y + '-' + m
     },
     //日期格式
     formatDate(date) {
@@ -429,7 +437,6 @@ export default {
       this.selectListAppHandler(1, () => {
         this.pageNum++
         this.loading = false
-        
       })
     },
     //查看签名情况

+ 23 - 21
src/views/menu/rehearsalTask/learning.vue

@@ -60,9 +60,7 @@
           </van-popup>
         </van-col>
       </van-row>
-      <van-row>
-        
-      </van-row>
+      <van-row> </van-row>
       <van-row>
         <van-col span="24">
           <van-tabs v-model="activeAl" @click="tbsAlHandler">
@@ -165,14 +163,12 @@ export default {
   created() {
     this.presentDate = new Date(newDateMonth())
     this.presentEndDate = new Date(newDateMonth())
-    
   },
   mounted() {
     this.init()
     this.cascaderValue = JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + ''
   },
   methods: {
- 
     //机构搜索
     getDataList(val) {
       this.cascaderValue = val.id
@@ -199,20 +195,21 @@ export default {
       if (!type) {
         obj.pageNum = 1
         this.pageNum = 1
+        this.taskList = []
       }
       // if (this.statusValue) {
       //   obj.status = this.statusValue
       // }
 
       obj.orgId = this.cascaderValue || JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + '' || ''
-        if(!this.currentDate||!this.endDate){
-         return Toast('请选择一个月份范围')
-        }
+      if (!this.currentDate || !this.endDate) {
+        return Toast('请选择一个月份范围')
+      }
       if (this.currentDate) {
-        obj.startTime = this.currentDate+'-'+'01'
+        obj.startTime = this.currentDate + '-' + '01'
       }
       if (this.endDate) {
-        obj.endTime = this.endDate+'-'+'01'
+        obj.endTime = this.endDate + '-' + '01'
       }
       if (this.activeAl) {
         obj.recStatus = this.activeAl
@@ -220,21 +217,27 @@ export default {
 
       //获取任务列表
       getRecTaskList(obj).then(res => {
-        let { code, rows, msg } = res
+        let { code, rows, total } = res
         if (code == 200) {
           if (type) {
             this.taskList.push(...rows)
-            if (rows.length == 0 || rows.length < 10) {
+
+            if (this.taskList.length >= total) {
               //已加载完全部数据
               this.finished = true
+            } else {
+              callback()
             }
-            callback()
           } else {
+            this.taskList.push(...rows)
             this.finished = false
-            this.taskList = rows || []
-            if (rows.length == 0) {
-              this.taskList = []
+            this.loading = false
+            if (this.taskList.length >= total) {
+              //已加载完全部数据
+              this.finished = true
             }
+
+            // this.taskList = rows || []
           }
         } else {
           this.finished = true
@@ -248,7 +251,7 @@ export default {
     },
     //年份选中触发
     onDateConfirm(val) {
-      if(this.newDate(val + '')>this.endDate){
+      if (this.newDate(val + '') > this.endDate) {
         return Toast('开始月份不能大于结束月份')
       }
       this.currentDate = this.newDate(val + '')
@@ -257,12 +260,12 @@ export default {
     },
     //年份选中触发
     onEndDateConfirm(val) {
-      if(this.newDate(val + '')<this.currentDate){
+      if (this.newDate(val + '') < this.currentDate) {
         return Toast('结束月份不能小于开始月份')
       }
       this.endDate = this.newDate(val + '')
-      
-      console.log(this.endDate);
+
+      console.log(this.endDate)
       this.endShowDate = false
       this.selectListAppHandler()
     },
@@ -289,7 +292,6 @@ export default {
       this.selectListAppHandler(1, () => {
         this.pageNum++
         this.loading = false
-        
       })
     },
 

+ 13 - 6
src/views/menu/rehearsalTask/optimal.vue

@@ -299,6 +299,7 @@ export default {
       if (!type) {
         obj.pageNum = 1
         this.pageNum = 1
+        this.taskList = []
       }
       if (this.statusValue) {
         obj.recStatus = this.statusValue
@@ -315,21 +316,27 @@ export default {
 
       //获取任务列表
       getlearningListPage(obj).then(res => {
-        let { code, rows, msg } = res
+        let { code, rows, total } = res
         if (code == 200) {
           if (type) {
             this.taskList.push(...rows)
-            if (rows.length == 0 || rows.length < 10) {
+
+            if (this.taskList.length >= total) {
               //已加载完全部数据
               this.finished = true
+            } else {
+              callback()
             }
-            callback()
           } else {
+            this.taskList.push(...rows)
             this.finished = false
-            this.taskList=rows||[]
-            if(rows.length == 0){
-              this.taskList=[]
+            this.loading = false
+            if (this.taskList.length >= total) {
+              //已加载完全部数据
+              this.finished = true
             }
+
+            // this.taskList = rows || []
           }
         }else{
           this.finished = true

+ 20 - 17
src/views/menu/resumptionEvaluate/index.vue

@@ -87,7 +87,7 @@
           <div>
             <div class="mainItem" @click="goInfo(item.id)">
               <div>评价状态</div>
-              <div v-if="item.status=='0'" class="wj-title-blue">{{ item.status | statusList(this_) }}</div>
+              <div v-if="item.status == '0'" class="wj-title-blue">{{ item.status | statusList(this_) }}</div>
               <div v-else class="wj-title-orange">{{ item.status | statusList(this_) }}</div>
             </div>
             <div class="mainItem" @click="goInfo(item.id)">
@@ -118,7 +118,7 @@ export default {
       loading: false, //加载状态
       finished: false, //是否全部加载完毕
       evaluateName: '',
-      this_:this,
+      this_: this,
       orgName: JSON.parse(sessionStorage.getItem('SET_USER_ORGNAME')) || '', //机构名称
       cascaderValue: '', //机构ID
       show: false, //机构弹框显示隐藏
@@ -162,16 +162,14 @@ export default {
     this.cascaderValue = JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + ''
   },
   filters: {
-    statusList(val,this_) {
-      
-      if (this_.columnsList&&this_.columnsList.length>0&&val) {
-        let list =this_.columnsList.filter(item => item.dictValue == val)
-        if(list&&list.length>0 ){
+    statusList(val, this_) {
+      if (this_.columnsList && this_.columnsList.length > 0 && val) {
+        let list = this_.columnsList.filter(item => item.dictValue == val)
+        if (list && list.length > 0) {
           return list[0].dictLabel
-        }else{
+        } else {
           return ''
         }
-         
       } else {
         return ''
       }
@@ -212,6 +210,7 @@ export default {
       }
       if (!type) {
         obj.pageNum = 1
+        this.taskList = []
         this.pageNum = 1
       }
       if (this.statusValue) {
@@ -226,21 +225,27 @@ export default {
 
       //获取任务列表
       getEvaluatePage(obj).then(res => {
-        let { code, rows, msg } = res
+        let { code, rows, total } = res
         if (code == 200) {
           if (type) {
             this.taskList.push(...rows)
-            if (rows.length == 0 || rows.length < 10) {
+
+            if (this.taskList.length >= total) {
               //已加载完全部数据
               this.finished = true
+            } else {
+              callback()
             }
-            callback()
           } else {
+            this.taskList.push(...rows)
             this.finished = false
-            this.taskList=rows||[]
-            if(rows.length == 0){
-              this.taskList=[]
+            this.loading = false
+            if (this.taskList.length >= total) {
+              //已加载完全部数据
+              this.finished = true
             }
+
+            // this.taskList = rows || []
           }
         } else {
           this.finished = true
@@ -292,7 +297,6 @@ export default {
       this.selectListAppHandler(1, () => {
         this.pageNum++
         this.loading = false
-        console.log(1)
       })
     },
 
@@ -385,5 +389,4 @@ export default {
   color: #323233;
   -webkit-text-fill-color: #323233;
 }
-
 </style>

+ 13 - 7
src/views/menu/training/index.vue

@@ -312,6 +312,7 @@ export default {
       if (!type) {
         obj.pageNum = 1
         this.pageNum = 1
+        this.taskList = []
       }
       if (this.statusValue) {
         obj.status = this.statusValue
@@ -328,22 +329,27 @@ export default {
 
       //获取任务列表
       gettrainingList(obj).then(res => {
-        let { code, rows, msg } = res
+        let { code, rows, msg,total } = res
         if (code == 200) {
           if (type) {
             this.taskList.push(...rows)
-            if (rows.length == 0 || rows.length < 10) {
+
+            if (this.taskList.length >= total) {
               //已加载完全部数据
               this.finished = true
+            } else {
+              callback()
             }
-
-            callback()
           } else {
+            this.taskList.push(...rows)
             this.finished = false
-            this.taskList = rows || []
-            if (rows.length == 0) {
-              this.taskList = []
+            this.loading = false
+            if (this.taskList.length >= total) {
+              //已加载完全部数据
+              this.finished = true
             }
+
+            // this.taskList = rows || []
           }
         } else {
           this.finished = true