WXL
2026-05-17 3453ba7e5243022ad4388da1515dc75ad8d81f94
src/views/business/course/components/DeathJudgmentStage.vue
@@ -1,80 +1,114 @@
<template>
  <div class="death-judgment-detail">
    <el-card class="detail-card">
      <!-- 基础信息 -->
    <!-- 公共信息模块(独立显示) -->
    <!-- 判定类型标签页 -->
    <el-card class="type-card">
      <el-tabs
        v-model="activeJudgmentType"
        type="card"
        @tab-click="handleTabChange"
      >
        <el-tab-pane label="脑死亡判定" name="brain">
          <span slot="label">
            <i class="el-icon-s-promotion" style="margin-right: 5px;"></i>
            脑死亡判定
          </span>
        </el-tab-pane>
        <el-tab-pane label="心死亡判定" name="heart">
          <span slot="label">
            <i class="el-icon-help" style="margin-right: 5px;"></i>
            心死亡判定
          </span>
        </el-tab-pane>
      </el-tabs>
    </el-card>
    <el-card class="detail-card common-info-card">
      <div slot="header" class="clearfix">
        <span class="detail-title">死亡判定基本信息</span>
        <span class="detail-title">公共信息</span>
      </div>
      <el-form :model="form" label-width="120px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="负责人" prop="responsibleusername">
              <el-input
                v-model="form.responsibleusername"
                :readonly="!isEdit"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="器官获取机构" prop="gainhospitalname">
              <el-input v-model="form.gainhospitalname" :readonly="!isEdit" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否默哀缅怀" prop="isspendremember">
              <el-select
                v-model="form.isspendremember"
                :disabled="!isEdit"
                style="width: 100%"
              >
                <el-option label="是" :value="1" />
                <el-option label="否" :value="0" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="恢复遗体仪容" prop="isrestoreremains">
              <el-select
                v-model="form.isrestoreremains"
                :disabled="!isEdit"
                style="width: 100%"
              >
                <el-option label="是" :value="1" />
                <el-option label="否" :value="0" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <!-- 脑死亡判定模块 -->
    <el-card v-if="activeJudgmentType === 'brain'" class="detail-card">
      <div slot="header" class="clearfix">
        <span class="detail-title">脑死亡判定信息</span>
        <el-button
          v-if="isEdit"
          style="float: right; margin-left: 10px;"
          type="success"
          style="float: right"
          @click="handleSave"
          :loading="saveLoading"
        >
          保存信息
        </el-button>
        <el-button
          v-if="isEdit"
          style="float: right; margin-left: 10px;"
          type="success"
          @click="accomplish"
          :loading="saveLoading"
        >
          完成判定
        </el-button>
        <el-button
          v-else
          style="float: right; margin-left: 10px;"
          type="primary"
          style="float: right"
          @click="handleEdit"
        >
          编辑信息
        </el-button>
      </div>
      <el-form :model="form" ref="form" :rules="rules" label-width="120px">
      <el-form :model="form" ref="brainForm" :rules="rules" label-width="120px">
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="捐献者编号" prop="donorno">
              <el-input
                v-model="form.donorno"
                :readonly="!isEdit"
                placeholder="自动生成捐献者编号"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="捐献者姓名" prop="name">
              <el-input v-model="form.name" :readonly="!isEdit" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="性别" prop="sex">
              <el-select
                v-model="form.sex"
                :disabled="!isEdit"
                style="width: 100%"
              >
                <el-option label="男" value="1" />
                <el-option label="女" value="2" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="年龄" prop="age">
              <el-input v-model="form.age" :readonly="!isEdit" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="疾病诊断" prop="diagnosisname">
              <el-input v-model="form.diagnosisname" :readonly="!isEdit" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="死亡原因" prop="deathreason">
              <el-select
                v-model="form.deathreason"
                :disabled="!isEdit"
                style="width: 100%"
              >
                <el-option label="脑死亡" value="brain_death" />
                <el-option label="心死亡" value="heart_death" />
                <el-option label="其他" value="other" />
              </el-select>
              <el-input v-model="form.deathreason" :readonly="!isEdit" />
            </el-form-item>
          </el-col>
        </el-row>
@@ -102,88 +136,18 @@
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="器官获取机构" prop="gainhospitalname">
              <el-input v-model="form.gainhospitalname" :readonly="!isEdit" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否默哀缅怀" prop="isspendremember">
              <el-select
                v-model="form.isspendremember"
                :disabled="!isEdit"
                style="width: 100%"
              >
                <el-option label="是" :value="1" />
                <el-option label="否" :value="0" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否恢复遗体仪容" prop="isrestoreremains">
              <el-select
                v-model="form.isrestoreremains"
                :disabled="!isEdit"
                style="width: 100%"
              >
                <el-option label="是" :value="1" />
                <el-option label="否" :value="0" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="负责人" prop="responsibleusername">
              <el-input
                v-model="form.responsibleusername"
                :readonly="!isEdit"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="记录状态" prop="recordstate">
              <el-tag :type="getStatusTag(form.recordstate)">
                {{ getStatusText(form.recordstate) }}
              </el-tag>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="死亡判定说明" prop="judgmentDescription">
          <el-input
            type="textarea"
            :rows="3"
            v-model="form.judgmentDescription"
            :readonly="!isEdit"
            placeholder="详细记录死亡判定过程和依据"
          />
        </el-form-item>
      </el-form>
    </el-card>
    <!-- 评估表附件 -->
    <el-card class="attachment-card">
      <div slot="header" class="clearfix">
        <span class="detail-title">死亡判定评估表附件</span>
        <!-- <el-button
          v-if="isEdit"
          type="primary"
          size="mini"
          @click="openUploadDialog"
          :loading="uploadLoading"
        >
          上传附件
        </el-button> -->
      <!-- 脑死亡评估表附件 -->
      <div class="attachment-section">
        <div class="attachment-header">
          <h3>脑死亡判定评估表附件</h3>
      </div>
      <!-- 附件类型选项卡 -->
      <el-tabs v-model="activeAttachmentType" type="card">
        <el-tab-pane
          v-for="type in attachmentTypes"
            v-for="type in brainDeathAttachmentTypes"
          :key="type.value"
          :label="type.label"
          :name="type.value"
@@ -289,11 +253,193 @@
          </div>
        </el-tab-pane>
      </el-tabs>
      </div>
    </el-card>
    <!-- 上传对话框 -->
    <!-- 心死亡判定模块 -->
    <el-card v-else class="detail-card">
      <div slot="header" class="clearfix">
        <span class="detail-title">心死亡判定信息</span>
        <el-button
          v-if="isEdit"
          style="float: right; margin-left: 10px;"
          type="success"
          @click="handleSave"
          :loading="saveLoading"
        >
          保存信息
        </el-button>
        <el-button
          v-else
          style="float: right; margin-left: 10px;"
          type="primary"
          @click="handleEdit"
        >
          编辑信息
        </el-button>
      </div>
      <el-form :model="form" ref="heartForm" :rules="rules" label-width="120px">
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="心死亡原因" prop="heartdeathreason">
              <el-input v-model="form.heartdeathreason" :readonly="!isEdit" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="心死亡时间" prop="heartdeathtime">
              <el-date-picker
                v-model="form.heartdeathtime"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 100%"
                :disabled="!isEdit"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="判定医生一" prop="heartdeathjudgedocto">
              <el-input
                v-model="form.heartdeathjudgedocto"
                :readonly="!isEdit"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="判定医生二" prop="heartdeathjudgedoctt">
              <el-input
                v-model="form.heartdeathjudgedoctt"
                :readonly="!isEdit"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!-- 心死亡评估表附件 -->
      <div class="attachment-section">
        <div class="attachment-header">
          <h3>心死亡判定评估表附件</h3>
        </div>
        <!-- 心死亡附件类型选项卡 -->
        <el-tabs v-model="activeHeartDeathAttachmentType" type="card">
          <el-tab-pane
            v-for="type in heartDeathAttachmentTypes"
            :key="type.value"
            :label="type.label"
            :name="type.value"
          >
            <div class="attachment-upload-section">
              <div class="upload-header">
                <span class="upload-title">{{ type.label }}</span>
                <el-tooltip content="点击上传该类型评估表" placement="top">
                  <el-button
                    size="mini"
                    type="primary"
                    icon="el-icon-plus"
                    @click="openHeartDeathUploadDialog(type.value)"
                    :disabled="!isEdit"
                  >
                    添加评估表
                  </el-button>
                </el-tooltip>
              </div>
              <!-- 心死亡附件列表 -->
              <el-table
                :data="getHeartDeathAttachmentsByType(type.value)"
                v-loading="attachmentLoading"
                style="width: 100%; margin-top: 15px;"
              >
                <el-table-column label="文件名称" min-width="200">
                  <template slot-scope="scope">
                    <div class="file-info">
                      <i
                        class="el-icon-document"
                        style="margin-right: 8px; color: #409EFF;"
                      ></i>
                      <span>{{ scope.row.fileName }}</span>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column label="文件类型" width="100" align="center">
                  <template slot-scope="scope">
                    <el-tag size="small">{{
                      getFileType(scope.row.fileName)
                    }}</el-tag>
                  </template>
                </el-table-column>
                <el-table-column label="文件大小" width="100" align="center">
                  <template slot-scope="scope">
                    <span>{{ formatFileSize(scope.row.fileSize) }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="上传时间" width="160" align="center">
                  <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.uploadTime) }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="上传人" width="100" align="center">
                  <template slot-scope="scope">
                    <span>{{ scope.row.uploader }}</span>
                  </template>
                </el-table-column>
                <el-table-column label="操作" width="180" align="center">
                  <template slot-scope="scope">
                    <el-button
                      size="mini"
                      type="text"
                      icon="el-icon-view"
                      @click="handlePreview(scope.row)"
                      >预览</el-button
                    >
                    <el-button
                      size="mini"
                      type="text"
                      icon="el-icon-download"
                      @click="handleDownload(scope.row)"
                      >下载</el-button
                    >
                    <el-button
                      v-if="isEdit"
                      size="mini"
                      type="text"
                      icon="el-icon-delete"
                      style="color: #F56C6C;"
                      @click="handleRemoveHeartDeathAttachment(scope.row)"
                      >删除</el-button
                    >
                  </template>
                </el-table-column>
              </el-table>
              <div
                v-if="getHeartDeathAttachmentsByType(type.value).length === 0"
                class="empty-attachment"
              >
                <el-empty
                  description="暂无评估表附件"
                  :image-size="80"
                ></el-empty>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </el-card>
    <!-- 上传对话框(脑死亡) -->
    <el-dialog
      :title="`上传${getCurrentTypeLabel}评估表`"
      :title="`上传${getCurrentBrainDeathTypeLabel}评估表`"
      :visible.sync="uploadDialogVisible"
      width="500px"
      :close-on-click-modal="false"
@@ -333,15 +479,66 @@
        </el-button>
      </div>
    </el-dialog>
    <!-- 上传对话框(心死亡) -->
    <el-dialog
      :title="`上传${getCurrentHeartDeathTypeLabel}评估表`"
      :visible.sync="heartDeathUploadDialogVisible"
      width="500px"
      :close-on-click-modal="false"
    >
      <el-upload
        ref="heartDeathUploadRef"
        class="upload-demo"
        drag
        :action="uploadAction"
        :headers="headers"
        multiple
        :file-list="tempHeartDeathFileList"
        :before-upload="beforeUpload"
        :on-change="handleHeartDeathFileChange"
        :on-remove="handleHeartDeathTempRemove"
        :on-success="handleHeartDeathUploadSuccess"
        :auto-upload="false"
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">
          将评估表文件拖到此处,或<em>点击上传</em>
        </div>
        <div class="el-upload__tip" slot="tip">
          支持上传pdf、jpg、png、doc、docx、xls、xlsx格式文件,单个文件不超过10MB
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button @click="heartDeathUploadDialogVisible = false"
          >取消</el-button
        >
        <el-button
          type="primary"
          @click="submitHeartDeathUpload"
          :loading="heartDeathUploadLoading"
          :disabled="tempHeartDeathFileList.length === 0"
        >
          确认上传
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { deathinfoedit, queryDathInfoBaseInfo } from "@/api/businessApi";
import {
  deathinfoedit,
  deathinfoadd,
  queryDathInfoBaseInfo
} from "@/api/businessApi";
import { getToken } from "@/utils/auth";
import CaseBasicInfo from "@/components/CaseBasicInfo";
export default {
  name: "DeathJudgmentDetail",
  components: { CaseBasicInfo },
  props: {
    infoid: {
      type: String,
@@ -350,10 +547,13 @@
  },
  data() {
    return {
      // 是否编辑模式
      caseId: null,
      isEdit: false,
      // 保存加载状态
      saveLoading: false,
      // 判定类型标签
      activeJudgmentType: "brain", // 默认显示脑死亡
      // 表单数据
      form: {
        id: undefined,
@@ -363,19 +563,28 @@
        sex: "",
        age: "",
        diagnosisname: "",
        // 脑死亡相关字段
        deathreason: "",
        deathtime: "",
        deathjudgedocto: "",
        deathjudgedoctt: "",
        // 心死亡相关字段
        heartdeathtime: "",
        heartdeathreason: "",
        heartdeathjudgedocto: "",
        heartdeathjudgedoctt: "",
        heartDeathRemark: "",
        // 公共字段
        gainhospitalno: "",
        gainhospitalname: "",
        isspendremember: 0,
        isrestoreremains: 0,
        rememberannex: "",
        rememberAnnex: "",
        heartdeathjudgeannex: "", // 新增心死亡附件字段
        responsibleuserid: "",
        responsibleusername: "",
        recordstate: "0",
        judgmentDescription: ""
        remark: ""
      },
      // 表单验证规则
      rules: {
@@ -390,56 +599,98 @@
        ],
        deathjudgedocto: [
          { required: true, message: "判定医生一不能为空", trigger: "blur" }
        ],
        heartdeathreason: [
          { required: false, message: "心死亡原因不能为空", trigger: "blur" }
        ],
        heartdeathtime: [
          { required: false, message: "心死亡时间不能为空", trigger: "change" }
        ],
        heartdeathjudgedocto: [
          {
            required: false,
            message: "心死亡判定医生一不能为空",
            trigger: "blur"
          }
        ]
      },
      // 附件相关数据
      activeAttachmentType: "1",
      activeHeartDeathAttachmentType: "heart_1", // 心死亡附件类型
      attachmentLoading: false,
      uploadDialogVisible: false,
      heartDeathUploadDialogVisible: false, // 心死亡上传对话框
      uploadLoading: false,
      heartDeathUploadLoading: false, // 心死亡上传加载状态
      tempFileList: [],
      tempHeartDeathFileList: [], // 心死亡临时文件列表
      currentUploadType: "",
      currentHeartDeathUploadType: "", // 当前心死亡上传类型
      uploadAction: process.env.VUE_APP_BASE_API + "/common/upload",
      headers: {
        Authorization: "Bearer " + getToken()
      },
      // 评估表类型定义
      attachmentTypes: [
      // 脑死亡评估表类型定义
      brainDeathAttachmentTypes: [
        { value: "1", label: "脑死亡判定表" },
        { value: "2", label: "脑电图评估表" },
        { value: "3", label: "短潜伏期体感诱发电位评估表" },
        { value: "4", label: "经颅多普勒超声评估记录" },
        { value: "5", label: "卫健委脑损伤质控中心 - 临床综合评估表" },
        { value: "6", label: "UW评分表" },
        { value: "7", label: "心死亡判定表" }
        { value: "6", label: "UW评分表" }
      ],
      // 心死亡评估表类型定义
      heartDeathAttachmentTypes: [
        { value: "heart_1", label: "心死亡判定表" },
        { value: "heart_2", label: "心电图评估表" }
      ],
      // 附件列表数据
      attachmentList: []
      attachmentList: [], // 脑死亡附件
      heartDeathAttachmentList: [] // 心死亡附件
    };
  },
  computed: {
    getCurrentTypeLabel() {
      const type = this.attachmentTypes.find(
    getCurrentBrainDeathTypeLabel() {
      const type = this.brainDeathAttachmentTypes.find(
        t => t.value === this.currentUploadType
      );
      return type ? type.label : "";
    },
    getCurrentHeartDeathTypeLabel() {
      const type = this.heartDeathAttachmentTypes.find(
        t => t.value === this.currentHeartDeathUploadType
      );
      return type ? type.label : "";
    }
  },
  created() {
    this.caseId = this.infoid;
    // 从路由参数获取默认显示类型
    if (this.$route.query.judgmentType) {
      this.activeJudgmentType = this.$route.query.type;
    }
    this.getDetail(this.infoid);
    this.getAttachmentList();
  },
  methods: {
    // 标签页切换
    handleTabChange(tab) {
      this.activeJudgmentType = tab.name;
      // 可以在这里添加其他切换逻辑
    },
    // 生成捐献者编号
    generateDonorNo() {
      const timestamp = Date.now().toString();
      this.form.donorno = "DONOR" + timestamp.slice(-8);
    },
    // 获取详情
    async getDetail(id) {
    async getDetail(infoid) {
      try {
        const response = await queryDathInfoBaseInfo({ infoid: id });
        const response = await queryDathInfoBaseInfo({ infoid });
        let realData = {};
        if (response && response.data) {
@@ -462,31 +713,48 @@
        };
        // 解析附件信息
        if (realData.rememberannex) {
          this.parseAttachmentData(realData.rememberannex);
        if (realData.rememberAnnex) {
          this.parseAttachmentData(realData.rememberAnnex, "brain");
        }
        // 解析心死亡附件信息
        if (realData.heartdeathjudgeannex) {
          this.parseAttachmentData(realData.heartdeathjudgeannex, "heart");
        }
      } catch (error) {
        console.error("获取死亡判定详情失败:", error);
        this.$message.error("数据加载失败");
      }
    },
    // 解析附件数据
    parseAttachmentData(attachmentJson) {
    parseAttachmentData(attachmentJson, type = "brain") {
      try {
        if (attachmentJson) {
          const attachments = JSON.parse(attachmentJson);
          if (Array.isArray(attachments)) {
            if (type === "brain") {
            this.attachmentList = attachments;
            } else if (type === "heart") {
              this.heartDeathAttachmentList = attachments;
            }
          }
        }
      } catch (error) {
        console.error("解析附件数据失败:", error);
      }
    },
    // 构建附件JSON数据
    buildAttachmentJson() {
    // 构建脑死亡附件JSON数据
    buildBrainDeathAttachmentJson() {
      return JSON.stringify(this.attachmentList);
    },
    // 构建心死亡附件JSON数据
    buildHeartDeathAttachmentJson() {
      return JSON.stringify(this.heartDeathAttachmentList);
    },
    // 获取状态标签样式
    getStatusTag(status) {
      const statusMap = {
@@ -496,6 +764,7 @@
      };
      return statusMap[status] || "info";
    },
    // 获取状态文本
    getStatusText(status) {
      const textMap = {
@@ -505,18 +774,25 @@
      };
      return textMap[status] || "未知状态";
    },
    // 获取附件列表
    getAttachmentList() {
      this.attachmentLoading = true;
      // 实际项目中从接口获取附件数据
      setTimeout(() => {
        this.attachmentLoading = false;
      }, 500);
    },
    // 根据类型获取附件
    // 根据类型获取脑死亡附件
    getAttachmentsByType(type) {
      return this.attachmentList.filter(item => item.type === type);
    },
    // 根据类型获取心死亡附件
    getHeartDeathAttachmentsByType(type) {
      return this.heartDeathAttachmentList.filter(item => item.type === type);
    },
    // 获取文件类型
    getFileType(fileName) {
      const ext = fileName
@@ -535,7 +811,8 @@
      };
      return typeMap[ext] || ext.toUpperCase();
    },
    // 打开上传对话框
    // 打开脑死亡上传对话框
    openUploadDialog(type = null) {
      this.currentUploadType = type || this.activeAttachmentType;
      this.tempFileList = [];
@@ -546,6 +823,20 @@
        }
      });
    },
    // 打开心死亡上传对话框
    openHeartDeathUploadDialog(type = null) {
      this.currentHeartDeathUploadType =
        type || this.activeHeartDeathAttachmentType;
      this.tempHeartDeathFileList = [];
      this.heartDeathUploadDialogVisible = true;
      this.$nextTick(() => {
        if (this.$refs.heartDeathUploadRef) {
          this.$refs.heartDeathUploadRef.clearFiles();
        }
      });
    },
    // 上传前校验
    beforeUpload(file) {
      const allowedTypes = [
@@ -585,24 +876,38 @@
      return true;
    },
    // 文件选择变化
    // 脑死亡文件选择变化
    handleFileChange(file, fileList) {
      this.tempFileList = fileList;
    },
    // 移除临时文件
    // 心死亡文件选择变化
    handleHeartDeathFileChange(file, fileList) {
      this.tempHeartDeathFileList = fileList;
    },
    // 移除脑死亡临时文件
    handleTempRemove(file, fileList) {
      this.tempFileList = fileList;
    },
    /** 上传成功处理 */
    // 移除心死亡临时文件
    handleHeartDeathTempRemove(file, fileList) {
      this.tempHeartDeathFileList = fileList;
    },
    // 脑死亡上传成功处理
    handleUploadSuccess(response, file, fileList) {
      if (response.code === 200) {
        file.url = response.data || response.url;
        this.$message.success("文件上传成功");
        for (const file of this.tempFileList) {
          const newAttachment = {
            id: Date.now() + Math.random(),
            type: this.currentUploadType,
            typeName: this.getCurrentTypeLabel,
            typeName: this.getCurrentBrainDeathTypeLabel,
            fileName: file.name,
            fileSize: file.size,
            uploadTime: new Date().toISOString(),
@@ -613,8 +918,8 @@
          this.attachmentList.push(newAttachment);
        }
        // 更新附件JSON数据到表单
        this.form.rememberannex = this.buildAttachmentJson();
        // 更新脑死亡附件JSON数据到表单
        this.form.rememberAnnex = this.buildBrainDeathAttachmentJson();
        this.$message.success("文件上传成功");
        this.uploadDialogVisible = false;
@@ -624,45 +929,60 @@
        this.$message.error(response.msg || "文件上传失败");
      }
    },
    // 提交上传
    async submitUpload() {
    // 心死亡上传成功处理
    handleHeartDeathUploadSuccess(response, file, fileList) {
      if (response.code === 200) {
        file.url = response.data || response.url;
        for (const file of this.tempHeartDeathFileList) {
          const newAttachment = {
            id: Date.now() + Math.random(),
            type: this.currentHeartDeathUploadType,
            typeName: this.getCurrentHeartDeathTypeLabel,
            fileName: file.name,
            fileSize: file.size,
            uploadTime: new Date().toISOString(),
            uploader: "当前用户",
            fileUrl: file.url
          };
          this.heartDeathAttachmentList.push(newAttachment);
        }
        // 更新心死亡附件JSON数据到表单
        this.form.heartdeathjudgeannex = this.buildHeartDeathAttachmentJson();
        this.$message.success("文件上传成功");
        this.heartDeathUploadDialogVisible = false;
        this.heartDeathUploadLoading = false;
        this.tempHeartDeathFileList = [];
      } else {
        this.$message.error(response.msg || "文件上传失败");
      }
    },
    // 提交脑死亡上传
    submitUpload() {
      if (this.tempFileList.length === 0) {
        this.$message.warning("请先选择要上传的文件");
        return;
      }
      this.$refs.uploadRef.submit();
      this.uploadLoading = true;
      // try {
      //   for (const file of this.tempFileList) {
      //     const newAttachment = {
      //       id: Date.now() + Math.random(),
      //       type: this.currentUploadType,
      //       typeName: this.getCurrentTypeLabel,
      //       fileName: file.name,
      //       fileSize: file.size,
      //       uploadTime: new Date().toISOString(),
      //       uploader: "当前用户",
      //       fileUrl: URL.createObjectURL(file.raw)
      //     };
      //     this.attachmentList.push(newAttachment);
      //   }
      //   // 更新附件JSON数据到表单
      //   this.form.rememberannex = this.buildAttachmentJson();
      //   this.$message.success("文件上传成功");
      //   this.uploadDialogVisible = false;
      //   this.tempFileList = [];
      // } catch (error) {
      //   this.$message.error("文件上传失败");
      //   console.error("上传失败:", error);
      // } finally {
      //   this.uploadLoading = false;
      // }
    },
    // 删除附件
    // 提交心死亡上传
    submitHeartDeathUpload() {
      if (this.tempHeartDeathFileList.length === 0) {
        this.$message.warning("请先选择要上传的文件");
        return;
      }
      this.$refs.heartDeathUploadRef.submit();
      this.heartDeathUploadLoading = true;
    },
    // 删除脑死亡附件
    handleRemoveAttachment(attachment) {
      this.$confirm("确定要删除这个评估表附件吗?", "提示", {
        confirmButtonText: "确定",
@@ -675,13 +995,33 @@
          );
          if (index !== -1) {
            this.attachmentList.splice(index, 1);
            // 更新附件JSON数据到表单
            this.form.rememberannex = this.buildAttachmentJson();
            this.form.rememberAnnex = this.buildBrainDeathAttachmentJson();
            this.$message.success("评估表删除成功");
          }
        })
        .catch(() => {});
    },
    // 删除心死亡附件
    handleRemoveHeartDeathAttachment(attachment) {
      this.$confirm("确定要删除这个评估表附件吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          const index = this.heartDeathAttachmentList.findIndex(
            item => item.id === attachment.id
          );
          if (index !== -1) {
            this.heartDeathAttachmentList.splice(index, 1);
            this.form.heartdeathjudgeannex = this.buildHeartDeathAttachmentJson();
            this.$message.success("评估表删除成功");
          }
        })
        .catch(() => {});
    },
    // 预览附件
    handlePreview(attachment) {
      if (attachment.fileName.endsWith(".pdf")) {
@@ -699,6 +1039,7 @@
        this.$message.info("该文件类型暂不支持在线预览,请下载后查看");
      }
    },
    // 下载附件
    handleDownload(attachment) {
      const link = document.createElement("a");
@@ -707,13 +1048,31 @@
      link.click();
      this.$message.success(`开始下载: ${attachment.fileName}`);
    },
    // 编辑信息
    handleEdit() {
      this.isEdit = true;
    },
    accomplish() {
      this.$confirm("是否确认完成该案例死亡判定全部信息?", "提醒", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.form.state = 3;
          this.handleSave();
        })
        .catch(() => {});
    },
    // 保存信息
    async handleSave() {
      this.$refs.form.validate(async valid => {
      // 根据当前标签选择验证规则
      let formRef =
        this.activeJudgmentType === "brain" ? "brainForm" : "heartForm";
      this.$refs[formRef].validate(async valid => {
        if (valid) {
          this.saveLoading = true;
@@ -721,16 +1080,28 @@
            // 构建提交数据
            const submitData = {
              ...this.form,
              infoid: this.infoid,
              // 确保附件数据最新
              rememberannex: this.buildAttachmentJson()
              rememberAnnex: this.buildBrainDeathAttachmentJson(),
              heartdeathjudgeannex: this.buildHeartDeathAttachmentJson()
            };
            if (submitData.state == 1 || !submitData.state) {
              submitData.state = 2;
            }
            let response = null;
            const response = await deathinfoedit(submitData);
            if (submitData.id) {
              response = await deathinfoedit(submitData);
            } else {
              response = await deathinfoadd(submitData);
            }
            if (response.code === 200) {
              this.$message.success("保存成功");
              this.isEdit = false;
              if (!this.form.id) {
                this.form.id = response.data;
              }
              if (this.$route.path.includes("/add")) {
                this.$router.push("/case/deathJudgment");
              }
@@ -746,6 +1117,7 @@
        }
      });
    },
    // 文件大小格式化
    formatFileSize(size) {
      if (size === 0) return "0 B";
@@ -754,6 +1126,7 @@
      const i = Math.floor(Math.log(size) / Math.log(k));
      return parseFloat((size / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
    },
    // 时间格式化
    parseTime(time) {
      if (!time) return "";
@@ -780,17 +1153,60 @@
  padding: 20px;
}
.detail-card {
.type-card {
  margin-bottom: 20px;
  border: none;
  box-shadow: none;
}
.attachment-card {
.type-card >>> .el-tabs__item {
  font-size: 16px;
  font-weight: bold;
  padding: 0 20px;
  height: 50px;
  line-height: 50px;
}
.type-card >>> .el-tabs__item.is-active {
  color: #409eff;
  border-bottom: 3px solid #409eff;
}
.detail-card {
  margin-bottom: 20px;
  border: 1px solid #e6ebf5;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.common-info-card {
  border-top: 2px solid #67c23a;
}
.detail-card >>> .el-card__header {
  background-color: #f5f7fa;
  border-bottom: 1px solid #e6ebf5;
  padding: 15px 20px;
}
.detail-title {
  font-size: 16px;
  font-size: 18px;
  font-weight: bold;
  color: #303133;
}
.attachment-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e6ebf5;
}
.attachment-header h3 {
  font-size: 16px;
  color: #303133;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}
.attachment-upload-section {
@@ -802,6 +1218,7 @@
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px 0;
}
.upload-title {
@@ -819,6 +1236,9 @@
  text-align: center;
  padding: 40px 0;
  color: #909399;
  border: 1px dashed #dcdfe6;
  border-radius: 4px;
  margin-top: 20px;
}
/* 图片预览对话框样式 */