WXL (wul)
6 天以前 a5cba9ab040f6f97558046885dce3017f9bab7e9
src/views/sfstatistics/propaganda/index.vue
@@ -182,7 +182,19 @@
          sortable="custom"
        >
          <template slot-scope="scope">
            <el-button
              size="medium"
              type="text"
              @click="
                handleViewDetails(
                  scope.row,
                  'totalCountInfo',
                  '宣教发送总量明细'
                )
              "
            >
            <span class="count-highlight">{{ scope.row.totalCount }}</span>
            </el-button>
          </template>
        </el-table-column>
@@ -193,7 +205,19 @@
          sortable="custom"
        >
          <template slot-scope="scope">
            <el-button
              size="medium"
              type="text"
              @click="
                handleViewDetails(
                  scope.row,
                  'sendSuccessCountInfo',
                  '发送成功量明细'
                )
              "
            >
            <span class="success-count">{{ scope.row.sendSuccessCount }}</span>
            </el-button>
          </template>
        </el-table-column>
@@ -204,7 +228,15 @@
          sortable="custom"
        >
          <template slot-scope="scope">
            <el-button
              size="medium"
              type="text"
              @click="
                handleViewDetails(scope.row, 'readCountInfo', '已读量明细')
              "
            >
            <span class="read-count">{{ scope.row.readCount }}</span>
            </el-button>
          </template>
        </el-table-column>
@@ -216,6 +248,17 @@
          sortable="custom"
        >
          <template slot-scope="scope">
            <el-button
              size="medium"
              type="text"
              @click="
                handleViewDetails(
                  scope.row,
                  'sendSuccessRate',
                  '发送成功率明细'
                )
              "
            >
            <el-progress
              :percentage="scope.row.sendSuccessRate * 100"
              :stroke-width="8"
@@ -226,6 +269,7 @@
            <span class="rate-text"
              >{{ (scope.row.sendSuccessRate * 100).toFixed(1) }}%</span
            >
            </el-button>
          </template>
        </el-table-column>
@@ -237,6 +281,13 @@
          sortable="custom"
        >
          <template slot-scope="scope">
            <el-button
              size="medium"
              type="text"
              @click="
                handleViewDetails(scope.row, 'readRate', '已读率明细')
              "
            >
            <el-progress
              :percentage="scope.row.readRate * 100"
              :stroke-width="8"
@@ -247,6 +298,7 @@
            <span class="rate-text"
              >{{ (scope.row.readRate * 100).toFixed(1) }}%</span
            >
            </el-button>
          </template>
        </el-table-column>
@@ -282,124 +334,24 @@
      />
    </div>
    <!-- 分组详情弹窗 -->
    <el-dialog
    <!-- 明细数据弹窗 -->
    <PropagandaDetailDialog
      :visible="detailVisible"
      :title="detailTitle"
      :visible.sync="detailVisible"
      width="80%"
      :before-close="handleCloseDetail"
    >
      <div v-loading="detailLoading">
        <el-row :gutter="20" class="detail-header">
          <el-col :span="6">
            <div class="detail-item">
              <label>分组名称:</label>
              <span>{{ currentGroup.groupName }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="detail-item">
              <label>分组编码:</label>
              <span>{{ currentGroup.groupCode }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="detail-item">
              <label>发送成功率:</label>
              <span class="rate-highlight"
                >{{ (currentGroup.sendSuccessRate * 100).toFixed(1) }}%</span
              >
            </div>
          </el-col>
          <el-col :span="6">
            <div class="detail-item">
              <label>已读率:</label>
              <span class="rate-highlight"
                >{{ (currentGroup.readRate * 100).toFixed(1) }}%</span
              >
            </div>
          </el-col>
        </el-row>
        <el-tabs v-model="detailActiveTab" class="detail-tabs">
          <el-tab-pane label="趋势分析" name="trend">
            <!-- 这里可以放置图表组件 -->
            <div class="chart-placeholder">
              趋势图表(可根据需求接入ECharts)
            </div>
          </el-tab-pane>
          <el-tab-pane label="明细数据" name="detail">
            <el-table
              :data="detailList"
              border
              style="width: 100%; margin-top: 20px"
            >
              <el-table-column
                prop="patientName"
                label="患者姓名"
                align="center"
                width="120"
              ></el-table-column>
              <el-table-column
                prop="patientNo"
                label="患者编号"
                align="center"
                width="120"
              ></el-table-column>
              <el-table-column
                prop="sendTime"
                label="发送时间"
                align="center"
                width="180"
              ></el-table-column>
              <el-table-column
                prop="readTime"
                label="阅读时间"
                align="center"
                width="180"
              ></el-table-column>
              <el-table-column
                prop="educationTitle"
                label="宣教标题"
                align="center"
              ></el-table-column>
              <el-table-column
                prop="status"
                label="状态"
                align="center"
                width="100"
              >
                <template slot-scope="scope">
                  <el-tag
                    :type="
                      scope.row.status === '已读'
                        ? 'success'
                        : scope.row.status === '发送成功'
                        ? 'info'
                        : 'danger'
                    "
                    size="small"
                  >
                    {{ scope.row.status }}
                  </el-tag>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="detailVisible = false">关 闭</el-button>
      </span>
    </el-dialog>
      :loading="detailLoading"
      @close="detailVisible = false"
    />
  </div>
</template>
<script>
import { gethelibraryCount } from "@/api/AiCentre/index";
import { gethelibraryCount, gethelibraryCountHyperlink } from "@/api/AiCentre/index";
import PropagandaDetailDialog from "./components/PropagandaDetailDialog.vue";
export default {
  name: "EducationStatistics",
  components: { PropagandaDetailDialog },
  data() {
    return {
      // 查询参数
@@ -436,8 +388,6 @@
      // 详情弹窗
      detailVisible: false,
      detailTitle: "",
      detailActiveTab: "trend",
      currentGroup: {},
      detailList: [],
      // 日期选择器配置
@@ -656,78 +606,48 @@
      return "#F56C6C";
    },
    // 查看分组详情
    handleGroupDetail(row) {
      this.currentGroup = row;
      this.detailTitle = `${row.groupName} - 宣教统计详情`;
      this.detailActiveTab = "trend";
    // 点击统计数字查看明细(仿随访统计模式)
    handleViewDetails(row, infoKey, titleSuffix) {
      const groupName = row.groupName || "";
      this.detailTitle = `${groupName} - ${titleSuffix}`;
      this.detailVisible = true;
      this.loadDetailData();
    },
    // 加载详情数据
    async loadDetailData() {
      this.detailLoading = true;
      try {
        // 这里应该调用获取详情的接口
        // 模拟数据
        setTimeout(() => {
          this.detailList = [
            {
              patientName: "张三",
              patientNo: "P202312001",
              sendTime: "2023-12-01 10:30:00",
              readTime: "2023-12-01 14:20:00",
              educationTitle: "骨科术后康复指导",
              status: "已读",
            },
            {
              patientName: "李四",
              patientNo: "P202312002",
              sendTime: "2023-12-01 11:15:00",
              readTime: "",
              educationTitle: "心血管疾病预防",
              status: "发送成功",
            },
            {
              patientName: "王五",
              patientNo: "P202312003",
              sendTime: "2023-12-02 09:45:00",
              readTime: "2023-12-02 16:10:00",
              educationTitle: "糖尿病饮食指导",
              status: "已读",
            },
          ];
          this.detailLoading = false;
        }, 500);
      } catch (error) {
        console.error("加载详情数据失败:", error);
        this.$message.error("加载详情数据失败");
        this.detailLoading = false;
      this.detailList = [];
      const params = {
        hyperLinkInfoType: infoKey,
        hospType: this.queryParams.hospType,
      };
      // 根据统计维度传入对应的过滤参数
      if (this.queryParams.groupType == "1") {
        // 按科室统计
        params.deptcodes = [row.groupCode];
      } else if (this.queryParams.groupType == "2") {
        // 按病区统计
        params.hospitaldistrictcodes = [row.groupCode];
      }
    },
    // 查看详情
    handleDetail(row) {
      this.currentGroup = row;
      this.detailTitle = `${row.groupName} - 明细数据`;
      this.detailActiveTab = "detail";
      this.detailVisible = true;
      this.loadDetailData();
    },
      // 传入时间范围
      if (
        this.queryParams.dateRange &&
        this.queryParams.dateRange.length === 2
      ) {
        params.starttime = this.queryParams.dateRange[0];
        params.endtime = this.queryParams.dateRange[1];
      }
      if (this.queryParams.visittime) {
        params.visittime = this.queryParams.visittime;
      }
    // 导出当前分组数据
    handleExportGroup(row) {
      this.$confirm(`确定要导出 "${row.groupName}" 的统计数据吗?`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      gethelibraryCountHyperlink(params)
        .then((response) => {
          this.detailList = response.data || [];
          this.detailLoading = false;
      })
        .then(() => {
          // 这里调用导出接口
          this.$message.success("导出任务已开始,请稍后在下载中心查看");
        })
        .catch(() => {});
        .catch(() => {
          this.detailLoading = false;
        });
    },
    // 导出全部数据
@@ -738,26 +658,10 @@
        type: "warning",
      })
        .then(() => {
          // 构建导出参数
          const exportParams = { ...this.queryParams };
          delete exportParams.pageNum;
          delete exportParams.pageSize;
          // 这里调用导出接口
          this.$message.success("导出任务已开始,请稍后在下载中心查看");
        })
        .catch(() => {});
    },
    // 关闭详情弹窗
    handleCloseDetail(done) {
      this.$confirm("确认关闭?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          done();
        })
        .catch(() => {});
    },
@@ -856,45 +760,6 @@
    }
  }
  .detail-header {
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    .detail-item {
      label {
        color: #909399;
        font-size: 14px;
      }
      span {
        font-size: 16px;
        font-weight: 500;
        color: #303133;
      }
      .rate-highlight {
        color: #409eff;
        font-weight: 600;
      }
    }
  }
  .detail-tabs {
    margin-top: 20px;
  }
  .chart-placeholder {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    color: #909399;
    border: 1px dashed #dcdfe6;
  }
}
// 响应式调整