yxh
2 天以前 a68195121e02f4294542a11ac96e48047f0fde24
src/views/project/fundstatistics/index.vue
@@ -3,141 +3,77 @@
  <div class="app-container">
    <el-col :span="24" v-if="showType == 'list'">
      <el-card shadow="never">
        <el-form :model="queryParams" ref="queryForm" :inline="true">
        <el-form class="opo-query-form" :model="queryParams" ref="queryForm" :inline="true">
          <el-form-item label="姓名" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="请输入姓名"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
            <el-input v-model="queryParams.name" placeholder="请输入姓名" clearable size="small"
              @keyup.enter.native="handleQuery" />
          </el-form-item>
          <el-form-item label="捐献进度" prop="recordstate">
            <el-select
              v-model="queryParams.recordstate"
              placeholder="请选择当前进度"
              clearable
              size="small"
            >
              <el-option
                v-for="dict in dict.type.sys_DonationStatus"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            <el-select v-model="queryParams.recordstate" placeholder="请选择当前进度" clearable size="small">
              <el-option v-for="dict in dict.type.sys_DonationStatus" :key="dict.value" :label="dict.label"
                :value="dict.value" />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
        <!-- 捐献案例列表 -->
        <el-table
          v-loading="loading"
          style="width: 1240px"
          fit
          highlight-current-row
          header-align
          border
          :data="donationCaseTableData"
        >
          <el-table-column
            label="报告时间"
            align="center"
            prop="reporttime"
            width="150"
          >
        <el-table v-loading="loading" fit highlight-current-row header-align border
          :data="donationCaseTableData">
          <el-table-column label="案例时间" align="center" prop="reporttime" width="150">
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.reporttime, "{y}-{m}-{d}") }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="姓名"
            width="120"
            align="center"
            prop="name"
          />
          <el-table-column label="年龄" width="120" align="center" prop="age" />
          <el-table-column label="姓名" width="120" align="center" prop="name" />
          <el-table-column label="性别" width="120" align="center" prop="sex">
          <el-table-column label="年龄" align="center" prop="age" width="100">
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.sys_user_sex"
                :value="scope.row.sex"
              />
              {{
                `${scope.row.age && scope.row.age !== 0
                    ? `${scope.row.age}${scope.row.ageunit}`
                    : ""
                  } ${scope.row.age2 && scope.row.age2 !== 0
                    ? `${scope.row.age2}${scope.row.ageunit2}`
                    : ""
                  }`.trim()
              }}
            </template>
          </el-table-column>
          <el-table-column
            label="医疗机构"
            align="center"
            prop="treatmenthospitalname"
          />
            <template slot-scope="scope">
              <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />
            </template>
          </el-table-column>
          <el-table-column label="捐献进度" align="center" prop="recordstate">
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.sys_DonationStatus"
                :value="scope.row.recordstate"
              />
              <dict-tag :options="dict.type.sys_donornode" :value="scope.row.workflow" />
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
            width="200"
            fixed="right"
          >
          </el-table-column> <el-table-column label="捐献医院"align="center" prop="
treatmenthospitalname
" />
          <el-table-column label="专职人员" align="center" prop="reportername"/>
          <el-table-column label="业务组" align="center" prop="deptname" />
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" fixed="right">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-download"
                @click="exportSummary(scope.row.id)"
                v-hasPermi="['project:fundstatistics:summaryexoprt']"
                >导出</el-button
              >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="jumptocost(scope.row)"
                v-hasPermi="['project:fundstatistics:list']"
                >查看成本汇总</el-button
              >
              <el-button size="mini" type="text" icon="el-icon-download" @click="exportSummary(scope.row.id)"
                v-hasPermi="['project:fundstatistics:summaryexoprt']">导出</el-button>
              <el-button size="mini" type="text" icon="el-icon-edit" @click="jumptocost(scope.row)"
                v-hasPermi="['project:fundstatistics:list']">查看明细</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- hide-on-single-page -->
        <pagination
          v-show="total > 0"
          style="margin-left: 100px"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getBaseInfoList"
        />
        <pagination v-show="total > 0" style="margin-left: 100px" :total="total" :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize" @pagination="getBaseInfoList" />
      </el-card>
    </el-col>
    <el-col :span="24" v-if="showType == 'costinfo'">
      <el-form :model="curCaseInfo" ref="infoForm" :inline="true">
        <el-row>
          <el-col :span="3">
            <el-button
              type="primary"
              icon="el-icon-back"
              @click="backDonateList"
              >捐献列表</el-button
            >
            <el-button type="primary" icon="el-icon-back" @click="backDonateList">捐献列表</el-button>
          </el-col>
          <el-form-item label="捐献编号" prop="donorno">
            <el-input v-model="curCaseInfo.donorno" disabled />
@@ -160,10 +96,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 +110,7 @@
    "sys_IDType",
    "sys_AgeUnit",
    "sys_DonationStatus",
    "sys_donornode"
  ],
  data() {
    //这里存放数据
@@ -190,15 +129,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,18 +155,17 @@
      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;
      });
    },
    jumptocost(row) {
      this.showType = "costinfo";
      this.curdonorno = row.id;
      this.curCaseInfo.donorno = row.donorno;
      this.curCaseInfo.name = row.name;
      //console.log("dononro:" + this.curdonorno);
      this.showType = "costinfo";
    },
    backDonateList() {
@@ -243,39 +184,52 @@
    },
    //导出汇总表
    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() {
    this.getBaseInfoList();
  },
  //生命周期 - 挂载完成(可以访问DOM元素)
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  mounted() { },
  beforeCreate() { }, //生命周期 - 创建之前
  beforeMount() { }, //生命周期 - 挂载之前
  beforeUpdate() { }, //生命周期 - 更新之前
  updated() { }, //生命周期 - 更新之后
  beforeDestroy() { }, //生命周期 - 销毁之前
  destroyed() { }, //生命周期 - 销毁完成
  activated() { } //如果页面有keep-alive缓存功能,这个函数会触发
};
</script>
<style scoped>