| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-form-item label="判定医生" prop="judgmentDoctor"> |
| | | <el-input v-model="form.judgmentDoctor" :readonly="!isEdit" /> |
| | | <el-form-item label="判定医生一" prop="judgmentDoctor"> |
| | | <el-input v-model="form.judgmentDoctorone" :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> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="8"> |
| | | <el-form-item label="登记人" prop="registrant"> |
| | | <el-input v-model="form.registrant" :readonly="!isEdit" /> |
| | |
| | | |
| | | <el-table-column label="文件类型" width="100" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-tag size="small">{{ getFileType(scope.row.fileName) }}</el-tag> |
| | | <el-tag size="small">{{ |
| | | getFileType(scope.row.fileName) |
| | | }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column |
| | | label="操作" |
| | | width="180" |
| | | align="center" |
| | | > |
| | | <el-table-column label="操作" width="180" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | |
| | | v-if="getAttachmentsByType(type.value).length === 0" |
| | | class="empty-attachment" |
| | | > |
| | | <el-empty description="暂无评估表附件" :image-size="80"></el-empty> |
| | | <el-empty |
| | | description="暂无评估表附件" |
| | | :image-size="80" |
| | | ></el-empty> |
| | | </div> |
| | | </div> |
| | | </el-tab-pane> |
| | |
| | | :auto-upload="false" |
| | | > |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text">将评估表文件拖到此处,或<em>点击上传</em></div> |
| | | <div class="el-upload__text"> |
| | | 将评估表文件拖到此处,或<em>点击上传</em> |
| | | </div> |
| | | <div class="el-upload__tip" slot="tip"> |
| | | 支持上传pdf、jpg、png、doc、docx、xls、xlsx格式文件,单个文件不超过10MB |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getDeathJudgmentDetail, updateDeathJudgment } from "./api/mockDeathJudgmentApi"; |
| | | import { |
| | | getDeathJudgmentDetail, |
| | | updateDeathJudgment |
| | | } from "./api/mockDeathJudgmentApi"; |
| | | |
| | | export default { |
| | | name: "DeathJudgmentDetail", |
| | |
| | | }, |
| | | created() { |
| | | const id = this.$route.query.id; |
| | | this.isEdit = this.$route.path.includes('/edit') || this.$route.path.includes('/add'); |
| | | if (id && !this.$route.path.includes('/add')) { |
| | | this.isEdit = |
| | | this.$route.path.includes("/edit") || this.$route.path.includes("/add"); |
| | | if (id && !this.$route.path.includes("/add")) { |
| | | this.getDetail(id); |
| | | } else if (this.$route.path.includes('/add')) { |
| | | } else if (this.$route.path.includes("/add")) { |
| | | this.generateHospitalNo(); |
| | | } |
| | | this.getAttachmentList(); |
| | | }, |
| | | methods: { |
| | | // 生成案例编号 |
| | | // 生成住院号 |
| | | generateHospitalNo() { |
| | | // 模拟生成案例编号:D + 时间戳后6位 |
| | | // 模拟生成住院号:D + 时间戳后6位 |
| | | const timestamp = Date.now().toString(); |
| | | this.form.hospitalNo = 'D' + timestamp.slice(-6); |
| | | this.form.hospitalNo = "D" + timestamp.slice(-6); |
| | | }, |
| | | // 获取详情 |
| | | getDetail(id) { |
| | |
| | | }, |
| | | // 获取文件类型 |
| | | getFileType(fileName) { |
| | | const ext = fileName.split('.').pop().toLowerCase(); |
| | | const ext = fileName |
| | | .split(".") |
| | | .pop() |
| | | .toLowerCase(); |
| | | const typeMap = { |
| | | 'pdf': 'PDF', |
| | | 'doc': 'DOC', |
| | | 'docx': 'DOCX', |
| | | 'xls': 'XLS', |
| | | 'xlsx': 'XLSX', |
| | | 'jpg': 'JPG', |
| | | 'jpeg': 'JPEG', |
| | | 'png': 'PNG' |
| | | pdf: "PDF", |
| | | doc: "DOC", |
| | | docx: "DOCX", |
| | | xls: "XLS", |
| | | xlsx: "XLSX", |
| | | jpg: "JPG", |
| | | jpeg: "JPEG", |
| | | png: "PNG" |
| | | }; |
| | | return typeMap[ext] || ext.toUpperCase(); |
| | | }, |
| | |
| | | // 上传前校验 |
| | | beforeUpload(file) { |
| | | const allowedTypes = [ |
| | | 'application/pdf', |
| | | 'image/jpeg', |
| | | 'image/png', |
| | | 'application/msword', |
| | | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
| | | 'application/vnd.ms-excel', |
| | | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
| | | "application/pdf", |
| | | "image/jpeg", |
| | | "image/png", |
| | | "application/msword", |
| | | "application/vnd.openxmlformats-officedocument.wordprocessingml.document", |
| | | "application/vnd.ms-excel", |
| | | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" |
| | | ]; |
| | | |
| | | 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') || |
| | | file.name.endsWith('.xls') || |
| | | file.name.endsWith('.xlsx'); |
| | | 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") || |
| | | file.name.endsWith(".xls") || |
| | | file.name.endsWith(".xlsx"); |
| | | |
| | | if (!isTypeOk) { |
| | | this.$message.error('文件格式不支持,请上传pdf、jpg、png、doc、docx、xls或xlsx格式文件'); |
| | | this.$message.error( |
| | | "文件格式不支持,请上传pdf、jpg、png、doc、docx、xls或xlsx格式文件" |
| | | ); |
| | | return false; |
| | | } |
| | | |
| | | // 校验文件大小 |
| | | if (file.size > maxSize) { |
| | | this.$message.error('文件大小不能超过10MB'); |
| | | this.$message.error("文件大小不能超过10MB"); |
| | | return false; |
| | | } |
| | | |
| | |
| | | // 提交上传 |
| | | async submitUpload() { |
| | | if (this.tempFileList.length === 0) { |
| | | this.$message.warning('请先选择要上传的文件'); |
| | | this.$message.warning("请先选择要上传的文件"); |
| | | return; |
| | | } |
| | | |
| | |
| | | fileName: file.name, |
| | | fileSize: file.size, |
| | | uploadTime: new Date().toISOString(), |
| | | uploader: '当前用户', |
| | | uploader: "当前用户", |
| | | fileUrl: URL.createObjectURL(file.raw) |
| | | }; |
| | | |
| | | this.attachmentList.push(newAttachment); |
| | | } |
| | | |
| | | this.$message.success('文件上传成功'); |
| | | this.$message.success("文件上传成功"); |
| | | this.uploadDialogVisible = false; |
| | | this.tempFileList = []; |
| | | } catch (error) { |
| | | this.$message.error('文件上传失败'); |
| | | console.error('上传失败:', error); |
| | | this.$message.error("文件上传失败"); |
| | | console.error("上传失败:", error); |
| | | } finally { |
| | | this.uploadLoading = false; |
| | | } |
| | | }, |
| | | // 删除附件 |
| | | handleRemoveAttachment(attachment) { |
| | | this.$confirm('确定要删除这个评估表附件吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const index = this.attachmentList.findIndex(item => item.id === attachment.id); |
| | | if (index !== -1) { |
| | | this.attachmentList.splice(index, 1); |
| | | this.$message.success('评估表删除成功'); |
| | | } |
| | | }).catch(() => {}); |
| | | this.$confirm("确定要删除这个评估表附件吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | const index = this.attachmentList.findIndex( |
| | | item => item.id === attachment.id |
| | | ); |
| | | if (index !== -1) { |
| | | this.attachmentList.splice(index, 1); |
| | | this.$message.success("评估表删除成功"); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | // 预览附件 |
| | | handlePreview(attachment) { |
| | | if (attachment.fileName.endsWith('.pdf')) { |
| | | window.open(attachment.fileUrl, '_blank'); |
| | | if (attachment.fileName.endsWith(".pdf")) { |
| | | window.open(attachment.fileUrl, "_blank"); |
| | | } else if (attachment.fileName.match(/\.(jpg|jpeg|png)$/i)) { |
| | | this.$alert(`<img src="${attachment.fileUrl}" style="max-width: 100%;" alt="${attachment.fileName}">`, |
| | | '图片预览', { |
| | | this.$alert( |
| | | `<img src="${attachment.fileUrl}" style="max-width: 100%;" alt="${attachment.fileName}">`, |
| | | "图片预览", |
| | | { |
| | | dangerouslyUseHTMLString: true, |
| | | customClass: 'image-preview-dialog' |
| | | }); |
| | | customClass: "image-preview-dialog" |
| | | } |
| | | ); |
| | | } else { |
| | | this.$message.info('该文件类型暂不支持在线预览,请下载后查看'); |
| | | this.$message.info("该文件类型暂不支持在线预览,请下载后查看"); |
| | | } |
| | | }, |
| | | // 下载附件 |
| | | handleDownload(attachment) { |
| | | // 实际项目中调用下载接口 |
| | | const link = document.createElement('a'); |
| | | const link = document.createElement("a"); |
| | | link.href = attachment.fileUrl; |
| | | link.download = attachment.fileName; |
| | | link.click(); |
| | |
| | | updateDeathJudgment(this.form) |
| | | .then(response => { |
| | | if (response.code === 200) { |
| | | this.$message.success('保存成功'); |
| | | if (this.$route.path.includes('/add')) { |
| | | this.$router.push('/case/deathJudgment'); |
| | | this.$message.success("保存成功"); |
| | | if (this.$route.path.includes("/add")) { |
| | | this.$router.push("/case/deathJudgment"); |
| | | } else { |
| | | this.isEdit = false; |
| | | } |
| | | } |
| | | }) |
| | | .catch(error => { |
| | | console.error('保存失败:', error); |
| | | this.$message.error('保存失败'); |
| | | console.error("保存失败:", error); |
| | | this.$message.error("保存失败"); |
| | | }) |
| | | .finally(() => { |
| | | this.saveLoading = false; |
| | |
| | | }, |
| | | // 文件大小格式化 |
| | | formatFileSize(size) { |
| | | if (size === 0) return '0 B'; |
| | | if (size === 0) return "0 B"; |
| | | const k = 1024; |
| | | const sizes = ['B', 'KB', 'MB', 'GB']; |
| | | 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]; |
| | | return parseFloat((size / Math.pow(k, i)).toFixed(2)) + " " + sizes[i]; |
| | | }, |
| | | // 时间格式化 |
| | | parseTime(time) { |
| | | if (!time) return ''; |
| | | if (!time) return ""; |
| | | const date = new Date(time); |
| | | return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`; |
| | | return `${date.getFullYear()}-${(date.getMonth() + 1) |
| | | .toString() |
| | | .padStart(2, "0")}-${date |
| | | .getDate() |
| | | .toString() |
| | | .padStart(2, "0")} ${date |
| | | .getHours() |
| | | .toString() |
| | | .padStart(2, "0")}:${date |
| | | .getMinutes() |
| | | .toString() |
| | | .padStart(2, "0")}`; |
| | | } |
| | | } |
| | | }; |