From 656d6f8029f8bf9b2daa9dcc89101a879a70b860 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期三, 03 十二月 2025 23:10:05 +0800
Subject: [PATCH] feat:优先添加执行人

---
 app/pagesTask/detail.vue |  169 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 156 insertions(+), 13 deletions(-)

diff --git a/app/pagesTask/detail.vue b/app/pagesTask/detail.vue
index 214bb7b..0e96658 100644
--- a/app/pagesTask/detail.vue
+++ b/app/pagesTask/detail.vue
@@ -28,9 +28,44 @@
           <view class="label">鎵ц杞﹁締</view>
           <view class="value">{{ getVehicleInfo(taskDetail) }}</view>
         </view>
-        <view class="info-item">
-          <view class="label">鎵ц浜哄憳</view>
-          <view class="value">{{ taskDetail.assigneeName || '鏈垎閰�' }}</view>
+      </view>
+      
+      <!-- 鎵ц浜哄憳鍒楄〃 -->
+      <view class="detail-section">
+        <view class="section-title">鎵ц浜哄憳</view>
+        <view v-if="taskDetail.assignees && taskDetail.assignees.length > 0" class="assignee-list">
+          <view 
+            class="assignee-item" 
+            v-for="(assignee, index) in taskDetail.assignees" 
+            :key="assignee.userId || index"
+          >
+            <view class="assignee-index">{{ index + 1 }}</view>
+            <view class="assignee-info">
+              <view class="assignee-name">
+                {{ assignee.userName }}
+                <view v-if="assignee.isPrimary === '1'" class="primary-badge">
+                  <uni-icons type="star-filled" size="12" color="#ff9500"></uni-icons>
+                  <text>璐熻矗浜�</text>
+                </view>
+              </view>
+              <view class="assignee-role">
+                <view 
+                  class="role-tag"
+                  :class="{
+                    'role-driver': assignee.userType === 'driver',
+                    'role-doctor': assignee.userType === 'doctor',
+                    'role-nurse': assignee.userType === 'nurse'
+                  }"
+                >
+                  {{ getUserTypeLabel(assignee.userType) }}
+                </view>
+              </view>
+            </view>
+          </view>
+        </view>
+        <view v-else class="empty-assignee">
+          <uni-icons type="info" size="40" color="#ccc"></uni-icons>
+          <text>鏆傛棤鎵ц浜哄憳</text>
         </view>
       </view>
       
@@ -531,12 +566,12 @@
         getTask(this.taskId).then(response => {
           this.taskDetail = response.data || response
           // 璋冭瘯锛氭墦鍗拌繑鍥炵殑鏁版嵁
-          console.log('浠诲姟璇︽儏瀹屾暣鏁版嵁:', JSON.stringify(this.taskDetail, null, 2))
-          console.log('浠诲姟绫诲瀷瀛楁鍊�:', this.taskDetail.taskType)
-          console.log('浠诲姟鐘舵�佸瓧娈靛��:', this.taskDetail.taskStatus)
-          console.log('鍑哄彂鍦板潃:', this.taskDetail.departureAddress)
-          console.log('鐩殑鍦板潃:', this.taskDetail.destinationAddress)
-          console.log('杞繍浠诲姟淇℃伅 (emergencyInfo):', this.taskDetail.emergencyInfo)
+          // console.log('浠诲姟璇︽儏瀹屾暣鏁版嵁:', JSON.stringify(this.taskDetail, null, 2))
+          // console.log('浠诲姟绫诲瀷瀛楁鍊�:', this.taskDetail.taskType)
+          // console.log('浠诲姟鐘舵�佸瓧娈靛��:', this.taskDetail.taskStatus)
+          // console.log('鍑哄彂鍦板潃:', this.taskDetail.departureAddress)
+          // console.log('鐩殑鍦板潃:', this.taskDetail.destinationAddress)
+          // console.log('杞繍浠诲姟淇℃伅 (emergencyInfo):', this.taskDetail.emergencyInfo)
           
           // 濡傛灉鏄浆杩愪换鍔★紝鍔犺浇鏀粯淇℃伅
           if (this.taskDetail.taskType === 'EMERGENCY_TRANSFER') {
@@ -600,9 +635,9 @@
         return remaining > 0 ? remaining.toFixed(2) : '0.00'
       },
       
-      // 鑾峰彇杞﹁締淇℃伅
+      // 鑾峰彇杞﹁締淇℃伅锛堜慨澶嶏細闃叉 assignedVehicles 涓� null锛�
       getVehicleInfo(task) {
-        if (task.assignedVehicles && task.assignedVehicles.length > 0) {
+        if (task.assignedVehicles && Array.isArray(task.assignedVehicles) && task.assignedVehicles.length > 0) {
           const firstVehicle = task.assignedVehicles[0]
           let vehicleInfo = firstVehicle.vehicleNo || '鏈煡杞︾墝'
           if (task.assignedVehicles.length > 1) {
@@ -705,6 +740,16 @@
         return typeMap[type] || '鏈煡绫诲瀷'
       },
       
+      // 鑾峰彇鐢ㄦ埛绫诲瀷鏍囩
+      getUserTypeLabel(userType) {
+        const typeMap = {
+          'driver': '鍙告満',
+          'doctor': '鍖荤敓',
+          'nurse': '鎶ゅ+'
+        }
+        return typeMap[userType] || userType || '鏈煡'
+      },
+      
       // 澶勭悊缁撶畻
       handleSettlement() {
         uni.navigateTo({
@@ -776,8 +821,8 @@
           
           const activeTasks = response.data || [];
           
-          // 杩囨护鎺夊綋鍓嶄换鍔℃湰韬�
-          const otherActiveTasks = activeTasks.filter(task => task.taskId !== this.taskId);
+          // 杩囨护鎺夊綋鍓嶄换鍔℃湰韬紙淇锛氶槻姝� activeTasks 涓� null锛�
+          const otherActiveTasks = (activeTasks && Array.isArray(activeTasks)) ? activeTasks.filter(task => task.taskId !== this.taskId) : [];
           
           if (otherActiveTasks.length > 0) {
             // 杞﹁締鏈夊叾浠栨鍦ㄨ繘琛屼腑鐨勪换鍔�
@@ -1225,6 +1270,104 @@
         }
       }
       
+      // 鎵ц浜哄憳鍒楄〃鏍峰紡
+      .assignee-list {
+        .assignee-item {
+          display: flex;
+          align-items: center;
+          padding: 20rpx;
+          margin-bottom: 15rpx;
+          background-color: #f9f9f9;
+          border-radius: 10rpx;
+          
+          &:last-child {
+            margin-bottom: 0;
+          }
+          
+          .assignee-index {
+            width: 50rpx;
+            height: 50rpx;
+            border-radius: 50%;
+            background-color: #007AFF;
+            color: white;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            font-size: 24rpx;
+            font-weight: bold;
+            margin-right: 20rpx;
+            flex-shrink: 0;
+          }
+          
+          .assignee-info {
+            flex: 1;
+            display: flex;
+            flex-direction: column;
+            gap: 10rpx;
+            
+            .assignee-name {
+              display: flex;
+              align-items: center;
+              font-size: 30rpx;
+              color: #333;
+              font-weight: 500;
+              
+              .primary-badge {
+                display: inline-flex;
+                align-items: center;
+                gap: 4rpx;
+                margin-left: 12rpx;
+                padding: 4rpx 12rpx;
+                background-color: #fff3e0;
+                border-radius: 6rpx;
+                
+                text {
+                  font-size: 20rpx;
+                  color: #ff9500;
+                  font-weight: normal;
+                }
+              }
+            }
+            
+            .assignee-role {
+              .role-tag {
+                display: inline-block;
+                padding: 4rpx 12rpx;
+                border-radius: 6rpx;
+                font-size: 22rpx;
+                color: white;
+                
+                &.role-driver {
+                  background-color: #007AFF;
+                }
+                
+                &.role-doctor {
+                  background-color: #34C759;
+                }
+                
+                &.role-nurse {
+                  background-color: #AF52DE;
+                }
+              }
+            }
+          }
+        }
+      }
+      
+      .empty-assignee {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        justify-content: center;
+        padding: 60rpx 0;
+        color: #999;
+        
+        text {
+          margin-top: 20rpx;
+          font-size: 28rpx;
+        }
+      }
+      
       .info-item {
         display: flex;
         margin-bottom: 20rpx;

--
Gitblit v1.9.1