From f806aff5702fc6be9c9348d51964366cbf434bf7 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期四, 11 六月 2026 09:43:39 +0800
Subject: [PATCH] 维护
---
src/views/business/decide/DecideInfo.vue | 91 +++++++++++++++++++++++++++++++++------------
1 files changed, 67 insertions(+), 24 deletions(-)
diff --git a/src/views/business/decide/DecideInfo.vue b/src/views/business/decide/DecideInfo.vue
index 894015e..cdc5db6 100644
--- a/src/views/business/decide/DecideInfo.vue
+++ b/src/views/business/decide/DecideInfo.vue
@@ -502,6 +502,13 @@
</el-button>
</div>
</el-dialog>
+ <!-- 闄勪欢棰勮 -->
+ <FilePreviewDialog
+ :visible="previewVisible"
+ :file="currentPreviewFile"
+ @close="previewVisible = false"
+ @download="handleDownload"
+ />
</div>
</template>
@@ -513,10 +520,11 @@
} from "@/api/businessApi";
import { getToken } from "@/utils/auth";
import CaseBasicInfo from "@/components/CaseBasicInfo";
+import FilePreviewDialog from "@/components/FilePreviewDialog";
export default {
name: "DeathJudgmentDetail",
- components: { CaseBasicInfo },
+ components: { CaseBasicInfo, FilePreviewDialog },
data() {
return {
@@ -527,7 +535,9 @@
// 鍒ゅ畾绫诲瀷鏍囩
activeJudgmentType: "brain", // 榛樿鏄剧ず鑴戞浜�
-
+ // 棰勮鐩稿叧
+ previewVisible: false,
+ currentPreviewFile: null,
// 琛ㄥ崟鏁版嵁
form: {
id: undefined,
@@ -1000,30 +1010,63 @@
},
// 棰勮闄勪欢
- handlePreview(attachment) {
- 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}">`,
- "鍥剧墖棰勮",
- {
- dangerouslyUseHTMLString: true,
- customClass: "image-preview-dialog"
- }
- );
- } else {
- this.$message.info("璇ユ枃浠剁被鍨嬫殏涓嶆敮鎸佸湪绾块瑙堬紝璇蜂笅杞藉悗鏌ョ湅");
- }
- },
+ handlePreview(file) {
+ console.log(file, "file");
+ this.currentPreviewFile = {
+ fileName: file.fileName,
+ fileUrl: file.path || file.fileUrl,
+ fileType: this.getFileType(file.fileName)
+ };
+ this.previewVisible = true;
+ // 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}">`,
+ // "鍥剧墖棰勮",
+ // {
+ // dangerouslyUseHTMLString: true,
+ // customClass: "image-preview-dialog"
+ // }
+ // );
+ // } else {
+ // this.$message.info("璇ユ枃浠剁被鍨嬫殏涓嶆敮鎸佸湪绾块瑙堬紝璇蜂笅杞藉悗鏌ョ湅");
+ // }
+ },
+ getFileType(fileName) {
+ if (!fileName) return "other";
+
+ const extension = fileName
+ .split(".")
+ .pop()
+ .toLowerCase();
+ const imageTypes = ["jpg", "jpeg", "png", "gif", "bmp", "webp"];
+ const pdfTypes = ["pdf"];
+ const officeTypes = ["doc", "docx", "xls", "xlsx", "ppt", "pptx"];
+
+ if (imageTypes.includes(extension)) return "image";
+ if (pdfTypes.includes(extension)) return "pdf";
+ if (officeTypes.includes(extension)) return "office";
+ return "other";
+ },
// 涓嬭浇闄勪欢
- handleDownload(attachment) {
- const link = document.createElement("a");
- link.href = attachment.fileUrl;
- link.download = attachment.fileName;
- link.click();
- this.$message.success(`寮�濮嬩笅杞�: ${attachment.fileName}`);
+ handleDownload(file) {
+ const fileUrl = file.path || 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("鏂囦欢璺緞涓嶅瓨鍦紝鏃犳硶涓嬭浇");
+ }
},
// 缂栬緫淇℃伅
--
Gitblit v1.9.3