| | |
| | | <template> |
| | | <base-stage :stage-data="stageData" :case-info="caseInfo"> |
| | | <template #header> |
| | | <el-alert |
| | | :title="`捐献确认 - ${getStatusText()}`" |
| | | :type="getAlertType()" |
| | | :description="getAlertDescription()" |
| | | show-icon |
| | | :closable="false" |
| | | /> |
| | | </template> |
| | | |
| | | <el-row :gutter="20" style="margin-top: 20px;"> |
| | | <el-col :span="8"> |
| | | <el-card> |
| | | <div slot="header" class="card-header"> |
| | | <span>确认信息概览</span> |
| | | </div> |
| | | <div class="confirm-overview"> |
| | | <div class="overview-item"> |
| | | <span class="label">确认状态:</span> |
| | | <el-tag :type="getStatusTag(confirmationDetails.status)"> |
| | | {{ getStatusText(confirmationDetails.status) }} |
| | | </el-tag> |
| | | </div> |
| | | <div class="overview-item"> |
| | | <span class="label">确认时间:</span> |
| | | <span>{{ formatTime(confirmationDetails.confirmTime) }}</span> |
| | | </div> |
| | | <div class="overview-item"> |
| | | <span class="label">确认方式:</span> |
| | | <span>{{ confirmationDetails.method }}</span> |
| | | </div> |
| | | <div class="overview-item"> |
| | | <span class="label">协调员:</span> |
| | | <span>{{ confirmationDetails.coordinator }}</span> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | |
| | | <el-col :span="8"> |
| | | <el-card> |
| | | <div slot="header" class="card-header"> |
| | | <span>家属同意情况</span> |
| | | </div> |
| | | <el-descriptions :column="1" size="small"> |
| | | <el-descriptions-item label="主要家属"> |
| | | {{ familyConsent.mainRelative }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="同意状态"> |
| | | <el-tag :type="familyConsent.consented ? 'success' : 'warning'"> |
| | | {{ familyConsent.consented ? '已同意' : '待确认' }} |
| | | </el-tag> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="签字时间"> |
| | | {{ formatTime(familyConsent.signTime) }} |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="关系证明"> |
| | | {{ familyConsent.relationshipProof }} |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | </el-card> |
| | | </el-col> |
| | | |
| | | <el-col :span="8"> |
| | | <el-card> |
| | | <div slot="header" class="card-header"> |
| | | <span>法律文件</span> |
| | | </div> |
| | | <div class="document-list"> |
| | | <div v-for="doc in legalDocuments" :key="doc.name" class="document-item"> |
| | | <div class="doc-info"> |
| | | <i :class="doc.icon" style="color: #409EFF; margin-right: 8px;"></i> |
| | | <span>{{ doc.name }}</span> |
| | | </div> |
| | | <el-tag :type="doc.status === 'completed' ? 'success' : 'warning'" size="small"> |
| | | {{ doc.status === 'completed' ? '已签署' : '待签署' }} |
| | | </el-tag> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-card style="margin-top: 20px;"> |
| | | <div slot="header" class="card-header"> |
| | | <span>捐献意愿确认书</span> |
| | | <div class="confirmation-detail"> |
| | | <el-card class="detail-card"> |
| | | <!-- 基础信息 --> |
| | | <div slot="header" class="clearfix"> |
| | | <span class="detail-title">捐献确认基本信息</span> |
| | | <el-button |
| | | type="success" |
| | | style="float: right;" |
| | | @click="handleSave" |
| | | :loading="saveLoading" |
| | | > |
| | | 保存确认信息 |
| | | </el-button> |
| | | </div> |
| | | <div class="consent-content"> |
| | | <p>本人/家属确认,在充分了解器官捐献的相关信息后,自愿同意进行器官捐献。</p> |
| | | <el-divider /> |
| | | <el-descriptions :column="2" border> |
| | | <el-descriptions-item label="捐献者姓名">{{ caseInfo.donorName }}</el-descriptions-item> |
| | | <el-descriptions-item label="捐献者身份证号">{{ confirmationDetails.idNumber }}</el-descriptions-item> |
| | | <el-descriptions-item label="捐献器官类型">{{ confirmationDetails.organs }}</el-descriptions-item> |
| | | <el-descriptions-item label="捐献用途">{{ confirmationDetails.purpose }}</el-descriptions-item> |
| | | <el-descriptions-item label="签字人">{{ familyConsent.mainRelative }}</el-descriptions-item> |
| | | <el-descriptions-item label="签字日期">{{ formatTime(familyConsent.signTime) }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | </div> |
| | | |
| | | <el-form :model="form" ref="form" label-width="120px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="住院号" prop="caseNo"> |
| | | <el-input v-model="form.caseNo" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="捐献者姓名" prop="name"> |
| | | <el-input v-model="form.name" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="性别" prop="sex"> |
| | | <el-select v-model="form.sex" 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" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="疾病诊断" prop="diagnosisname"> |
| | | <el-input v-model="form.diagnosisname" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="所在医疗机构" prop="treatmenthospitalname"> |
| | | <el-input v-model="form.treatmenthospitalname" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="协调员1" prop="coordinatedusernameo"> |
| | | <el-input v-model="form.coordinatedusernameo" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="协调员2" prop="coordinatedusernamet"> |
| | | <el-input v-model="form.coordinatedusernamet" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="业务人员" prop="responsibleusername"> |
| | | <el-input v-model="form.responsibleusername" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <!-- <el-col :span="8"> |
| | | <el-form-item label="确认状态" prop="relativeconfirmationsign"> |
| | | <el-select |
| | | v-model="form.relativeconfirmationsign" |
| | | style="width: 100%" |
| | | |
| | | > |
| | | <el-option label="未确认" value="0" /> |
| | | <el-option label="家属确认" value="1" /> |
| | | <el-option label="不同意捐献" value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> --> |
| | | <el-col :span="8"> |
| | | <el-form-item label="签字时间" prop="signdate"> |
| | | <el-date-picker |
| | | v-model="form.signdate" |
| | | type="datetime" |
| | | value-format="yyyy-MM-dd" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <!-- <el-col :span="8"> |
| | | <el-form-item label="血型" prop="bloodtype"> |
| | | <el-input v-model="form.bloodtype" /> |
| | | </el-form-item> |
| | | </el-col> --> |
| | | </el-row> |
| | | |
| | | <!-- <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="证件号码" prop="idcardno"> |
| | | <el-input v-model="form.idcardno" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> --> |
| | | |
| | | <!-- 亲属信息 --> |
| | | <!-- 亲属信息 --> |
| | | <el-divider content-position="left">亲属确认信息</el-divider> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="6"> |
| | | <el-form-item label="亲属姓名" prop="relativeconfirmationsignname"> |
| | | <el-input |
| | | v-model="form.relativeconfirmationsignname" |
| | | placeholder="请输入亲属姓名" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="与捐赠者关系" prop="signfamilyrelations"> |
| | | <el-select |
| | | v-model="form.signfamilyrelations" |
| | | placeholder="请选择与捐赠者关系" |
| | | > |
| | | <el-option |
| | | v-for="dict in dict.type.sys_FamilyRelation || []" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="亲属身份证" prop="relativeidcardno"> |
| | | <el-input |
| | | v-model="form.relativeidcardno" |
| | | placeholder="请输入亲属证件号码" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="亲属电话" prop="relativephone"> |
| | | <el-input |
| | | v-model="form.relativephone" |
| | | placeholder="请输入亲属联系电话" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row> |
| | | <el-form-item label-width="100px" label="捐献决定"> |
| | | <el-checkbox-group v-model="organdecision"> |
| | | <el-checkbox |
| | | v-for="item in organselection" |
| | | :key="item" |
| | | :label="item" |
| | | >{{ item }} |
| | | </el-checkbox> |
| | | </el-checkbox-group> |
| | | <el-input |
| | | v-if="organdecision.includes('其他')" |
| | | v-model="organdecisionOther" |
| | | placeholder="请输入其他捐献决定的具体内容" |
| | | style="margin-top: 10px; width: 300px;" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-row> |
| | | |
| | | <el-form-item label="家属意见备注" prop="relativeRemark"> |
| | | <el-input |
| | | type="textarea" |
| | | :rows="3" |
| | | v-model="form.relativeRemark" |
| | | placeholder="记录家属的意见和沟通情况" |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | </base-stage> |
| | | |
| | | <!-- 附件信息 - 按类型分类 --> |
| | | <el-card class="attachment-card"> |
| | | <div slot="header" class="clearfix"> |
| | | <span class="detail-title">相关附件上传</span> |
| | | </div> |
| | | |
| | | <!-- 附件类型选项卡 --> |
| | | <el-tabs v-model="activeAttachmentType" type="card"> |
| | | <el-tab-pane |
| | | v-for="type in attachmentTypes" |
| | | :key="type.value" |
| | | :label="type.label" |
| | | :name="type.value" |
| | | > |
| | | <div class="attachment-section"> |
| | | <div class="attachment-header"> |
| | | <span class="upload-title">{{ type.label }}</span> |
| | | <el-tooltip content="点击上传该类型附件" placement="top"> |
| | | <el-button |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | @click="openUploadDialog(type.value)" |
| | | > |
| | | 添加附件 |
| | | </el-button> |
| | | </el-tooltip> |
| | | </div> |
| | | |
| | | <!-- 当前类型的附件列表 --> |
| | | <div class="attachment-list"> |
| | | <el-table |
| | | :data="getAttachmentsByType(type.value)" |
| | | size="small" |
| | | v-loading="attachmentLoading" |
| | | style="width: 100%;" |
| | | > |
| | | <el-table-column label="文件名" min-width="200"> |
| | | <template slot-scope="scope"> |
| | | <i |
| | | class="el-icon-document" |
| | | style="color: #409EFF; margin-right: 8px;" |
| | | ></i> |
| | | <span class="file-name">{{ scope.row.fileName }}</span> |
| | | </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>{{ formatDateTime(scope.row.uploadTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column label="操作" width="150" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="primary" |
| | | @click="handlePreview(scope.row)" |
| | | > |
| | | 预览 |
| | | </el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="danger" |
| | | @click="handleRemoveAttachment(type.value, scope.$index)" |
| | | > |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- 空状态提示 --> |
| | | <div |
| | | v-if="getAttachmentsByType(type.value).length === 0" |
| | | class="empty-attachment" |
| | | > |
| | | <el-empty |
| | | :description="`暂无${type.label}附件`" |
| | | :image-size="80" |
| | | ></el-empty> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-card> |
| | | |
| | | <!-- 上传对话框 --> |
| | | <el-dialog |
| | | :title="`上传${getCurrentTypeLabel}附件`" |
| | | :visible.sync="uploadDialogVisible" |
| | | width="500px" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-upload |
| | | ref="uploadRef" |
| | | class="upload-demo" |
| | | drag |
| | | action="#" |
| | | multiple |
| | | :file-list="tempFileList" |
| | | :before-upload="beforeUpload" |
| | | :on-change="handleFileChange" |
| | | :on-remove="handleTempRemove" |
| | | :auto-upload="false" |
| | | :http-request="handleHttpRequest" |
| | | > |
| | | <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格式文件,单个文件不超过10MB |
| | | </div> |
| | | </el-upload> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="uploadDialogVisible = false">取消</el-button> |
| | | <el-button |
| | | type="primary" |
| | | @click="submitUpload" |
| | | :loading="uploadLoading" |
| | | :disabled="tempFileList.length === 0" |
| | | > |
| | | 确认上传 |
| | | </el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!-- 文件预览弹窗 --> |
| | | <FilePreviewDialog |
| | | :visible="previewVisible" |
| | | :file="currentPreviewFile" |
| | | @close="previewVisible = false" |
| | | @download="handleDownload" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseStage from './BaseStage.vue'; |
| | | import { relativesList, relativesEdit } from "@/api/businessApi"; |
| | | import FilePreviewDialog from "@/components/FilePreviewDialog"; |
| | | |
| | | export default { |
| | | name: 'DonationConfirmStage', |
| | | components: { BaseStage }, |
| | | name: "ConfirmationDetail", |
| | | components: { |
| | | FilePreviewDialog |
| | | }, |
| | | props: { |
| | | stageData: { |
| | | type: Object, |
| | | default: () => ({}) |
| | | }, |
| | | caseInfo: { |
| | | type: Object, |
| | | default: () => ({}) |
| | | infoid: { |
| | | type: String, |
| | | default: true |
| | | } |
| | | }, |
| | | dicts: ["sys_FamilyRelation"], |
| | | data() { |
| | | return { |
| | | confirmationDetails: { |
| | | status: 'completed', |
| | | confirmTime: '2023-12-03 11:00:00', |
| | | method: '家属书面同意', |
| | | coordinator: '赵协调员', |
| | | idNumber: '110101199001011234', |
| | | organs: '心脏、肝脏、肾脏、角膜', |
| | | purpose: '临床移植' |
| | | // 是否编辑模式 |
| | | isEdit: false, |
| | | // 表单数据 |
| | | form: { |
| | | id: undefined, |
| | | infoid: undefined, |
| | | caseNo: "", |
| | | name: "", |
| | | sex: "", |
| | | age: "", |
| | | diagnosisname: "", |
| | | treatmenthospitalname: "", |
| | | coordinatedusernameo: "", |
| | | coordinatedusernamet: "", |
| | | responsibleusername: "", |
| | | relativeconfirmationsign: "0", |
| | | signdate: "", |
| | | relativeconfirmationsignname: "", |
| | | signfamilyrelations: "", |
| | | relativeidcardno: "", |
| | | relativephone: "", |
| | | relativeRemark: "", |
| | | assessannex: "" // JSON字符串存储所有附件 |
| | | }, |
| | | familyConsent: { |
| | | mainRelative: '张三父亲', |
| | | consented: true, |
| | | signTime: '2023-12-03 10:45:00', |
| | | relationshipProof: '户口本关系证明' |
| | | }, |
| | | legalDocuments: [ |
| | | { name: '器官捐献同意书', icon: 'el-icon-document', status: 'completed' }, |
| | | { name: '家属关系证明', icon: 'el-icon-document', status: 'completed' }, |
| | | { name: '医疗免责声明', icon: 'el-icon-document', status: 'completed' }, |
| | | { name: '隐私保护协议', icon: 'el-icon-document', status: 'completed' } |
| | | ] |
| | | organdecision: [], |
| | | organdecisionOther: "", |
| | | organselection: [ |
| | | "肝脏", |
| | | "双肾", |
| | | "左肾", |
| | | "右肾", |
| | | "心脏", |
| | | "肺脏", |
| | | "胰腺", |
| | | "小肠", |
| | | "双眼组织", |
| | | "遗体", |
| | | "其他" |
| | | ], |
| | | // 加载状态 |
| | | loading: false, |
| | | saveLoading: false, |
| | | // 附件相关数据 |
| | | activeAttachmentType: "1", |
| | | attachmentLoading: false, |
| | | uploadDialogVisible: false, |
| | | uploadLoading: false, |
| | | tempFileList: [], |
| | | currentUploadType: "", |
| | | // 预览相关 |
| | | previewVisible: false, |
| | | currentPreviewFile: null, |
| | | |
| | | // 附件类型定义 |
| | | attachmentTypes: [ |
| | | { value: "1", label: "人体器官潜在捐献者登记表" }, |
| | | { value: "2", label: "人体器官捐献亲属确认登记表" }, |
| | | { value: "3", label: "捐献者及直系亲属身份证、户口簿相关证明" }, |
| | | { value: "4", label: "公民身故后人体器官(角膜)遗体捐献告知书" }, |
| | | { value: "5", label: "脑死亡判定知情同意书" }, |
| | | { value: "6", label: "心死亡判定知情同意书" } |
| | | ], |
| | | |
| | | // 附件数据结构 - 按类型分开存储 |
| | | attachmentData: { |
| | | "1": [], // 类型1的附件列表 |
| | | "2": [], |
| | | "3": [], |
| | | "4": [], |
| | | "5": [], |
| | | "6": [] |
| | | } |
| | | }; |
| | | }, |
| | | computed: { |
| | | getCurrentTypeLabel() { |
| | | const type = this.attachmentTypes.find( |
| | | t => t.value === this.currentUploadType |
| | | ); |
| | | return type ? type.label : ""; |
| | | } |
| | | }, |
| | | created() { |
| | | this.isEdit = this.$route.query.confirm === "true"; |
| | | console.log(this.infoid, "this.infoid"); |
| | | |
| | | if (this.infoid) { |
| | | console.log(1); |
| | | |
| | | this.getDetail(this.infoid); |
| | | } |
| | | }, |
| | | methods: { |
| | | getStatusText() { |
| | | const status = this.stageData.status; |
| | | return status === 'completed' ? '已完成' : |
| | | status === 'in_progress' ? '进行中' : '未开始'; |
| | | // 获取详情 |
| | | async getDetail(infoid) { |
| | | this.loading = true; |
| | | try { |
| | | const response = await relativesList({ infoid }); |
| | | console.log(2); |
| | | |
| | | if (response.code === 200) { |
| | | console.log(3); |
| | | this.handleDetailData(response); |
| | | } else { |
| | | this.$message.error("获取详情失败:" + (response.msg || "未知错误")); |
| | | } |
| | | } catch (error) { |
| | | console.error("获取捐献确认详情失败:", error); |
| | | this.$message.error("获取详情失败"); |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | getAlertType() { |
| | | const status = this.stageData.status; |
| | | return status === 'completed' ? 'success' : |
| | | status === 'in_progress' ? 'warning' : 'info'; |
| | | }, |
| | | getAlertDescription() { |
| | | const status = this.stageData.status; |
| | | return status === 'completed' ? '捐献确认流程已完成,所有法律文件已签署' : |
| | | status === 'in_progress' ? '捐献确认流程正在进行中' : '等待开始捐献确认流程'; |
| | | }, |
| | | getStatusTag(status) { |
| | | const map = { |
| | | 'completed': 'success', |
| | | 'in_progress': 'warning', |
| | | 'pending': 'info' |
| | | |
| | | // 处理详情数据 |
| | | handleDetailData(response) { |
| | | let detailData = null; |
| | | |
| | | // 根据接口实际返回的数据结构进行调整 |
| | | if (response.data) { |
| | | if (Array.isArray(response.data)) { |
| | | detailData = response.data[0] || {}; |
| | | } else if (response.data.rows && Array.isArray(response.data.rows)) { |
| | | detailData = response.data.rows[0] || {}; |
| | | } else if (Array.isArray(response.data.list)) { |
| | | detailData = response.data.list[0] || {}; |
| | | } else { |
| | | detailData = response.data; |
| | | } |
| | | } else { |
| | | detailData = response; |
| | | } |
| | | |
| | | // 映射字段到表单 |
| | | this.form = { |
| | | ...this.form, |
| | | id: detailData.id || this.$route.query.id, |
| | | infoid: detailData.infoid || this.infoid, |
| | | caseNo: detailData.caseNo || "", |
| | | name: detailData.name || "", |
| | | sex: detailData.sex || "", |
| | | age: detailData.age || "", |
| | | diagnosisname: detailData.diagnosisname || "", |
| | | treatmenthospitalname: detailData.treatmenthospitalname || "", |
| | | coordinatedusernameo: detailData.coordinatedusernameo || "", |
| | | coordinatedusernamet: detailData.coordinatedusernamet || "", |
| | | responsibleusername: detailData.responsibleusername || "", |
| | | relativeconfirmationsign: detailData.relativeconfirmationsign || "0", |
| | | signdate: detailData.signdate, |
| | | relativeconfirmationsignname: |
| | | detailData.relativeconfirmationsignname || "", |
| | | signfamilyrelations: detailData.signfamilyrelations || "", |
| | | relativeidcardno: detailData.relativeidcardno || "", |
| | | relativephone: detailData.relativephone || "", |
| | | relativeRemark: detailData.relativeRemark || "", |
| | | assessannex: detailData.assessannex || "" |
| | | }; |
| | | return map[status] || 'info'; |
| | | |
| | | // 处理捐献决定数据 |
| | | if (detailData.organdecision) { |
| | | this.organdecision = Array.isArray(detailData.organdecision) |
| | | ? detailData.organdecision |
| | | : detailData.organdecision.split(","); |
| | | } |
| | | console.log(this.organdecision, "this.organdecision"); |
| | | |
| | | // 处理附件数据 - 从assessannex字段解析JSON并按类型分类 |
| | | this.processAssessannexData(); |
| | | }, |
| | | |
| | | // 处理assessannex字段数据并按类型分类 |
| | | processAssessannexData() { |
| | | if (this.form.assessannex) { |
| | | try { |
| | | const annexData = |
| | | typeof this.form.assessannex === "string" |
| | | ? JSON.parse(this.form.assessannex) |
| | | : this.form.assessannex; |
| | | |
| | | // 清空现有数据 |
| | | Object.keys(this.attachmentData).forEach(key => { |
| | | this.attachmentData[key] = []; |
| | | }); |
| | | |
| | | // 按类型分类存储 |
| | | if (Array.isArray(annexData)) { |
| | | annexData.forEach(attachment => { |
| | | const type = attachment.type || "1"; // 默认到第一种类型 |
| | | if (this.attachmentData[type]) { |
| | | this.attachmentData[type].push(attachment); |
| | | } |
| | | }); |
| | | } |
| | | } catch (error) { |
| | | console.warn("assessannex数据解析失败:", error); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // 根据类型获取附件列表 |
| | | getAttachmentsByType(type) { |
| | | return this.attachmentData[type] || []; |
| | | }, |
| | | |
| | | // 打开上传对话框 |
| | | openUploadDialog(type) { |
| | | this.currentUploadType = type; |
| | | this.tempFileList = []; |
| | | this.uploadDialogVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs.uploadRef) { |
| | | this.$refs.uploadRef.clearFiles(); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 上传前校验[7](@ref) |
| | | beforeUpload(file) { |
| | | const allowedTypes = [ |
| | | "application/pdf", |
| | | "image/jpeg", |
| | | "image/png", |
| | | "application/msword", |
| | | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" |
| | | ]; |
| | | |
| | | const maxSize = 10 * 1024 * 1024; // 10MB |
| | | |
| | | // 校验文件类型 |
| | | const isTypeOk = |
| | | allowedTypes.includes(file.type) || |
| | | file.name.endsWith(".pdf") || |
| | | file.name.endsWith(".jpg") || |
| | | file.name.endsWith(".jpeg") || |
| | | file.name.endsWith(".png") || |
| | | file.name.endsWith(".doc") || |
| | | file.name.endsWith(".docx"); |
| | | |
| | | if (!isTypeOk) { |
| | | this.$message.error( |
| | | "文件格式不支持,请上传pdf、jpg、png、doc或docx格式文件" |
| | | ); |
| | | return false; |
| | | } |
| | | |
| | | // 校验文件大小 |
| | | if (file.size > maxSize) { |
| | | this.$message.error("文件大小不能超过10MB"); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | }, |
| | | |
| | | // 文件选择变化 |
| | | handleFileChange(file, fileList) { |
| | | this.tempFileList = fileList; |
| | | }, |
| | | |
| | | // 移除临时文件 |
| | | handleTempRemove(file, fileList) { |
| | | this.tempFileList = fileList; |
| | | }, |
| | | |
| | | // 自定义上传请求 |
| | | handleHttpRequest(options) { |
| | | return new Promise((resolve, reject) => { |
| | | this.uploadLoading = true; |
| | | |
| | | // 模拟上传过程 |
| | | setTimeout(() => { |
| | | const newAttachment = { |
| | | id: Date.now(), |
| | | fileName: options.file.name, |
| | | fileUrl: URL.createObjectURL(options.file), |
| | | fileSize: options.file.size, |
| | | fileType: this.getFileExtension(options.file.name), |
| | | type: this.currentUploadType, // 记录附件类型 |
| | | uploadTime: new Date().toISOString(), |
| | | uploader: "当前用户" |
| | | }; |
| | | |
| | | // 添加到对应类型的附件列表 |
| | | if (this.attachmentData[this.currentUploadType]) { |
| | | this.attachmentData[this.currentUploadType].push(newAttachment); |
| | | } |
| | | |
| | | this.uploadLoading = false; |
| | | this.updateAssessannexField(); // 更新存储字段 |
| | | resolve({ code: 200, data: newAttachment }); |
| | | }, 1500); |
| | | }); |
| | | }, |
| | | |
| | | // 提交上传 |
| | | async submitUpload() { |
| | | if (this.tempFileList.length === 0) { |
| | | this.$message.warning("请先选择要上传的文件"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | for (const file of this.tempFileList) { |
| | | await this.$refs.uploadRef.submit(); |
| | | } |
| | | |
| | | this.$message.success("文件上传成功"); |
| | | this.uploadDialogVisible = false; |
| | | this.tempFileList = []; |
| | | } catch (error) { |
| | | this.$message.error("文件上传失败"); |
| | | console.error("上传失败:", error); |
| | | } |
| | | }, |
| | | |
| | | // 删除附件 |
| | | handleRemoveAttachment(type, index) { |
| | | this.$confirm("确定要删除这个附件吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | if (this.attachmentData[type] && this.attachmentData[type][index]) { |
| | | this.attachmentData[type].splice(index, 1); |
| | | this.$message.success("附件删除成功"); |
| | | this.updateAssessannexField(); // 更新存储字段 |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | |
| | | // 更新assessannex存储字段 |
| | | updateAssessannexField() { |
| | | // 将所有类型的附件合并为一个数组 |
| | | const allAttachments = []; |
| | | Object.values(this.attachmentData).forEach(attachments => { |
| | | allAttachments.push(...attachments); |
| | | }); |
| | | |
| | | // 更新到表单字段 |
| | | this.form.assessannex = JSON.stringify(allAttachments); |
| | | }, |
| | | |
| | | // 文件预览 |
| | | handlePreview(file) { |
| | | this.currentPreviewFile = { |
| | | fileName: file.fileName, |
| | | fileUrl: file.fileUrl, |
| | | fileType: this.getFileType(file.fileName) |
| | | }; |
| | | this.previewVisible = true; |
| | | }, |
| | | |
| | | // 文件下载 |
| | | handleDownload(file) { |
| | | const fileUrl = file.fileUrl; |
| | | const fileName = file.fileName; |
| | | |
| | | if (fileUrl) { |
| | | const link = document.createElement("a"); |
| | | link.href = fileUrl; |
| | | link.download = fileName; |
| | | link.style.display = "none"; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | this.$message.success("开始下载文件"); |
| | | } else { |
| | | this.$message.warning("文件路径不存在,无法下载"); |
| | | } |
| | | }, |
| | | |
| | | // 获取文件类型 |
| | | getFileType(fileName) { |
| | | if (!fileName) return "other"; |
| | | const extension = this.getFileExtension(fileName); |
| | | const imageTypes = ["jpg", "jpeg", "png"]; |
| | | const pdfTypes = ["pdf"]; |
| | | const officeTypes = ["doc", "docx"]; |
| | | |
| | | if (imageTypes.includes(extension)) return "image"; |
| | | if (pdfTypes.includes(extension)) return "pdf"; |
| | | if (officeTypes.includes(extension)) return "office"; |
| | | return "other"; |
| | | }, |
| | | |
| | | // 获取文件扩展名 |
| | | getFileExtension(filename) { |
| | | return filename |
| | | .split(".") |
| | | .pop() |
| | | .toLowerCase(); |
| | | }, |
| | | |
| | | // 文件大小格式化 |
| | | formatFileSize(size) { |
| | | if (!size) return "0 B"; |
| | | const k = 1024; |
| | | const sizes = ["B", "KB", "MB", "GB"]; |
| | | const i = Math.floor(Math.log(size) / Math.log(k)); |
| | | return parseFloat((size / Math.pow(k, i)).toFixed(2)) + " " + sizes[i]; |
| | | }, |
| | | |
| | | // 日期时间格式化 |
| | | formatDateTime(dateTime) { |
| | | if (!dateTime) return ""; |
| | | try { |
| | | const date = new Date(dateTime); |
| | | if (isNaN(date.getTime())) return dateTime; |
| | | |
| | | const year = date.getFullYear(); |
| | | const month = String(date.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(date.getDate()).padStart(2, "0"); |
| | | const hours = String(date.getHours()).padStart(2, "0"); |
| | | const minutes = String(date.getMinutes()).padStart(2, "0"); |
| | | |
| | | return `${year}-${month}-${day} ${hours}:${minutes}`; |
| | | } catch (error) { |
| | | return dateTime; |
| | | } |
| | | }, |
| | | |
| | | // 获取当前时间 |
| | | getCurrentTime() { |
| | | const now = new Date(); |
| | | return `${now.getFullYear()}-${(now.getMonth() + 1) |
| | | .toString() |
| | | .padStart(2, "0")}-${now |
| | | .getDate() |
| | | .toString() |
| | | .padStart(2, "0")} ${now |
| | | .getHours() |
| | | .toString() |
| | | .padStart(2, "0")}:${now |
| | | .getMinutes() |
| | | .toString() |
| | | .padStart(2, "0")}:${now |
| | | .getSeconds() |
| | | .toString() |
| | | .padStart(2, "0")}`; |
| | | }, |
| | | |
| | | // 保存确认信息 |
| | | async handleSave() { |
| | | try { |
| | | await this.$refs.form.validate(); |
| | | this.saveLoading = true; |
| | | |
| | | // 确保附件数据是最新的 |
| | | this.updateAssessannexField(); |
| | | |
| | | const saveData = { |
| | | ...this.form, |
| | | organdecision: this.organdecision.join(","), |
| | | organdecisionOther: this.organdecisionOther |
| | | // assessannex字段已在updateAssessannexField中更新 |
| | | }; |
| | | |
| | | const response = await relativesEdit(saveData); |
| | | |
| | | if (response.code === 200) { |
| | | this.$message.success("保存成功"); |
| | | this.$router.push("/case/affirm"); |
| | | } else { |
| | | this.$message.error("保存失败:" + (response.msg || "未知错误")); |
| | | } |
| | | } catch (error) { |
| | | if (error !== "cancel") { |
| | | console.error("保存失败:", error); |
| | | this.$message.error("保存失败"); |
| | | } |
| | | } finally { |
| | | this.saveLoading = false; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .confirm-overview { |
| | | padding: 10px 0; |
| | | .confirmation-detail { |
| | | padding: 20px; |
| | | } |
| | | |
| | | .overview-item { |
| | | .detail-card { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .attachment-card { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .detail-title { |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | margin-right: 20px; |
| | | } |
| | | |
| | | .attachment-section { |
| | | padding: 15px; |
| | | } |
| | | |
| | | .attachment-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 15px; |
| | | padding: 8px 0; |
| | | border-bottom: 1px solid #f0f0f0; |
| | | padding-bottom: 10px; |
| | | border-bottom: 1px solid #ebeef5; |
| | | } |
| | | |
| | | .overview-item .label { |
| | | .upload-title { |
| | | font-size: 14px; |
| | | font-weight: 600; |
| | | color: #303133; |
| | | } |
| | | |
| | | .attachment-list { |
| | | margin-top: 15px; |
| | | } |
| | | |
| | | .empty-attachment { |
| | | text-align: center; |
| | | padding: 40px 0; |
| | | color: #909399; |
| | | } |
| | | |
| | | .file-name { |
| | | font-size: 13px; |
| | | color: #606266; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .document-list { |
| | | padding: 10px 0; |
| | | } |
| | | |
| | | .document-item { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 12px; |
| | | padding: 8px 12px; |
| | | border: 1px solid #e4e7ed; |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .doc-info { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .consent-content { |
| | | padding: 20px; |
| | | line-height: 1.6; |
| | | } |
| | | </style> |