From 5f2ee03958a1a16dc27195c76ea7cffb422c95d1 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期五, 19 十二月 2025 22:40:34 +0800
Subject: [PATCH] feat: 任务修改接口,删除一些不要的字段同步

---
 app/pages/task/index.vue |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 116 insertions(+), 4 deletions(-)

diff --git a/app/pages/task/index.vue b/app/pages/task/index.vue
index c1b7a0d..36fdbb6 100644
--- a/app/pages/task/index.vue
+++ b/app/pages/task/index.vue
@@ -112,7 +112,10 @@
             <view class="task-main" @click="viewTaskDetail(task)">
               <!-- 浠诲姟澶撮儴锛氭爣棰樺拰鐘舵�佹爣绛� -->
               <view class="task-header">
-                <view class="task-title">{{ getTaskTypeText(task.taskType) }} - {{ task.vehicle }}</view>
+                <view class="task-title">
+                  {{ getTaskTypeText(task.taskType) }} - {{ task.vehicle }}
+                  <text v-if="task.isHeadPush === '1'" class="head-push-tag">鎬�</text>
+                </view>
                 <view class="task-status" :class="task.taskStatus === 'PENDING' ? 'status-pending' : task.taskStatus === 'DEPARTING' ? 'status-departing' : task.taskStatus === 'ARRIVED' ? 'status-arrived' : task.taskStatus === 'RETURNING' ? 'status-returning' : task.taskStatus === 'COMPLETED' ? 'status-completed' : task.taskStatus === 'CANCELLED' ? 'status-cancelled' : task.taskStatus === 'IN_PROGRESS' ? 'status-in-progress' : 'status-default'">
                   {{ getStatusText(task.taskStatus) }}
                 </view>
@@ -210,6 +213,14 @@
             <uni-icons type="info" size="40" color="#ccc"></uni-icons>
             <text>鏆傛棤浠诲姟鏁版嵁</text>
           </view>
+          <!-- 鍔犺浇鏇村鎻愮ず -->
+          <view class="load-more" v-if="filteredTaskList.length > 0 && hasMore">
+            <uni-icons type="spinner-cycle" size="20" color="#999"></uni-icons>
+            <text>姝e湪鍔犺浇鏇村鏁版嵁...</text>
+          </view>
+          <view class="load-more no-more" v-else-if="filteredTaskList.length > 0 && !hasMore">
+            <text>娌℃湁鏇村鏁版嵁浜�</text>
+          </view>
         </view>
       </scroll-view>
     </view>
@@ -248,7 +259,13 @@
         // 浠诲姟鍒楄〃
         taskList: [],
         loading: false,
-        refreshing: false
+        refreshing: false,
+        
+        // 鍒嗛〉鐩稿叧
+        currentPage: 1,
+        pageSize: 10,
+        total: 0,
+        hasMore: true
       }
     },
     computed: {
@@ -339,6 +356,12 @@
     onPullDownRefresh() {
       this.refreshList()
     },
+    // 鐩戝惉婊氬姩鍒板簳閮ㄤ簨浠�
+    onReachBottom() {
+      if (this.hasMore && !this.loading) {
+        this.loadMore()
+      }
+    },
     methods: {
       // 澶勭悊鍒锋柊浜嬩欢
       handleRefreshEvent() {
@@ -349,16 +372,27 @@
       // 鍔犺浇浠诲姟鍒楄〃
       loadTaskList() {
         this.loading = true
+        // 閲嶇疆鍒嗛〉鍙傛暟
+        this.currentPage = 1
+        this.hasMore = true
+        this.taskList = []
+        
         // 鍚庣浼氳嚜鍔ㄨ幏鍙栧綋鍓嶇敤鎴蜂俊鎭紝瀹炵幇缁煎悎鏌ヨ
         // 缁煎悎鏌ヨ锛氬綋鍓嶇敤鎴锋墍鍦ㄦ満鏋勪换鍔� + 褰撳墠鐢ㄦ埛鍒涘缓鐨勪换鍔� + 鍒嗛厤缁欏綋鍓嶇敤鎴风殑浠诲姟
         const queryParams = {
-          pageNum: 1,
-          pageSize: 100
+          pageNum: this.currentPage,
+          pageSize: this.pageSize,
+          orderByColumn: 'create_time',
+          isAsc: 'desc'
         }
         
         listTask(queryParams).then(response => {
           this.loading = false
           const data = response.data || response.rows || []
+          // 璁剧疆鎬绘暟鍜屾槸鍚︽湁鏇村鏁版嵁
+          this.total = response.total || data.length || 0
+          this.hasMore = data.length === this.pageSize
+          
           this.taskList = data.map(task => {
             // 浠巃ssignedVehicles鏁扮粍涓幏鍙栬溅杈嗕俊鎭�
             let vehicleInfo = '鏈垎閰嶈溅杈�'
@@ -386,6 +420,60 @@
           this.loading = false
           console.error('鍔犺浇浠诲姟鍒楄〃澶辫触:', error)
           this.$modal.showToast('鍔犺浇浠诲姟鍒楄〃澶辫触')
+        })
+      },
+      
+      // 鍔犺浇鏇村鏁版嵁
+      loadMore() {
+        if (!this.hasMore || this.loading) return
+        
+        this.loading = true
+        this.currentPage++
+        
+        const queryParams = {
+          pageNum: this.currentPage,
+          pageSize: this.pageSize,
+          orderByColumn: 'create_time',
+          isAsc: 'desc'
+        }
+        
+        listTask(queryParams).then(response => {
+          this.loading = false
+          const data = response.data || response.rows || []
+          // 鏇存柊鏄惁鏈夋洿澶氭暟鎹�
+          this.hasMore = data.length === this.pageSize
+          
+          const newTasks = data.map(task => {
+            // 浠巃ssignedVehicles鏁扮粍涓幏鍙栬溅杈嗕俊鎭�
+            let vehicleInfo = '鏈垎閰嶈溅杈�'
+            if (task.assignedVehicles && task.assignedVehicles.length > 0) {
+              // 濡傛灉鏈夊涓溅杈�,鏄剧ず绗竴涓�,骞舵爣娉ㄦ暟閲�
+              const firstVehicle = task.assignedVehicles[0]
+              vehicleInfo = firstVehicle.vehicleNo || '鏈煡杞︾墝'
+              if (task.assignedVehicles.length > 1) {
+                vehicleInfo += ` 绛�${task.assignedVehicles.length}杈哷
+              }
+            }
+            
+            return {
+              ...task,
+              // 鏍煎紡鍖栨樉绀哄瓧娈� - 浣跨敤鍚庣杩斿洖鐨刟ssignedVehicles鏁版嵁
+              vehicle: vehicleInfo,
+              vehicleList: task.assignedVehicles || [],
+              startLocation: this.formatAddress(task.departureAddress || task.startLocation || '鏈缃�'),
+              endLocation: this.formatAddress(task.destinationAddress || task.endLocation || '鏈缃�'),
+              startTime: task.plannedStartTime ? formatDateTime(task.plannedStartTime, 'YYYY-MM-DD HH:mm') : '鏈缃�',
+              assignee: task.assigneeName || '鏈垎閰�'
+            }
+          })
+          
+          // 灏嗘柊鏁版嵁杩藉姞鍒扮幇鏈夊垪琛ㄤ腑
+          this.taskList = [...this.taskList, ...newTasks]
+        }).catch(error => {
+          this.loading = false
+          this.currentPage-- // 鍑洪敊鏃跺洖閫�椤电爜
+          console.error('鍔犺浇鏇村浠诲姟澶辫触:', error)
+          this.$modal.showToast('鍔犺浇鏇村浠诲姟澶辫触')
         })
       },
       
@@ -711,6 +799,17 @@
     * {
       -ms-overflow-style: none; /* IE 10+ */
     }
+  }
+  
+  // 鎬婚儴鎺ㄩ�佹爣璁版牱寮�
+  .head-push-tag {
+    color: #ff0000;
+    font-size: 24rpx;
+    font-weight: bold;
+    margin-left: 10rpx;
+    padding: 2rpx 8rpx;
+    border: 1rpx solid #ff0000;
+    border-radius: 4rpx;
   }
   
   // 浠诲姟鍒楄〃鍖哄煙
@@ -1066,5 +1165,18 @@
         margin-top: 20rpx;
       }
     }
+    
+    .load-more {
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      padding: 20rpx 0;
+      color: #999;
+      font-size: 28rpx;
+      
+      &.no-more {
+        color: #666;
+      }
+    }
   }
 </style>
\ No newline at end of file

--
Gitblit v1.9.1