Quellcode durchsuchen

fix: 原始数据显示

Rmengdi vor 9 Monaten
Ursprung
Commit
a8c0150125
1 geänderte Dateien mit 32 neuen und 24 gelöschten Zeilen
  1. 32 24
      pdaaphm-ui/src/views/index.vue

+ 32 - 24
pdaaphm-ui/src/views/index.vue

@@ -8,7 +8,7 @@
             <el-table-column prop="dataName" label="数据" align="center">
               <template slot-scope="scope">
                 <el-tooltip class="item" effect="dark" :content="scope.row.dataName" placement="top">
-                  <span class="file" @click="handleOriginalFile(scope.row.id,scope.row.dataPath)">{{
+                  <span class="file" @click="handleOriginalFile(scope.row.id, scope.row.dataPath)">{{
             scope.row.dataName }}</span>
                 </el-tooltip>
               </template>
@@ -233,7 +233,7 @@ import RingChart from '@/views/homePage/ringChart'
 import BarChart from '@/views/dashboard/BarChart'
 import { getAlgConfigByType } from "@/api/system/algConfig";
 import { getDataProcessByType, addProcess } from "@/api/system/process";
-import { getDataByType, getData,listData } from "@/api/system/data";
+import { getDataByType, getData, listData } from "@/api/system/data";
 import * as echarts from 'echarts';
 export default {
   name: 'Index',
@@ -303,11 +303,11 @@ export default {
   },
   methods: {
     getTableData() {
-      const query={
-        dataType:0
+      const query = {
+        dataType: 0
       }
       listData(query).then(res => {
-        this.originalList = res.data
+        this.originalList = res.rows
       })
       getDataProcessByType(0).then(res => {
         this.completionList = res.data
@@ -338,13 +338,13 @@ export default {
       this.dialogVisible = true;
       this.dialogType = type
       let match
-      if(type===3){
+      if (type === 3) {
         const relation = [[3, 2], [3, 3]]
-        match= relation.find(item => item[0] === type)[1]
-      }else if(type===5){
-        match=type-1
-      }else{
-        match=type
+        match = relation.find(item => item[0] === type)[1]
+      } else if (type === 5) {
+        match = type - 1
+      } else {
+        match = type
       }
       // const relation = [[1, 0], [2, 1], [3, 2], [4, 2], [4, 3], [5, 4], [6, 4]]
       // const match = relation.find(item => item[0] === type)[1];
@@ -442,19 +442,27 @@ export default {
           });
       });
     },
-    handleOriginalFile(id,url){
-      // const url = `${process.env.VUE_APP_BASE_API}${res.data.dataPath}`;
-      //   this.fetchLogFile(url)
-      //     .then((text) => {
-      //       if (this.chart != null && this.chart != "" && this.chart != undefined) {
-      //         this.chart.dispose();
-      //         this.chart = null
-      //       }
-      //       .catch((error) => {
-      //       console.error("Failed to fetch the log file:", error);
-      //       this.$modal.msgSuccess("文件读取错误");
-      //     });
-      //   })
+    handleOriginalFile(id, url) {
+      const newUrl = `${process.env.VUE_APP_BASE_API}${url}`;
+      this.fetchLogFile(newUrl)
+        .then((text) => {
+          if (this.chart != null && this.chart != "" && this.chart != undefined) {
+            this.chart.dispose();
+            this.chart = null
+          }
+          const originalData = this.handleFileData(text)
+          const originalContent = originalData.contentData
+          const originalHead = originalData.headData
+          this.fileShowVisible = true
+          this.loading = false
+          this.$nextTick(() => {
+            this.handleChartOption(originalContent, originalHead, true)
+          })
+        })
+        .catch((error) => {
+          console.error("Failed to fetch the log file:", error);
+          this.$modal.msgSuccess("文件读取错误");
+        });
     },
     // 读取文件内容
     async fetchLogFile(url) {