Эх сурвалжийг харах

算法运行跳转到数据对比

Rmengdi 1 жил өмнө
parent
commit
7a82dd27c9

+ 13 - 0
pdaaphm-ui/src/router/index.js

@@ -115,6 +115,19 @@ export const constantRoutes = [
         meta: { title: '查看结果', icon: 'user' }
       }
     ]
+  },
+  {
+    path: '/dataManage',
+    component: Layout,
+    redirect: 'noredirect',
+    children: [
+      {
+        path: 'contrast/:nonIdealID',
+        component: () => import('@/views/dataManage/contrast'),
+        name: 'Contrast',
+        meta: { title: '数据对比', icon: 'user' }
+      }
+    ]
   }
 ]
 

+ 33 - 12
pdaaphm-ui/src/views/algoManager/algorithm/algoRun.vue

@@ -10,9 +10,10 @@
         <el-descriptions-item label="名称">{{ info.name }}</el-descriptions-item>
         <el-descriptions-item label="备注">{{ info.remark }}</el-descriptions-item>
       </el-descriptions>
-      <div>
-        <el-button plain type="primary" class="btn" size="mini" @click="handleRun(info.id)">确认</el-button>
-        <!-- <el-button plain type="primary" class="result" size="mini" @click="checkResult(info.id)">确认</el-button> -->
+      <div class="btn">
+        <el-button plain type="primary" size="mini" @click="handleRun(info.id)">确认</el-button>
+        <el-button plain :disabled="isOK" type="primary" size="mini" @click="checkResult(info.id)">查看结果</el-button>
+        <el-button plain v-show="isDataHandle" type="primary" size="mini" @click="checkContrast(info.id)">查看数据对比</el-button>
       </div>
     </div>
     <div class="log" v-if="show">
@@ -38,7 +39,11 @@ export default {
       show: false,
       message: null,
       timer: null,
-      dynamicHeight: '500px'
+      dynamicHeight: '500px',
+      // 当算法运行成功时按钮可点击查看结果
+      isOK:true,
+      // 当运行的算法是数据处理时,显示“查看数据对比”按钮
+      isDataHandle:false
     }
   },
   created() {
@@ -56,6 +61,12 @@ export default {
       getAlgorithm(id).then(response => {
         console.log('response', response)
         this.info = response.data
+        if(this.info.status==='2'){
+          this.isOK=false
+        }
+        if((this.info.type==='6'||this.info.type==='5'||this.info.type==='3') && this.info.status==='2'){
+          this.isDataHandle=true
+        }
         this.loading = false
       })
     },
@@ -75,19 +86,29 @@ export default {
         if (logData && logData.includes('任务执行完成')) {
           console.log("定时器销毁");
           clearInterval(this.timer)
+          this.isOK=false
         }
         this.message = this.message + logData
       })
     },
     // 跳转查看结果列表
-    // checkResult(id){
-    //   this.$router.push({
-    //     name: 'Result',
-    //     params: {
-    //       resultID: id,
-    //     },
-    //   })
-    // }
+    checkResult(id){
+      this.$router.push({
+        name: 'Result',
+        params: {
+          resultID: id,
+        },
+      })
+    },
+    // 查看数据对比结果
+    checkContrast(id){
+      this.$router.push({
+        name: 'Contrast',
+        params: {
+          nonIdealID: id,
+        },
+      })
+    }
   },
 }
 </script>

+ 37 - 9
pdaaphm-ui/src/views/dataManage/contrast/index.vue

@@ -2,26 +2,26 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="84px">
       <el-form-item label="算法类型" prop="type">
-        <el-select v-model="queryParams.type" placeholder="请选择算法类型" clearable filterable @change="changeQueryType()">
+        <el-select :disabled="isDisabled" v-model="queryParams.type" placeholder="请选择算法类型" clearable filterable @change="changeQueryType()">
           <el-option v-for="dict in dict.type.algorithm_type" :key="dict.value" :label="dict.label"
             :value="dict.value" />
         </el-select>
       </el-form-item>
       <el-form-item label="算法子类型" prop="subTypeId">
-        <el-select v-model="queryParams.subTypeId" placeholder="请选择算法子类型" clearable filterable @change="getList()">
+        <el-select :disabled="isDisabled" v-model="queryParams.subTypeId" placeholder="请选择算法子类型" clearable filterable @change="getList()">
           <el-option v-for="item in algoTypeList" :key="item.id" :label="item.name" :value="item.id">
           </el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="非理想数据" prop="type">
-        <el-select v-model="nonIdeal" placeholder="请选择非理想数据" clearable filterable @change="viewResult">
+        <el-select :disabled="isDisabled" v-model="nonIdeal" placeholder="请选择非理想数据" clearable filterable @change="viewResult">
           <el-option v-for="item in nonIdealData" :key="item.id" :label="item.name" :value="item.id">
             {{ item.name }}
           </el-option>
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查看</el-button>
+        <el-button :disabled="isDisabled" type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查看</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
@@ -33,6 +33,7 @@
 </template>
 
 <script>
+import { listSubType, getSubType } from "@/api/conf/subType";
 import { listAlgorithm, getAlgorithmDto } from '@/api/algoManager/algorithm'
 import { parseCSV } from '@/utils/cvstoarrory'
 import { listInputFile } from '@/api/algoManager/file'
@@ -106,15 +107,16 @@ export default {
       idealData: [],
       chart2: null,
       option2: null,
+      // 是否禁用选择框
+      isDisabled:false
     }
   },
   mounted() {
-    // this.getInputList()
-    // this.handleCSV()
-    // this.showECharts()
   },
   created() {
     this.getAlgoSubOption()
+    // 获取跳转过来的参数
+    this.getParam()
   },
   beforeDestroy() {
     if (!this.chart) {
@@ -124,6 +126,33 @@ export default {
     this.chart = null
   },
   methods: {
+    // 获取跳转参数
+    getParam(){
+      let param=this.$route.params.nonIdealID
+      if(param !== undefined){
+        // 根据nonIdealID获取算法类型
+        getAlgorithmDto(param).then(response => {
+          this.ioSubList = response.data.ioSubList
+          // 绑定算法类型的值
+          this.queryParams.type=response.data.type
+          // 绑定非理想数据的值
+          this.nonIdeal=response.data.name
+          let subTypeId=response.data.subTypeId
+          let data={
+            pageNum: 1,
+            pageSize: 100,
+            type:this.queryParams.type
+          }
+          // 获取算法子类型的名称
+          listSubType(data).then(response => {
+            const filteredData = response.rows.filter(item => item.id === subTypeId);
+            this.queryParams.subTypeId=filteredData[0].name
+            this.handleQuery()
+          });
+          this.isDisabled=true
+        })
+      }
+    },
     /** 查看非理想 */
     getList() {
       this.loading = true
@@ -160,6 +189,7 @@ export default {
       this.nonIdeal = null
       this.nonIdealData = []
       this.algoTypeList = []
+      this.isDisabled=false
       if (this.chart1) {
         this.chart1.dispose()
         this.chart1 = null
@@ -183,11 +213,9 @@ export default {
         let firstInput = this.ioSubList.find(item => item.type === "1" && item.path.includes(".csv"));
         let firstOut = this.ioSubList.find(item => item.type === "2" && item.path.includes(".csv"));
         if (firstInput) {
-          // console.log(firstInput.path,firstInput.type);
           this.handleCSV(firstInput.path, firstInput.type)
         }
         if(firstOut){
-          // console.log(firstOut.path,firstOut.type);
           this.handleCSV(firstOut.path, firstOut.type)
         }
       }