WXL
3 天以前 4c9fdc87987140e8b2c3f0dfc2f6608cdb6be774
src/views/business/ethicalReview/index.vue
@@ -86,12 +86,6 @@
            >修改</el-button
          > -->
          <el-button
            type="warning"
            icon="el-icon-download"
            @click="handleExport"
            >导出</el-button
          >
          <el-button
            type="info"
            icon="el-icon-check"
            :disabled="single"
@@ -121,13 +115,8 @@
          prop="inpatientno"
          width="120"
        />
        <el-table-column
          label="姓名"
          align="center"
          prop="name"
          width="100"
        />
        <el-table-column label="姓名" align="center" prop="name" width="100" />
        <el-table-column label="性别" align="center" prop="sex" width="80">
          <template slot-scope="scope">
            <dict-tag
@@ -137,55 +126,35 @@
          </template>
        </el-table-column>
        <el-table-column label="年龄" align="center" prop="age" width="80" />
        <!--
        <el-table-column
          label="案例编号"
          align="center"
          prop="caseNo"
          width="120"
        />
        <el-table-column
          label="捐献者编号"
          align="center"
          prop="donorno"
          width="120"
        />
        <el-table-column
          label="血型"
          align="center"
          prop="bloodtype"
          width="80"
        />
        <el-table-column
          label="证件号码"
          align="center"
          prop="idcardno"
          width="180"
        />
        <el-table-column
          label="医疗机构"
          align="center"
          prop="treatmenthospitalname"
          min-width="150"
          show-overflow-tooltip
        />
        <el-table-column
          label="专家姓名"
          align="center"
          prop="expertName"
          width="100"
        />
        -->
        <el-table-column label="血型" align="center" prop="bloodtype" width="80">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_BloodType"
              :value="scope.row.bloodtype"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="疾病诊断"
          align="center"
          prop="diagnosisname"
          min-width="180"
          width="200"
          show-overflow-tooltip
        />
        <el-table-column
          label="捐献类型"
          align="center"
          prop="donationcategory"
          width="180"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_DonationCategory"
              :value="scope.row.donationcategory"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="审查状态"
          align="center"
@@ -199,7 +168,7 @@
            />
          </template>
        </el-table-column>
        <el-table-column
        <!-- <el-table-column
          label="审查结论"
          align="center"
          prop="expertConclusion"
@@ -211,7 +180,7 @@
              :value="scope.row.expertConclusion"
            />
          </template>
        </el-table-column>
        </el-table-column> -->
        <el-table-column
          label="审查意见"
          align="center"
@@ -236,7 +205,7 @@
        <el-table-column
          label="操作"
          align="center"
          width="180"
          width="220"
          fixed="right"
          class-name="small-padding fixed-width"
        >
@@ -245,23 +214,22 @@
              size="mini"
              type="text"
              icon="el-icon-view"
              @click="handleView(scope.row)"
              >详情</el-button
              @click.stop="handleView(scope.row)"
              >查看</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              >修改</el-button
              @click.stop="handleUpdate(scope.row)"
              >编辑</el-button
            >
            <el-button
              size="mini"
              type="text"
              icon="el-icon-check"
              @click="handleEndReview(scope.row)"
              :disabled="scope.row.status === '2'"
              >结束</el-button
              icon="el-icon-printer"
              @click.stop="handleDownload(scope.row)"
              >打印</el-button
            >
          </template>
        </el-table-column>
@@ -280,13 +248,25 @@
</template>
<script>
import { reviewinitiateBaseInfoList, ethicalreviewedit,  } from "@/api/businessApi";
import {
  reviewinitiateBaseInfoList,
  ethicalreviewedit,
  ethicalReviewDownload
} from "@/api/businessApi";
import Pagination from "@/components/Pagination";
import { getToken } from "@/utils/auth";
export default {
  name: "EthicsReviewList",
  components: { Pagination },
  dicts: ["sys_user_sex", "sys_ethical",'expert_Conclusion'],
  dicts: [
    "sys_user_sex",
    "ReviewForm_status",
    "sys_ethical",
    "expert_Conclusion",
    "sys_BloodType",
    "sys_DonationCategory"
  ],
  data() {
    return {
      // 遮罩层
@@ -332,9 +312,14 @@
      delete params.reviewTimeRange;
      // 如果有时间范围参数
      if (this.queryParams.reviewTimeRange && this.queryParams.reviewTimeRange.length === 2) {
        params.expertTimeStart = this.queryParams.reviewTimeRange[0] + ' 00:00:00';
        params.expertTimeEnd = this.queryParams.reviewTimeRange[1] + ' 23:59:59';
      if (
        this.queryParams.reviewTimeRange &&
        this.queryParams.reviewTimeRange.length === 2
      ) {
        params.expertTimeStart =
          this.queryParams.reviewTimeRange[0] + " 00:00:00";
        params.expertTimeEnd =
          this.queryParams.reviewTimeRange[1] + " 23:59:59";
      }
      reviewinitiateBaseInfoList(params)
@@ -374,7 +359,7 @@
    handleView(row) {
      this.$router.push({
        path: "/case/ethicalReviewInfo",
        query: { infoid: row.infoid,id:row.id }
        query: { infoid: row.infoid, id: row.id, mode: "view" }
      });
    },
    // 新增按钮操作
@@ -386,12 +371,13 @@
      const infoid = row.infoid;
      this.$router.push({
        path: "/case/ethicalReviewInfo",
        query: { infoid: infoid,id:row.id }
        query: { infoid: infoid, id: row.id, mode: "edit" }
      });
    },
    // 结束审查操作
    handleEndReview(row) {
      const selectedRow = row || (this.selectedRows.length === 1 ? this.selectedRows[0] : null);
      const selectedRow =
        row || (this.selectedRows.length === 1 ? this.selectedRows[0] : null);
      if (!selectedRow) {
        this.$message.warning("请选择一条记录");
        return;
@@ -406,7 +392,7 @@
          // 调用修改接口,将状态改为结束(status: '2')
          const updateData = {
            infoid: selectedRow.infoid,
            status: '2',
            status: "2",
            // 可以保留原有数据
            expertName: selectedRow.expertName,
            expertConclusion: selectedRow.expertConclusion,
@@ -426,50 +412,41 @@
        })
        .catch(() => {});
    },
    // 导出按钮操作
    handleExport() {
      const queryParams = { ...this.queryParams };
      delete queryParams.pageNum;
      delete queryParams.pageSize;
      // 处理时间范围参数
      if (queryParams.reviewTimeRange && queryParams.reviewTimeRange.length === 2) {
        queryParams.expertTimeStart = queryParams.reviewTimeRange[0] + ' 00:00:00';
        queryParams.expertTimeEnd = queryParams.reviewTimeRange[1] + ' 23:59:59';
      }
      delete queryParams.reviewTimeRange;
      this.$confirm("是否确认导出所有伦理审查数据?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.loading = true;
          // return ethicalreviewexport(queryParams);
        })
        .then(response => {
          if (response.code === 200) {
            this.$message.success("导出成功");
            // 处理导出文件下载
            if (response.data) {
              const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' });
              const downloadElement = document.createElement('a');
              const href = window.URL.createObjectURL(blob);
              downloadElement.href = href;
              downloadElement.download = '伦理审查列表.xlsx';
              document.body.appendChild(downloadElement);
              downloadElement.click();
              document.body.removeChild(downloadElement);
              window.URL.revokeObjectURL(href);
            }
          } else {
            this.$message.error(response.msg || "导出失败");
    // 下载伦理审查档案
    handleDownload(row) {
      ethicalReviewDownload({ nitiateId: row.id })
        .then(res => {
          if (res.code !== 200 || !res.data || !res.data.downloadUrl) {
            this.$message.error(res.msg || "下载失败");
            return;
          }
          this.loading = false;
          const fileUrl = res.data;
          // 拼接下载地址:origin + /dev-api(开发代理前缀) + /profile + downloadUrl,
          // 后端静态文件实际挂在 /profile 下,downloadUrl 少了这层前缀
          const urlBase = process.env.VUE_APP_BASE_API;
          const curWWWPath = window.document.location.href;
          const pos = curWWWPath.indexOf(window.document.location.pathname);
          const fullUrl =
            curWWWPath.substring(0, pos) + urlBase + "/profile" + fileUrl.downloadUrl;
          fetch(fullUrl, {
            headers: { Authorization: "Bearer " + getToken() }
          })
            .then(response => response.blob())
            .then(blob => {
              const url = window.URL.createObjectURL(new Blob([blob]));
              const link = document.createElement("a");
              link.href = url;
              link.setAttribute("download", fileUrl.downloadName);
              document.body.appendChild(link);
              link.click();
              link.parentNode.removeChild(link);
              window.URL.revokeObjectURL(url);
            });
        })
        .catch(() => {
          this.loading = false;
        .catch(error => {
          console.error("下载档案失败:", error);
          this.$message.error("下载失败");
        });
    },
    // 时间格式化