WXL (wul)
4 天以前 bc9538a9e071259ca8bbb6de52c60c9d7a55a03b
src/views/followvisit/tasklist/index.vue
@@ -130,19 +130,19 @@
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="总任务/已随访"
          label="执行详情"
          align="center"
          key="nickName"
          key="taskDetail"
          width="120"
          prop="nickName"
        >
          <template slot-scope="scope">
            <span
              >{{
                scope.row.wfs || scope.row.wfs == 0
                  ? scope.row.wfs + scope.row.yfs
                  : ""
              }}/{{ scope.row.yfs }}</span
            <el-button
              size="medium"
              type="text"
              @click="showCountDetail(scope.row)"
              ><span class="button-xq"
                ><i class="el-icon-s-data"></i>执行详情</span
              ></el-button
            >
          </template>
        </el-table-column>
@@ -385,6 +385,26 @@
        >
      </div>
    </el-dialog>
    <!-- 任务执行详情弹窗 -->
    <el-dialog
      title="任务执行详情"
      :visible.sync="countDialogVisible"
      width="600px"
      :before-close="handleCountClose"
    >
      <div v-loading="countLoading" class="count-detail">
        <div class="count-task-name">任务名称:{{ countTaskName || "-" }}</div>
        <div class="count-grid">
          <div v-for="f in countFields" :key="f.key" class="count-item">
            <span class="count-label">{{ f.label }}</span>
            <span class="count-value">{{ countVal(f) }}</span>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="countDialogVisible = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 选择患者弹框 -->
    <Patient-Selection
      ref="Patient"
@@ -407,6 +427,7 @@
import {
  getTasklist,
  delTaskInfo,
  countByCondition,
  TaskTemplateSendExecution,
  scanGenerateSubtask,
  goSfRelay,
@@ -450,6 +471,25 @@
      qrDialogVisible: false,
      qrCodeUrl: "", // 中间页链接
      qrCodeCanvas: null, // 存储canvas引用
      // 任务执行详情弹窗
      countDialogVisible: false,
      countLoading: false,
      countTaskName: "",
      countData: {},
      countFields: [
        { key: "total", label: "任务总量" },
        { key: "blq", label: "待领取" },
        { key: "wfs", label: "未发送" },
        { key: "yfs", label: "已发送", altKey: "ysf" },
        { key: "fssb", label: "发送失败" },
        { key: "dsf", label: "待随访" },
        { key: "xsf", label: "需随访" },
        { key: "wxsf", label: "无需随访" },
        { key: "wzx", label: "未执行" },
        { key: "ywc", label: "已完成" },
        { key: "yc", label: "异常" },
        { key: "jg", label: "警告" },
      ],
      // 日期范围
      dateRange: [],
      // 岗位选项
@@ -697,6 +737,7 @@
        this.tasktopic == 3 ||
        this.tasktopic == 1 ||
        this.tasktopic == 7 ||
        this.tasktopic == 20 ||
        this.tasktopic == 5 ||
        this.tasktopic == 18 ||
        this.tasktopic == 19 ||
@@ -1195,6 +1236,44 @@
      const container = this.$refs.qrCodeContainer;
      if (container) container.innerHTML = "";
    },
    // 查看任务执行详情(countByCondition 直接返回聚合 Map)
    showCountDetail(row) {
      this.countTaskName = row.taskName || "";
      this.countData = {};
      this.countDialogVisible = true;
      this.countLoading = true;
      countByCondition({ taskid: row.taskid })
        .then((res) => {
          this.countData = this.normalizeCount(res || {});
        })
        .catch(() => {
          this.countData = {};
          this.$modal.msgError("获取任务执行详情失败");
        })
        .finally(() => {
          this.countLoading = false;
        });
    },
    // 归一键名(聚合 SQL 别名可能带空格)
    normalizeCount(data) {
      const out = {};
      Object.keys(data || {}).forEach((k) => {
        out[String(k).trim()] = data[k];
      });
      return out;
    },
    // 读取统计值(key 优先,altKey 兜底,缺失显示 0)
    countVal(f) {
      const d = this.countData || {};
      if (d[f.key] != null && d[f.key] !== "") return d[f.key];
      if (f.altKey && d[f.altKey] != null && d[f.altKey] !== "")
        return d[f.altKey];
      return 0;
    },
    handleCountClose() {
      this.countDialogVisible = false;
      this.countData = {};
    },
  },
};
</script>
@@ -1357,4 +1436,35 @@
    font-size: 24px;
  }
}
.count-detail {
  .count-task-name {
    font-size: 14px;
    color: #303133;
    font-weight: 600;
    margin-bottom: 16px;
  }
  .count-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .count-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #f5f7fa;
    border-radius: 4px;
    .count-label {
      font-size: 13px;
      color: #606266;
    }
    .count-value {
      font-size: 16px;
      font-weight: 600;
      color: #303133;
    }
  }
}
</style>