Ver código fonte

fix: 添加审批结果显示,优先使用字典翻译,未命中时回退到数值映射

xieyong 2 semanas atrás
pai
commit
283050a59f
1 arquivos alterados com 23 adições e 0 exclusões
  1. 23 0
      src/views/bpm/collaborative/detail.vue

+ 23 - 0
src/views/bpm/collaborative/detail.vue

@@ -907,6 +907,10 @@ export default {
             item.assigneeUser && item.assigneeUser.deptName
               ? item.assigneeUser.deptName
               : '';
+          // 审批结果:优先使用字典翻译,字典未命中时回退到数值映射
+          const dictLabel = this.getDictValue('流程实例的结果', item.result);
+          const fallbackLabel = this.getTaskResultFallback(item.result);
+          const resultLabel = dictLabel || fallbackLabel;
           return '<tr>'
             + '<td style="text-align:center">' + (index + 1) + '</td>'
             + '<td>' + this.escapeHtml(item.name) + '</td>'
@@ -915,6 +919,7 @@ export default {
             + '<td>' + this.escapeHtml(item.createTime) + '</td>'
             + '<td>' + this.escapeHtml(item.endTime) + '</td>'
             + '<td>' + this.escapeHtml(item.reason) + '</td>'
+            + '<td>' + this.escapeHtml(resultLabel) + '</td>'
             + '</tr>';
         })
         .join('');
@@ -928,9 +933,27 @@ export default {
         + '<th>创建时间</th>'
         + '<th>审批时间</th>'
         + '<th>审批意见</th>'
+        + '<th>审批结果</th>'
         + '</tr></thead><tbody>' + trs + '</tbody></table>';
     },
 
+    // 任务 result 字段数值映射(与 bpm_process_instance_result 字典值一致),
+    // 用于字典未命中时回退显示,避免审批结果列为空
+    getTaskResultFallback(result) {
+      const map = {
+        1: '处理中',
+        2: '通过',
+        3: '不通过',
+        4: '取消',
+        5: '退回',
+        6: '已退回',
+        7: '等待审批'
+      };
+      if (result === null || result === undefined || result === '') return '';
+      const label = map[result] !== undefined ? map[result] : '';
+      return label;
+    },
+
     escapeHtml(str) {
       if (str === null || str === undefined) return '';
       return String(str)