wlzboy
2025-12-26 c10b1e130ccbc94e6481a43e8e2d35cfc8fcf83b
app/pages/index.vue
@@ -153,7 +153,7 @@
               
                <view class="info-item">
                  <view class="label">执行人员:</view>
                  <view class="value">{{ task.assignee }}</view>
                  <view class="value">{{ getAssigneesDisplay(task) }}</view>
                </view>
              </view>
            </view>
@@ -607,18 +607,44 @@
    // 获取目的地显示内容(转运任务显示转入医院名称或详细地址)
    getEndLocationDisplay(task) {
      // 如果是转运任务且有emergencyInfo信息
      // console.log("get end location display",task.taskType,task.emergencyInfo.hospitalInAddress,task.showTaskCode);
      if (task.taskType === 'EMERGENCY_TRANSFER' && task.emergencyInfo) {
        // console.log('转运任务 - 紧急信息:', task.emergencyInfo)
        // 优先显示转入医院名称
        if (task.emergencyInfo.hospitalInName) {
          if(task.emergencyInfo.hospitalInName.includes("家中")){
            return task.emergencyInfo.destinationAddress;
          }
          return task.emergencyInfo.hospitalInName;
        }
        // console.log("get end local",task.emergencyInfo.hospitalInAddress);
        return task.emergencyInfo.hospitalInAddress;
        // if (task.emergencyInfo.hospitalInName) {
        //   if(task.emergencyInfo.hospitalInName.includes("家中")){
        //     return task.emergencyInfo.destinationAddress;
        //   }
        //   return task.emergencyInfo.hospitalInName;
        // }
        // // 如果没有转入医院名称,但有转入医院地址,则显示地址
        // if (task.emergencyInfo.hospitalInAddress) {
        //   return task.emergencyInfo.hospitalInAddress;
        // }
      }
      // 其他情况使用原来的endLocation
      return this.formatAddress(task.endLocation || "未设置");
    },
    // 获取执行人员显示(从 assignees 数组中提取 userName)
    getAssigneesDisplay(task) {
      // 如果有 assignees 数组且不为空
      if (task.assignees && task.assignees.length > 0) {
        // 提取所有 userName,过滤掉空值
        const userNames = task.assignees
          .map(assignee => assignee.userName)
          .filter(name => name); // 过滤掉 null/undefined/空字符串
        // 如果有有效的用户名,用逗号连接
        if (userNames.length > 0) {
          return userNames.join('、');
        }
      }
      // 如果没有 assignees 数组,使用旧的 assigneeName 或 assignee 字段
      return task.assigneeName || task.assignee || '未分配';
    },
    // 转换状态格式(将数据库状态转换为UI使用的状态)
@@ -851,12 +877,19 @@
          title: '检查附件...'
        });
        
        const response = await checkTaskConsentAttachment(taskId);
        // 注意:这里会被请求拦截器处理,code !== 200 时会 reject
        const response = await checkTaskConsentAttachment(taskId).catch(err => {
          // 拦截器 reject 的情况,返回一个默认对象
          console.log('请求被拦截器 reject,err:', err);
          return { code: -1, msg: '未上传知情同意书' };
        });
        
        uni.hideLoading();
        console.log('检查附件结果:', response);
        
        if (response.code === 200) {
        if (response && response.code === 200) {
          // 已上传知情同意书,继续更新状态
          console.log('已上传知情同意书,继续完成任务');
          this.$modal
            .confirm("确认任务已完成?")
            .then(() => {
@@ -864,20 +897,21 @@
            })
            .catch(() => {});
        } else {
          // 未上传知情同意书,显示提示
          this.$modal.confirm('任务未上传知情同意书,无法完成任务。是否现在去上传?').then(() => {
          // 未上传知情同意书或其他错误,阻止完成
          const message = (response && response.msg) || '任务未上传知情同意书,无法完成任务';
          console.log('未上传知情同意书,阻止完成');
          this.$modal.confirm(message + '。是否现在去上传?').then(() => {
            // 跳转到任务详情页上传附件
            this.$tab.navigateTo(`/pagesTask/detail?id=${taskId}`);
          }).catch(() => {});
        }
      } catch (error) {
        uni.hideLoading();
        console.error('检查附件失败:', error);
        console.error('检查附件异常:', error);
        
        // 如果检查失败,询问用户是否继续
        this.$modal.confirm('检查附件状态失败,是否继续完成任务?').then(() => {
          this.updateTaskStatus(taskId, status, remark);
        }).catch(() => {});
        // 如果检查失败(网络异常等),不允许完成任务
        this.$modal.showToast('检查附件状态失败,无法完成任务');
      }
    },
@@ -1386,6 +1420,10 @@
                font-size: 26rpx;
                flex: 1;
                word-break: break-all;
                overflow-wrap: break-word;
                line-height: 1.5;
                max-height: none;
                overflow: visible;
              }
            }
          }