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

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

@ -6,7 +6,7 @@
:close-on-click-modal="false"
>
<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-col :span="4">
<img

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

Loading…
Cancel
Save