病例库-新增/修改预览时间/组件修改

main
ysn 1 week ago
parent 451e3f3388
commit b404633aa2
  1. 2
      src/views/cases/components/UltrasoundReportPrint.vue
  2. 131
      src/views/cases/detail.vue

@ -6,7 +6,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div id="print"> <div id="print">
<el-form ref="form" :model="form" label-width="90px" class="report-form"> <el-form ref="form" :model="report" label-width="90px" class="report-form">
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<img <img

@ -19,6 +19,7 @@
:data="form.attachment" :data="form.attachment"
:show-header="false" :show-header="false"
height="calc(100vh - 239px)" height="calc(100vh - 239px)"
@row-dblclick="handleAttachmentClick"
> >
<el-table-column align="center"> <el-table-column align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@ -42,7 +43,7 @@
<el-button <el-button
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDeleteImg(scope.row)" @click="handleDeleteImg(scope.row, scope.$index)"
v-if="form.status == 1 || form.status == 5" v-if="form.status == 1 || form.status == 5"
> >
删除 删除
@ -640,6 +641,7 @@ import { mapGetters } from "vuex";
// //
import UltrasoundReportPrint from "./components/UltrasoundReportPrint.vue"; import UltrasoundReportPrint from "./components/UltrasoundReportPrint.vue";
import CreateGroupDialog from "@/views/message/components/CreateGroupDialog"; import CreateGroupDialog from "@/views/message/components/CreateGroupDialog";
import { uploadFile } from "@/utils/requestMinio";
export default { export default {
name: "CaseDetail", name: "CaseDetail",
components: { components: {
@ -729,44 +731,21 @@ export default {
handleOpenFile() { handleOpenFile() {
this.$refs.fileInput.click(); this.$refs.fileInput.click();
}, },
async handleFileChange(e) { async handleFileChange(event) {
const files = e.target.files || []; const file = event.target.files[0];
for (let file of files) { if (!file) return;
// try {
if (!file.type.startsWith("image/")) { await this.uploadImageToMinIO(file);
this.$modal.msgError("只能上传图片文件"); } catch (error) {
continue; console.error("超声影像上传失败:", error);
} this.$modal.msgError("超声影像上传失败: " + error.message);
} finally {
// URL //
const previewUrl = URL.createObjectURL(file); event.target.value = "";
//
const tempId = Date.now();
this.form.attachment.push({
id: tempId,
previewUrl,
uploading: true,
uploadPercent: 0,
file, //
});
//
try {
await this.uploadImageToMinIO(tempId, file);
} catch (error) {
console.error("影像上传失败:", error);
this.$modal.msgError(`上传失败:${error.message}`);
//
this.form.attachment = this.form.attachment.filter(
(i) => i.id !== tempId
);
}
} }
e.target.value = "";
}, },
// MinIO // MinIO
async uploadImageToMinIO(tempId, file) { async uploadImageToMinIO(file) {
try { try {
// MinIO // MinIO
await this.ensureMinioInitialized(); await this.ensureMinioInitialized();
@ -775,55 +754,31 @@ export default {
const bucket = config.MINIO_BUCKET_REPORT || "remote-avatar-test"; const bucket = config.MINIO_BUCKET_REPORT || "remote-avatar-test";
const timestamp = Date.now(); const timestamp = Date.now();
const ext = file.name.split(".").pop() || "png"; const ext = file.name.split(".").pop() || "png";
const fileNameWithoutExt = file.name.replace(/\.[^/.]+$/, ""); const fileName = `${timestamp}.${ext}`;
const randomStr = Math.random().toString(36).substr(2, 6); const objectName = `attachments/${this.form.id}/${fileName}`;
//
const objectKey = `attachments/${
this.form.id || 0
}/${fileNameWithoutExt}.${timestamp}_${randomStr}_big.${ext}`;
//
const objectCompress = `attachments/${
this.form.id || 0
}/${fileNameWithoutExt}.${timestamp}_${randomStr}_small.${ext}`;
console.log( console.log(
`Uploading ultrasound image to bucket: ${bucket}, object: ${objectKey}` `Uploading avatar to bucket: ${bucket}, object: ${objectName}`
); );
// 使 MinIO // 使 MinIO
const result = await uploadFile( const result = await uploadFile(
bucket, bucket,
objectKey, objectName,
file, file,
{}, {},
(percent) => { (percent) => {}
//
const item = this.form.attachment.find((i) => i.id === tempId);
if (item) {
item.uploadPercent = Math.round(percent);
}
}
); );
console.log("MinIO 上传成功:", result); console.log("MinIO 上传成功:", result);
this.form.attachment.push({
// - bucketName: bucket,
const item = this.form.attachment.find((i) => i.id === tempId); bucket_compress: bucket,
if (item) { fileType: "CT",
item.bucketName = bucket; objectKey: objectName,
item.bucket_compress = bucket; object_compress: objectName,
item.fileType = "CT"; showInDoc: 0,
item.objectKey = objectKey; });
item.object_compress = objectCompress;
item.showInDoc = 0;
item.uploading = false;
item.uploadPercent = 100;
delete item.file; //
delete item.previewUrl; // URL
}
this.$message.success("影像上传成功");
} catch (error) { } catch (error) {
throw error; throw error;
} }
@ -836,13 +791,19 @@ export default {
await this.$store.dispatch("GetNetConfig"); await this.$store.dispatch("GetNetConfig");
} }
}, },
handleDeleteImg(row) { handleAttachmentClick(row) {
this.$confirm("确定删除该影像?").then(() => { row.showInDoc = 1;
this.form.attachment = this.form.attachment.filter( },
(i) => i.id !== row.id handleDeleteImg(row, index) {
); this.$modal
this.$message.success("删除成功"); .confirm("确定删除该影像?")
}); .then(function () {
return this.form.attachment.splice(index, 1);
})
.then(() => {
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}, },
// //
getReportInfo(id) { getReportInfo(id) {
@ -877,6 +838,7 @@ export default {
// // // //
return postReportEdit({ return postReportEdit({
// //
attachment: JSON.stringify(form.attachment || []),
area_number: form.area_number || "", area_number: form.area_number || "",
bed_number: form.bed_number || "", bed_number: form.bed_number || "",
comment: form.comment || "", comment: form.comment || "",
@ -936,7 +898,12 @@ export default {
this.$refs.UltrasoundReportPrintRef.print(this.form); this.$refs.UltrasoundReportPrintRef.print(this.form);
}, },
handleClose() { handleClose() {
this.$router.back(); this.$modal
.confirm("尚有修改未提交,是否确定退出")
.then(() => {
this.$router.back();
})
.catch(() => {});
}, },
handleShare() { handleShare() {
this.$refs.createGroupDialogRef.show(); this.$refs.createGroupDialogRef.show();

Loading…
Cancel
Save