Jelajahi Sumber

电子图纸预览

wangxin 10 bulan lalu
induk
melakukan
b6a55eeaeb
1 mengubah file dengan 39 tambahan dan 0 penghapusan
  1. 39 0
      src/views/business/drawingRatify/index.vue

+ 39 - 0
src/views/business/drawingRatify/index.vue

@@ -176,6 +176,13 @@
             />
             <el-table-column label="操作" width="150" align="center">
               <template #default="scope">
+                <el-button
+                  link
+                  type="primary"
+                  @click="handlePreview(scope.row)"
+                >
+                  预览
+                </el-button>
                 <el-button
                   v-hasPermi="['business:electronicDrawings:raift']"
                   link
@@ -225,6 +232,10 @@ import { getTechnological } from "@/api/business/product";
 import { getTechnologicalProcessDetails } from "@/api/business/technologicalProcessDetail";
 const { proxy } = getCurrentInstance();
 const webHost = import.meta.env.VITE_APP_PRODUCTION_API;
+const hostIp = import.meta.env.VITE_HOST_IP;
+const hostUrl = import.meta.env.VITE_HOST_URL;
+const inNet = import.meta.env.VITE_HOST_INNET;
+const outNet = import.meta.env.VITE_HOST_OUTNET;
 /**字典数组 */
 const { equipment_status } = proxy.useDict("equipment_status");
 const { drawing_status } = proxy.useDict("drawing_status");
@@ -287,6 +298,34 @@ function handleNGdrawingDetail(row) {
     .catch(() => {});
 }
 
+/**预览 */
+function handlePreview(row) {
+  //0617预览不需要内嵌,新开一个标签页
+  // hostUrl+webHost+row.url 必须时文件全路径 不能转
+  // window.open(fileUrl + encodeURIComponent(Base64.encode(document.location.origin  + webHost + row.url)))
+  // // window.open(fileUrl+ encodeURIComponent(Base64.encode(document.location.host +webHost+row.url)))
+  // console.log('全路径:'+hostUrl+webHost+row.url)
+
+  console.log(document.location);
+  //0617预览不需要内嵌,新开一个标签页
+  // hostUrl+webHost+row.url 必须时文件全路径 不能转
+  var itemUrl = document.location.origin;
+  var fUrl = "";
+  var webUrl = "";
+  console.log(hostIp, itemUrl, 215);
+  console.log(document.location.origin + webHost + row.url);
+  if (itemUrl.includes(hostIp)) {
+    fUrl = inNet;
+    // webUrl = "http://192.168.10.41"
+  } else {
+    fUrl = outNet;
+    // webUrl = "http://36.129.132.128:401"
+  }
+  window.open(
+    fUrl + encodeURIComponent(Base64.encode(hostUrl + webHost + row.url))
+  );
+}
+
 /**通过按钮 */
 function saveDrawingDetail(row) {
   var itemList = [];