WXL (wul)
17 小时以前 a9d2b856e0f6be6475319c2dc36bf405c2f908fc
src/views/sfstatistics/percentage/components/CombinedFollowUp.vue
@@ -582,6 +582,18 @@
    },
    // ===================== 导出 =====================
    getServiceTypeLabel() {
      const val = this.queryParams.serviceType;
      if (val == null) return "";
      const values = Array.isArray(val) ? val : [val];
      const list =
        this.options && this.options.length ? this.options : this.tasktypes;
      const labels = values
        .map((v) => (list.find((o) => o.value === v) || {}).label)
        .filter(Boolean);
      return labels.join("/");
    },
    async exportTable() {
      try {
        let dateRangeString = "";
@@ -603,7 +615,9 @@
          dateRangeString = isLishuiHospital ? `${now.getFullYear()}年${now.getMonth() + 1}月` : `${now.getMonth() + 1}月`;
        }
        const excelName = `综合随访统计表_${dateRangeString}.xlsx`;
        const serviceTypeLabel = this.getServiceTypeLabel();
        const serviceTypeSuffix = serviceTypeLabel ? `_${serviceTypeLabel}` : "";
        const excelName = `综合随访统计表${serviceTypeSuffix}_${dateRangeString}.xlsx`;
        if (!this.tableData || this.tableData.length === 0) {
          this.$message.warning("暂无数据可导出");
          return false;
@@ -611,7 +625,7 @@
        const workbook = new ExcelJS.Workbook();
        const worksheet = workbook.addWorksheet("综合统计");
        this.buildExportSheet(worksheet, dateRangeString);
        this.buildExportSheet(worksheet, dateRangeString, serviceTypeSuffix);
        const buffer = await workbook.xlsx.writeBuffer();
        const blob = new Blob([buffer], {
          type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
@@ -626,7 +640,7 @@
      }
    },
    buildExportSheet(worksheet, dateRangeString) {
    buildExportSheet(worksheet, dateRangeString, serviceTypeSuffix = "") {
      // 定义样式
      const titleStyle = {
        font: { name: "微软雅黑", size: 16, bold: true },
@@ -653,7 +667,7 @@
      // 标题行
      worksheet.mergeCells(1, 1, 1, 20);
      worksheet.getCell(1, 1).value = `综合随访统计表_${dateRangeString}`;
      worksheet.getCell(1, 1).value = `综合随访统计表${serviceTypeSuffix}_${dateRangeString}`;
      worksheet.getCell(1, 1).style = titleStyle;
      worksheet.getRow(1).height = 35;