From 112912730c477a64f7b27086794a3bc30e6787c7 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 03 十一月 2026 13:22:14 +0800
Subject: [PATCH] feat: 设备实时报警订阅与监控/巡检页面优化

---
 src/views/environmentAccess/intelligentInspectionManagement/index.vue |   49 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/src/views/environmentAccess/intelligentInspectionManagement/index.vue b/src/views/environmentAccess/intelligentInspectionManagement/index.vue
index d68f5d1..a1317de 100644
--- a/src/views/environmentAccess/intelligentInspectionManagement/index.vue
+++ b/src/views/environmentAccess/intelligentInspectionManagement/index.vue
@@ -327,12 +327,51 @@
 }
 
 async function copyReport() {
-  try {
-    await navigator.clipboard.writeText(current.value.reportContent || "");
-    proxy.$modal.msgSuccess("鎶ュ憡宸插鍒�");
-  } catch (e) {
-    proxy.$modal.msgWarning("澶嶅埗澶辫触锛岃鎵嬪姩閫夋嫨鏂囨湰");
+  const text = String(current.value.reportContent || "");
+  if (!text) {
+    proxy.$modal.msgWarning("鏆傛棤鍙鍒剁殑鎶ュ憡鍐呭");
+    return;
   }
+  if (await copyText(text)) {
+    proxy.$modal.msgSuccess("鎶ュ憡宸插鍒�");
+  } else {
+    proxy.$modal.msgError("澶嶅埗澶辫触锛岃妫�鏌ユ祻瑙堝櫒鍓创鏉挎潈闄�");
+  }
+}
+
+async function copyText(text) {
+  // HTTPS/localhost 浼樺厛浣跨敤鏍囧噯鍓创鏉挎帴鍙c��
+  if (window.isSecureContext && navigator.clipboard?.writeText) {
+    try {
+      await navigator.clipboard.writeText(text);
+      return true;
+    } catch (e) {
+      // 鏉冮檺琚嫆缁濇椂缁х画浣跨敤鍏煎鏂规銆�
+    }
+  }
+
+  const textarea = document.createElement("textarea");
+  const activeElement = document.activeElement;
+  textarea.value = text;
+  textarea.setAttribute("readonly", "");
+  textarea.style.position = "fixed";
+  textarea.style.left = "-9999px";
+  textarea.style.top = "0";
+  textarea.style.opacity = "0";
+  document.body.appendChild(textarea);
+  textarea.focus();
+  textarea.select();
+  textarea.setSelectionRange(0, textarea.value.length);
+  let copied = false;
+  try {
+    copied = document.execCommand("copy");
+  } catch (e) {
+    copied = false;
+  } finally {
+    document.body.removeChild(textarea);
+    activeElement?.focus?.();
+  }
+  return copied;
 }
 
 const sourceText = v => ({ video: "瑙嗛鍒嗘瀽", drone: "鏃犱汉鏈�", robot: "宸℃鏈哄櫒浜�", manual: "浜哄伐缁堢" }[v] || "浜哄伐缁堢");

--
Gitblit v1.9.3