allen 4 周之前
父节点
当前提交
5df02d8da5

+ 15 - 3
ips-ui/src/views/biz/distillation/index.vue

@@ -192,9 +192,9 @@
             size="mini"
             type="text"
             icon="el-icon-info"
-            @click="handleGetResult(scope.row)"
-            v-hasPermi="['biz:distillation:add']"
-            >查看结果</el-button
+            @click="openFolder(scope.row)"
+            v-hasPermi="['biz:images:add']"
+            >打开结果</el-button
           >
           <el-button
             size="mini"
@@ -307,6 +307,7 @@ import { getStatic } from "@/api/biz/common";
 import { getOptionsByType } from "@/api/biz/config";
 import DynamicFormDialog from "@/components/DynamicFormDialog";
 import LogViewer from "@/components/LogViewer";
+const { shell } = window.require("electron");
 export default {
   name: "Distillation",
   dicts: ["biz_status"],
@@ -526,6 +527,17 @@ export default {
       this.dialogTitle = "日志";
       this.logDialogVisible = true;
     },
+    openFolder(row) {
+      try {
+        shell.openPath(row.outputPath).then((result) => {
+          if (result) {
+            this.$message.error(`打开文件夹失败: ${result}`);
+          }
+        });
+      } catch (error) {
+        this.$message.error(`打开文件夹出错: ${error.message}`);
+      }
+    },
   },
 };
 </script>

+ 42 - 15
ips-ui/src/views/biz/features/index.vue

@@ -174,6 +174,30 @@
           <span>{{ parseTime(scope.row.endTime) }}</span>
         </template>
       </el-table-column>
+      <el-table-column label="结果图" align="center" prop="inputPath">
+        <template slot-scope="scope">
+          <el-image
+            v-if="scope.row.status === '2'"
+            :src="
+              encodeURI(
+                staticsUrl +
+                  '?filePath=' +
+                  scope.row.outputPath +
+                  '\\result.jpg'
+              )
+            "
+            :preview-src-list="[
+              encodeURI(
+                staticsUrl +
+                  '?filePath=' +
+                  scope.row.outputPath +
+                  '\\result.jpg'
+              ),
+            ]"
+            fit="contain"
+          ></el-image
+        ></template>
+      </el-table-column>
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column
         label="操作"
@@ -196,14 +220,6 @@
           >
             日志
           </el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-info"
-            @click="handleGetResult(scope.row)"
-            v-hasPermi="['biz:features:add']"
-            >查看结果</el-button
-          >
           <el-button
             size="mini"
             type="text"
@@ -288,6 +304,19 @@
       :logDialogVisible="logDialogVisible"
       @updateLogDiaLlogVisible="updateLogDiaLlogVisible"
     />
+    <el-dialog
+      :title="'查看结果'"
+      :visible.sync="detailsOpen"
+      width="80%"
+      append-to-body
+    >
+      <el-image
+        style="width: 100px; height: 500px"
+        :src="detailsUrl"
+        :preview-src-list="[detailsUrl]"
+        fit="contain"
+      ></el-image>
+    </el-dialog>
   </div>
 </template>
 
@@ -361,6 +390,7 @@ export default {
       logDialogVisible: false,
       currentLogUrl: "",
       dialogTitle: "",
+      detailsUrl: "",
     };
   },
   created() {
@@ -503,13 +533,10 @@ export default {
       }
     },
     handleGetResult(row) {
-      this.resultDetails = {};
-      this.selectFileName = "";
-      const id = row.id;
-      getResultDetails(id).then((response) => {
-        this.resultDetails = response.data;
-        this.detailsOpen = true;
-      });
+      this.detailsUrl = encodeURI(
+        this.staticsUrl + "?filePath=" + row.outputPath + "\\result.jpg"
+      );
+      this.detailsOpen = true;
     },
     handleConfigSubmit(modifiedJson) {
       this.form.algorithmParams = modifiedJson;

+ 14 - 11
ips-ui/src/views/biz/images/index.vue

@@ -31,14 +31,6 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="输入路径" prop="inputPath">
-        <el-input
-          v-model="queryParams.inputPath"
-          placeholder="请输入输入路径"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
       <el-form-item label="状态" prop="status">
         <el-select
           v-model="queryParams.status"
@@ -129,7 +121,6 @@
       <el-table-column label="编号" align="center" prop="id" />
       <el-table-column label="任务名称" align="center" prop="taskName" />
       <el-table-column label="算法" align="center" prop="algorithmName" />
-      <el-table-column label="输入路径" align="center" prop="inputPath" />
       <el-table-column label="状态" align="center" prop="status">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.biz_status" :value="scope.row.status" />
@@ -160,9 +151,9 @@
             size="mini"
             type="text"
             icon="el-icon-info"
-            @click="handleGetResult(scope.row)"
+            @click="openFolder(scope.row)"
             v-hasPermi="['biz:images:add']"
-            >查看结果</el-button
+            >打开结果</el-button
           >
           <el-button
             size="mini"
@@ -258,6 +249,7 @@ import { getOptionsByType } from "@/api/biz/config";
 import FolderPicker from "@/components/FolderPicker";
 import DynamicFormDialog from "@/components/DynamicFormDialog";
 import LogViewer from "@/components/LogViewer";
+const { shell } = window.require("electron");
 export default {
   name: "Images",
   dicts: ["biz_status"],
@@ -460,6 +452,17 @@ export default {
         alert("任务开始运行!");
       });
     },
+    openFolder(row) {
+      try {
+        shell.openPath(row.outputPath).then((result) => {
+          if (result) {
+            this.$message.error(`打开文件夹失败: ${result}`);
+          }
+        });
+      } catch (error) {
+        this.$message.error(`打开文件夹出错: ${error.message}`);
+      }
+    },
   },
 };
 </script>

+ 15 - 3
ips-ui/src/views/biz/test/index.vue

@@ -192,9 +192,9 @@
             size="mini"
             type="text"
             icon="el-icon-info"
-            @click="handleGetResult(scope.row)"
-            v-hasPermi="['biz:test:add']"
-            >查看结果</el-button
+            @click="openFolder(scope.row)"
+            v-hasPermi="['biz:images:add']"
+            >打开结果</el-button
           >
           <el-button
             size="mini"
@@ -309,6 +309,7 @@ import FolderPicker from "@/components/FolderPicker";
 import FilePicker from "@/components/FilePicker";
 import DynamicFormDialog from "@/components/DynamicFormDialog";
 import LogViewer from "@/components/LogViewer";
+const { shell } = window.require("electron");
 export default {
   name: "Test",
   dicts: ["biz_status"],
@@ -528,6 +529,17 @@ export default {
       this.dialogTitle = "日志";
       this.logDialogVisible = true;
     },
+    openFolder(row) {
+      try {
+        shell.openPath(row.outputPath).then((result) => {
+          if (result) {
+            this.$message.error(`打开文件夹失败: ${result}`);
+          }
+        });
+      } catch (error) {
+        this.$message.error(`打开文件夹出错: ${error.message}`);
+      }
+    },
   },
 };
 </script>

+ 15 - 3
ips-ui/src/views/biz/training/index.vue

@@ -192,9 +192,9 @@
             size="mini"
             type="text"
             icon="el-icon-info"
-            @click="handleGetResult(scope.row)"
-            v-hasPermi="['biz:training:add']"
-            >查看结果</el-button
+            @click="openFolder(scope.row)"
+            v-hasPermi="['biz:images:add']"
+            >打开结果</el-button
           >
           <el-button
             size="mini"
@@ -306,6 +306,7 @@ import FolderPicker from "@/components/FolderPicker";
 import FilePicker from "@/components/FilePicker";
 import DynamicFormDialog from "@/components/DynamicFormDialog";
 import LogViewer from "@/components/LogViewer";
+const { shell } = window.require("electron");
 export default {
   name: "Training",
   dicts: ["biz_status"],
@@ -525,6 +526,17 @@ export default {
       this.dialogTitle = "日志";
       this.logDialogVisible = true;
     },
+    openFolder(row) {
+      try {
+        shell.openPath(row.outputPath).then((result) => {
+          if (result) {
+            this.$message.error(`打开文件夹失败: ${result}`);
+          }
+        });
+      } catch (error) {
+        this.$message.error(`打开文件夹出错: ${error.message}`);
+      }
+    },
   },
 };
 </script>