yxh
yxh
8 天以前 8022f7036945b75f82f2dfc43055623f81ed98f6
src/views/project/fundstatistics/index.vue
@@ -52,7 +52,7 @@
          :data="donationCaseTableData"
        >
          <el-table-column
            label="报告时间"
            label="案例时间"
            align="center"
            prop="reporttime"
            width="150"
@@ -77,15 +77,21 @@
            </template>
          </el-table-column>
          <el-table-column
            label="医疗机构"
            label="专职人员"
            align="center"
            prop="reportername"
            width="100"
          />
          <el-table-column
            label="业务组"
            align="center"
            prop="treatmenthospitalname"
          />
          <el-table-column label="捐献进度" align="center" prop="recordstate">
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.sys_DonationStatus"
                :value="scope.row.recordstate"
                :options="dict.type.sys_donornode"
                :value="scope.row.workflow"
              />
            </template>
          </el-table-column>
@@ -160,10 +166,12 @@
import { listDonatebaseinfo } from "@/api/project/donatebaseinfo";
import { getDonationCost, exportFundCost } from "@/api/project/financesubject";
import FundSummary from "@/views/project/components/fundsummary";
import { getToken } from "@/utils/auth";
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {
    FundSummary,
    FundSummary
  },
  dicts: [
    "sys_Organ",
@@ -172,6 +180,7 @@
    "sys_IDType",
    "sys_AgeUnit",
    "sys_DonationStatus",
    "sys_donornode"
  ],
  data() {
    //这里存放数据
@@ -190,15 +199,18 @@
        name: "",
        pageSize: 10,
        name: null,
        donorno: null,
        donorno: null
      },
      curdonorno: null,
      showType: "list",
      curCaseInfo: {
        donorno: null,
        name: null,
        id: null,
        id: null
      },
      headers: {
        Authorization: "Bearer " + getToken()
      }
    };
  },
  //监听属性 类似于data概念
@@ -213,7 +225,7 @@
      if (this.queryParams.recordstate == "") {
        this.queryParams.recordstate = null;
      }
      listDonatebaseinfo(this.queryParams).then((response) => {
      listDonatebaseinfo(this.queryParams).then(response => {
        this.donationCaseTableData = response.rows;
        this.total = response.total;
        this.loading = false;
@@ -243,25 +255,38 @@
    },
    //导出汇总表
    exportSummary(id) {
      exportFundCost(id).then((res) => {
        if (res.downloadUrl) {
          var fileUrl = res;
          //获取当前网址
          var urlBase = process.env.VUE_APP_BASE_API;
          var curWWWPath = window.document.location.href;
          var pos = curWWWPath.indexOf(window.document.location.pathname);
          // 创建a标签
          var aEle = document.createElement("a");
          aEle.href =
            curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
          aEle.click();
          this.$alert("下载成功", "提示", {
            confirmButtonText: "确定",
            type: "success",
      exportFundCost(id).then(res => {
        var fileUrl = res;
        //获取当前网址
        var urlBase = process.env.VUE_APP_BASE_API;
        var curWWWPath = window.document.location.href;
        var pos = curWWWPath.indexOf(window.document.location.pathname);
        // 创建a标签
        var aEle = document.createElement("a");
        aEle.href =
          curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
        console.log(aEle.href);
        // 添加Authorization头部
        fetch(aEle.href, {
          headers: this.headers
        })
          .then(response => {
            // 将文件下载链接作为blob对象进行下载
            return response.blob();
          })
          .then(blob => {
            const url = window.URL.createObjectURL(new Blob([blob]));
            console.log(url);
            const link = document.createElement("a");
            link.href = url;
            const name = fileUrl["downloadName"];
            link.setAttribute("download", name); // 替换file.pdf为实际的文件名
            document.body.appendChild(link);
            link.click();
            link.parentNode.removeChild(link);
          });
        }
      });
    },
    }
  },
  //生命周期 - 创建完成(可以访问当前this实例)
  created() {
@@ -275,7 +300,7 @@
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
};
</script>
<style scoped>