Procházet zdrojové kódy

激光测距仪图表全屏展示

liujiejie před 5 měsíci
rodič
revize
29a9feb227

+ 3 - 2
src/main.js

@@ -73,13 +73,14 @@ Vue.prototype.$formatDateTWO = function (timestamp) {
 // 路由导航守卫
 router.beforeEach((to, from, next) => {
   if (from.path === "/home/performance/customAnalysis") {
-    store.commit("dragChart/clearchart");
+    if (to.path !== "/home/performance/luckySheet") {
+      store.commit("dragChart/clearchart");
+    }
   }
   next();
 });
 // 监听页面刷新或关闭事件
 window.addEventListener("beforeunload", () => {
-  console.log("调用了dragChart/clearchart");
   // 调用清空 Vuex 仓库的 Action
   store.commit("dragChart/clearchart");
 });

+ 21 - 21
src/views/performance/components/custonAsCom/luckySheet.vue

@@ -26,7 +26,6 @@
 
 <script>
 import luckysheet from "luckysheet";
-// import LuckyExcel from "luckyexcel";
 import {
   getDataFromIndexedDB,
   storeSetData,
@@ -47,26 +46,26 @@ export default {
   methods: {
     async initSheetData() {
       const jsonData = await getDataFromIndexedDB();
-      console.log(
-        [...jsonData].filter((item) => item.fileId == this.$route.query.id)[0],
-        "this.$route.query.id"
-      );
-      this.sheetName = [...jsonData].filter(
-        (item) => item.fileId == this.$route.query.id
-      )[0].fileOldName;
-      // 1. 动态提取表头
-      const headers = Object.keys(
-        [...jsonData].filter((item) => item.fileId == this.$route.query.id)[0]
-          .fileData[0]
-      );
-      // 2. 将 JSON 数据转换为二维数组格式
-      const formattedData = [...jsonData]
-        .filter((item) => item.fileId == this.$route.query.id)[0]
-        .fileData.map((item) => headers.map((header) => item[header]));
-      // 3. 将表头插入到数据的第一行
-      formattedData.unshift(headers);
-      //4.  将 JSON 数据转换为 Luckysheet 格式
-      this.initLuckySheet(formattedData);
+      console.log(jsonData, "jsonData");
+      if (jsonData && jsonData.length > 0) {
+        this.sheetName = [...jsonData].filter(
+          (item) => item.fileId == this.$route.query.id
+        )[0]?.fileOldName;
+
+        // 1. 动态提取表头
+        const headers = Object.keys(
+          [...jsonData].filter((item) => item.fileId == this.$route.query.id)[0]
+            .fileData[0]
+        );
+        // 2. 将 JSON 数据转换为二维数组格式
+        const formattedData = [...jsonData]
+          .filter((item) => item.fileId == this.$route.query.id)[0]
+          .fileData.map((item) => headers.map((header) => item[header]));
+        // 3. 将表头插入到数据的第一行
+        formattedData.unshift(headers);
+        //4.  将 JSON 数据转换为 Luckysheet 格式
+        this.initLuckySheet(formattedData);
+      }
     },
     initLuckySheet(formattedData) {
       const options = {
@@ -162,6 +161,7 @@ export default {
           formattedData.push(rowData);
         }
       }
+
       this.sheetData = JSON.stringify(formattedData, null, 2);
       await initDatabase()
         .then((database) => {

+ 9 - 20
vue.config.js

@@ -63,8 +63,8 @@ module.exports = {
     // contentBase: path.join(__dirname, "public"),
     proxy: {
       "/api": {
-        target: "http://192.168.5.4:16200", // 石月
-        // target: "http://192.168.50.235:16200", // 内网
+        // target: "http://192.168.5.4:16200", // 石月
+        target: "http://192.168.50.235:16200", // 内网
         // target: "http://192.168.5.15:16200",
         // target: "http://106.120.102.238:16700", // 外网  16600   16700
         // target: "http://10.96.137.5",
@@ -72,9 +72,6 @@ module.exports = {
         pathRewrite: {
           "^/api": "", // 去掉 /api 前缀
         },
-        // onProxyReq(proxyReq, req, res) {
-        //   console.log("Proxying /api request to:", proxyReq.path); // 打印代理请求路径
-        // },
       },
       // 未知量
       "/WZLapi": {
@@ -83,19 +80,15 @@ module.exports = {
         pathRewrite: {
           "^/WZLapi": "", // 去掉 /WZLapi 前缀
         },
-      
       },
-         // 文佳
-         "/WJapi": {
-          target: "http://192.168.5.28:8888", // WZLapi 目标地址
-          changeOrigin: true,
-          pathRewrite: {
-            "^/WJapi": "", // 去掉 /WZLapi 前缀
-          },
-          onProxyReq(proxyReq, req, res) {
-            console.log("Proxying /sAlgorithm request to:", proxyReq.path); // 打印代理请求路径
-          },
+      // 文佳
+      "/WJapi": {
+        target: "http://192.168.5.28:8888", // WZLapi 目标地址
+        changeOrigin: true,
+        pathRewrite: {
+          "^/WJapi": "", // 去掉 /WZLapi 前缀
         },
+      },
       "/transDataWeb": {
         target: "http://192.168.50.241:9000/trans_data_web",
         changeOrigin: true,
@@ -110,11 +103,7 @@ module.exports = {
         pathRewrite: {
           "^/sAlgorithm": "", // 如果后端需要 `/api` 前缀
         },
-        onProxyReq(proxyReq, req, res) {
-          console.log("Proxying /sAlgorithm request to:", proxyReq.path); // 打印代理请求路径
-        },
       },
-
       "/databaseApi": {
         target: "http://192.168.5.18:3000",
         changeOrigin: true,