| | |
| | | > |
| | | 保存信息 |
| | | </el-button> |
| | | <el-button |
| | | v-else |
| | | type="primary" |
| | | style="float: right; padding: 3px 0" |
| | | @click="handleEdit" |
| | | > |
| | | 编辑信息 |
| | | </el-button> |
| | | </div> |
| | | |
| | | <el-form :model="form" ref="form" :rules="rules" label-width="120px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="住院号" prop="hospitalNo"> |
| | | <el-form-item label="捐献者编号" prop="donorno"> |
| | | <el-input |
| | | v-model="form.hospitalNo" |
| | | v-model="form.donorno" |
| | | :readonly="!isEdit" |
| | | placeholder="自动生成 D+数字" |
| | | placeholder="自动生成捐献者编号" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="捐献者姓名" prop="donorName"> |
| | | <el-input v-model="form.donorName" :readonly="!isEdit" /> |
| | | <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="gender"> |
| | | <el-form-item label="性别" prop="sex"> |
| | | <el-select |
| | | v-model="form.gender" |
| | | v-model="form.sex" |
| | | :disabled="!isEdit" |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="男" value="0" /> |
| | | <el-option label="女" value="1" /> |
| | | <el-option label="男" value="1" /> |
| | | <el-option label="女" value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="疾病诊断" prop="diagnosis"> |
| | | <el-input v-model="form.diagnosis" :readonly="!isEdit" /> |
| | | <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-form-item label="死亡原因" prop="deathreason"> |
| | | <el-select |
| | | v-model="form.deathReason" |
| | | v-model="form.deathreason" |
| | | :disabled="!isEdit" |
| | | style="width: 100%" |
| | | > |
| | |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="死亡时间" prop="deathTime"> |
| | | <el-form-item label="死亡时间" prop="deathtime"> |
| | | <el-date-picker |
| | | v-model="form.deathTime" |
| | | v-model="form.deathtime" |
| | | type="datetime" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | style="width: 100%" |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="判定医生一" prop="judgmentDoctor"> |
| | | <el-input v-model="form.judgmentDoctorone" :readonly="!isEdit" /> |
| | | <el-col :span="8"> |
| | | <el-form-item label="判定医生一" prop="deathjudgedocto"> |
| | | <el-input v-model="form.deathjudgedocto" :readonly="!isEdit" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="判定医生二" prop="judgmentDoctor"> |
| | | <el-input v-model="form.judgmentDoctortwo" :readonly="!isEdit" /> |
| | | <el-form-item label="判定医生二" prop="deathjudgedoctt"> |
| | | <el-input v-model="form.deathjudgedoctt" :readonly="!isEdit" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="8"> |
| | | <el-form-item label="登记人" prop="registrant"> |
| | | <el-input v-model="form.registrant" :readonly="!isEdit" /> |
| | | <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> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getDeathJudgmentDetail, updateDeathJudgment } from "./mockDeathJudgmentApi"; |
| | | import { deathinfoedit, deathinfoInfo } from "@/api/businessApi"; |
| | | |
| | | export default { |
| | | name: "DeathJudgmentDetail", |
| | |
| | | // 表单数据 |
| | | form: { |
| | | id: undefined, |
| | | hospitalNo: "", |
| | | donorName: "", |
| | | gender: "", |
| | | infoid: undefined, |
| | | donorno: "", |
| | | name: "", |
| | | sex: "", |
| | | age: "", |
| | | diagnosis: "", |
| | | deathReason: "", |
| | | deathTime: "", |
| | | judgmentDoctor: "", |
| | | judgmentDescription: "", |
| | | registrant: "", |
| | | registrationTime: "" |
| | | diagnosisname: "", |
| | | deathreason: "", |
| | | deathtime: "", |
| | | deathjudgedocto: "", |
| | | deathjudgedoctt: "", |
| | | gainhospitalno: "", |
| | | gainhospitalname: "", |
| | | isspendremember: 0, |
| | | isrestoreremains: 0, |
| | | rememberannex: "", |
| | | responsibleuserid: "", |
| | | responsibleusername: "", |
| | | recordstate: "0", |
| | | judgmentDescription: "" |
| | | }, |
| | | // 表单验证规则 |
| | | rules: { |
| | | donorName: [ |
| | | name: [ |
| | | { required: true, message: "捐献者姓名不能为空", trigger: "blur" } |
| | | ], |
| | | deathReason: [ |
| | | deathreason: [ |
| | | { required: true, message: "死亡原因不能为空", trigger: "change" } |
| | | ], |
| | | deathTime: [ |
| | | deathtime: [ |
| | | { required: true, message: "死亡时间不能为空", trigger: "change" } |
| | | ], |
| | | judgmentDoctor: [ |
| | | { required: true, message: "判定医生不能为空", trigger: "blur" } |
| | | deathjudgedocto: [ |
| | | { required: true, message: "判定医生一不能为空", trigger: "blur" } |
| | | ] |
| | | }, |
| | | // 附件相关数据 |
| | |
| | | if (id && !this.$route.path.includes('/add')) { |
| | | this.getDetail(id); |
| | | } else if (this.$route.path.includes('/add')) { |
| | | this.generateHospitalNo(); |
| | | this.generateDonorNo(); |
| | | } |
| | | this.getAttachmentList(); |
| | | }, |
| | | methods: { |
| | | // 生成住院号 |
| | | generateHospitalNo() { |
| | | // 模拟生成住院号:D + 时间戳后6位 |
| | | // 生成捐献者编号 |
| | | generateDonorNo() { |
| | | const timestamp = Date.now().toString(); |
| | | this.form.hospitalNo = 'D' + timestamp.slice(-6); |
| | | this.form.donorno = 'DONOR' + timestamp.slice(-8); |
| | | }, |
| | | // 获取详情 |
| | | getDetail(id) { |
| | | getDeathJudgmentDetail(id).then(response => { |
| | | if (response.code === 200) { |
| | | this.form = response.data; |
| | | async getDetail(id) { |
| | | try { |
| | | const response = await deathinfoInfo({ id }); |
| | | let realData = {}; |
| | | |
| | | if (response && response.data) { |
| | | realData = response.data; |
| | | } else if (response) { |
| | | realData = response; |
| | | } |
| | | }); |
| | | |
| | | // 映射字段到表单 |
| | | this.form = { |
| | | ...this.form, |
| | | ...realData, |
| | | // 确保数值类型字段正确转换 |
| | | isspendremember: realData.isspendremember ? parseInt(realData.isspendremember) : 0, |
| | | isrestoreremains: realData.isrestoreremains ? parseInt(realData.isrestoreremains) : 0 |
| | | }; |
| | | |
| | | // 解析附件信息 |
| | | if (realData.rememberannex) { |
| | | this.parseAttachmentData(realData.rememberannex); |
| | | } |
| | | |
| | | } catch (error) { |
| | | console.error('获取死亡判定详情失败:', error); |
| | | this.$message.error('数据加载失败'); |
| | | } |
| | | }, |
| | | // 解析附件数据 |
| | | parseAttachmentData(attachmentJson) { |
| | | try { |
| | | if (attachmentJson) { |
| | | const attachments = JSON.parse(attachmentJson); |
| | | if (Array.isArray(attachments)) { |
| | | this.attachmentList = attachments; |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.error('解析附件数据失败:', error); |
| | | } |
| | | }, |
| | | // 构建附件JSON数据 |
| | | buildAttachmentJson() { |
| | | return JSON.stringify(this.attachmentList); |
| | | }, |
| | | // 获取状态标签样式 |
| | | getStatusTag(status) { |
| | | const statusMap = { |
| | | "0": "warning", // 维护中 |
| | | "1": "success", // 已完成 |
| | | "99": "danger" // 已终止 |
| | | }; |
| | | return statusMap[status] || "info"; |
| | | }, |
| | | // 获取状态文本 |
| | | getStatusText(status) { |
| | | const textMap = { |
| | | "0": "维护中", |
| | | "1": "已完成", |
| | | "99": "已终止" |
| | | }; |
| | | return textMap[status] || "未知状态"; |
| | | }, |
| | | // 获取附件列表 |
| | | getAttachmentList() { |
| | | this.attachmentLoading = true; |
| | | // 模拟附件数据 - 实际项目中从接口获取 |
| | | // 实际项目中从接口获取附件数据 |
| | | setTimeout(() => { |
| | | this.attachmentList = [ |
| | | { |
| | | id: 1, |
| | | type: "1", |
| | | typeName: "脑死亡判定表", |
| | | fileName: "脑死亡判定表_202512001.pdf", |
| | | fileSize: 2548321, |
| | | uploadTime: "2025-12-01 10:30:00", |
| | | uploader: "张医生", |
| | | fileUrl: "/attachments/brain_death_1.pdf" |
| | | }, |
| | | { |
| | | id: 2, |
| | | type: "2", |
| | | typeName: "脑电图评估表", |
| | | fileName: "脑电图评估表_202512001.docx", |
| | | fileSize: 512345, |
| | | uploadTime: "2025-12-01 14:20:00", |
| | | uploader: "李医生", |
| | | fileUrl: "/attachments/eeg_1.docx" |
| | | } |
| | | ]; |
| | | this.attachmentLoading = false; |
| | | }, 500); |
| | | }, |
| | |
| | | |
| | | const maxSize = 10 * 1024 * 1024; // 10MB |
| | | |
| | | // 校验文件类型 |
| | | const isTypeOk = allowedTypes.includes(file.type) || |
| | | file.name.endsWith('.pdf') || |
| | | file.name.endsWith('.jpg') || |
| | |
| | | return false; |
| | | } |
| | | |
| | | // 校验文件大小 |
| | | if (file.size > maxSize) { |
| | | this.$message.error('文件大小不能超过10MB'); |
| | | return false; |
| | |
| | | this.uploadLoading = true; |
| | | |
| | | try { |
| | | // 模拟上传过程 - 实际项目中调用上传接口 |
| | | for (const file of this.tempFileList) { |
| | | const newAttachment = { |
| | | id: Date.now() + Math.random(), |
| | |
| | | |
| | | this.attachmentList.push(newAttachment); |
| | | } |
| | | |
| | | // 更新附件JSON数据到表单 |
| | | this.form.rememberannex = this.buildAttachmentJson(); |
| | | |
| | | this.$message.success('文件上传成功'); |
| | | this.uploadDialogVisible = false; |
| | |
| | | const index = this.attachmentList.findIndex(item => item.id === attachment.id); |
| | | if (index !== -1) { |
| | | this.attachmentList.splice(index, 1); |
| | | // 更新附件JSON数据到表单 |
| | | this.form.rememberannex = this.buildAttachmentJson(); |
| | | this.$message.success('评估表删除成功'); |
| | | } |
| | | }).catch(() => {}); |
| | |
| | | }, |
| | | // 下载附件 |
| | | handleDownload(attachment) { |
| | | // 实际项目中调用下载接口 |
| | | const link = document.createElement('a'); |
| | | link.href = attachment.fileUrl; |
| | | link.download = attachment.fileName; |
| | | link.click(); |
| | | this.$message.success(`开始下载: ${attachment.fileName}`); |
| | | }, |
| | | // 编辑信息 |
| | | handleEdit() { |
| | | this.isEdit = true; |
| | | }, |
| | | // 保存信息 |
| | | handleSave() { |
| | | this.$refs.form.validate(valid => { |
| | | async handleSave() { |
| | | this.$refs.form.validate(async valid => { |
| | | if (valid) { |
| | | this.saveLoading = true; |
| | | |
| | | // 模拟保存过程 |
| | | updateDeathJudgment(this.form) |
| | | .then(response => { |
| | | if (response.code === 200) { |
| | | this.$message.success('保存成功'); |
| | | if (this.$route.path.includes('/add')) { |
| | | this.$router.push('/case/deathJudgment'); |
| | | } else { |
| | | this.isEdit = false; |
| | | } |
| | | try { |
| | | // 构建提交数据 |
| | | const submitData = { |
| | | ...this.form, |
| | | // 确保附件数据最新 |
| | | rememberannex: this.buildAttachmentJson() |
| | | }; |
| | | |
| | | const response = await deathinfoedit(submitData); |
| | | |
| | | if (response.code === 200) { |
| | | this.$message.success('保存成功'); |
| | | this.isEdit = false; |
| | | |
| | | if (this.$route.path.includes('/add')) { |
| | | this.$router.push('/case/deathJudgment'); |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | console.error('保存失败:', error); |
| | | this.$message.error('保存失败'); |
| | | }) |
| | | .finally(() => { |
| | | this.saveLoading = false; |
| | | }); |
| | | } else { |
| | | this.$message.error(response.message || '保存失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('保存失败:', error); |
| | | this.$message.error('保存失败'); |
| | | } finally { |
| | | this.saveLoading = false; |
| | | } |
| | | } |
| | | }); |
| | | }, |