Explorar el Código

图纸预览测试

wangxin hace 10 meses
padre
commit
6092ed50a8
Se han modificado 1 ficheros con 40 adiciones y 1 borrados
  1. 40 1
      src/views/business/drawingAuditing/index.vue

+ 40 - 1
src/views/business/drawingAuditing/index.vue

@@ -145,7 +145,17 @@
               align="center"
             />
             <el-table-column label="工序" prop="processAlias" align="center" />
-            <el-table-column label="图纸" prop="drawingName" align="center" />
+            <el-table-column label="图纸" prop="drawingName" align="center">
+              <template #default="scope">
+                <el-button
+                  link
+                  type="primarypr"
+                  @click="handlePreview(scope.row)"
+                >
+                  <span>{{ scope.row.drawingName }}</span>
+                </el-button>
+              </template>
+            </el-table-column>
             <el-table-column label="类型" prop="pattern" align="center" />
             <el-table-column
               label="状态"
@@ -209,6 +219,7 @@ 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 { equipment_status } = proxy.useDict("equipment_status");
 const { yes_no } = proxy.useDict("yes_no");
@@ -284,6 +295,34 @@ function saveDrawingDetail(row) {
   });
 }
 
+/**预览 */
+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 handleRefreshDrawing() {
   getDrawingList();