Przeglądaj źródła

fix: 结果显示、算法模型调整

Rmengdi 11 miesięcy temu
rodzic
commit
6c84d674ea

+ 1 - 1
src/api/modules/task/bizProcess.ts

@@ -74,7 +74,7 @@ export const exportBizProcessApi = (data: any) => {
  * @returns returns
  */
 export const getTrainResultApi = (subtaskId: string | number) => {
-  return http.get(`/task/bizProcess/getTranResult/${subtaskId}`)
+  return http.get(`/task/bizProcess/getTrainResult/${subtaskId}`)
 }
 
 /**

+ 17 - 15
src/views/taais/homePage/createTask.vue

@@ -486,7 +486,7 @@ let items = reactive<ProForm.ItemsOptions[]>([
       enum: null,
       onChange: val => {
         formItem.trainDataExpansion.algorithmId = val
-        agloChange('trainExpansionModel', val)
+        agloChange('trainExpansionModel', val, false)
       }
     }
   },
@@ -525,7 +525,7 @@ let items = reactive<ProForm.ItemsOptions[]>([
       onChange: val => {
         selectTrainAgloId = val
         formItem.train[0]['algorithmId'] = val
-        agloChange('trainModel', val)
+        agloChange('trainModel', val, false)
       }
     }
   },
@@ -574,7 +574,7 @@ let items = reactive<ProForm.ItemsOptions[]>([
       enum: null,
       onChange: val => {
         formItem.testDataEnhancement['algorithmId'] = val
-        agloChange('testEnhanceModel', val)
+        agloChange('testEnhanceModel', val, false)
       }
     }
   },
@@ -616,7 +616,7 @@ let items = reactive<ProForm.ItemsOptions[]>([
       enum: null,
       onChange: val => {
         formItem.testDataExpansion['algorithmId'] = val
-        agloChange('testExpansionModel', val)
+        agloChange('testExpansionModel', val, false)
       }
     }
   },
@@ -659,7 +659,7 @@ let items = reactive<ProForm.ItemsOptions[]>([
       onChange: val => {
         selectTestAgloId = val
         formItem.test[0]['algorithmId'] = val
-        agloChange('testModel', val)
+        agloChange('testModel', val, true)
       }
     }
   },
@@ -708,7 +708,7 @@ let items = reactive<ProForm.ItemsOptions[]>([
       enum: null,
       onChange: val => {
         formItem.reasoningDataEnhancement['algorithmId'] = val
-        agloChange('reasoningEnhanceModel', val)
+        agloChange('reasoningEnhanceModel', val, false)
       }
     }
   },
@@ -750,7 +750,7 @@ let items = reactive<ProForm.ItemsOptions[]>([
       enum: null,
       onChange: val => {
         formItem.reasoningDataExpansion['algorithmId'] = val
-        agloChange('reasoningExpansionModel', val)
+        agloChange('reasoningExpansionModel', val, false)
       }
     }
   },
@@ -793,7 +793,7 @@ let items = reactive<ProForm.ItemsOptions[]>([
       onChange: val => {
         selectReasoningAgloId = val
         formItem.reasoning[0]['algorithmId'] = val
-        agloChange('reasoningModel', val)
+        agloChange('reasoningModel', val, true)
       }
     }
   },
@@ -1018,17 +1018,19 @@ const addForm = (params, index, arrayName) => {
     formItems.value[0].model[`task${i}`] = item.defaultValue
   })
 }
-const agloChange = (propName, agloId) => {
+const agloChange = (propName, agloId, flag) => {
   const Column = formItems.value[0].items.find(column => column.prop === propName)
   if (Column) {
     getModelApi(agloId).then(res => {
       Column.compOptions.enum = res.data as any[]
-      // Column.compOptions.enum.unshift({
-      //   algorithmId: null,
-      //   id: 1,
-      //   modelAddress: null,
-      //   modelName: '基于训练生成的模型'
-      // })
+      if (flag) {
+        Column.compOptions.enum.unshift({
+          algorithmId: null,
+          id: 1,
+          modelAddress: null,
+          modelName: '基于训练生成的模型'
+        })
+      }
     })
   }
 }

+ 47 - 49
src/views/task/bizProcess/index.vue

@@ -3,8 +3,8 @@
     <ProTable ref="proTable" :columns="columns" row-key="id" :data="bizProcessList">
       <!-- 表格 header 按钮 -->
       <template #tableHeader="scope">
-        <el-button type="primary" v-auth="['task:bizProcess:add']" icon="CirclePlus" @click="openDialog(1, '算法业务处理新增')"> 新增 </el-button>
-        <el-button type="primary" v-auth="['task:bizProcess:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button>
+        <!-- <el-button type="primary" v-auth="['task:bizProcess:add']" icon="CirclePlus" @click="openDialog(1, '算法业务处理新增')"> 新增 </el-button>
+        <el-button type="primary" v-auth="['task:bizProcess:import']" icon="Upload" plain @click="batchAdd"> 导入 </el-button> -->
         <el-button type="primary" v-auth="['task:bizProcess:export']" icon="Download" plain @click="downloadFile"> 导出 </el-button>
         <el-button
           type="danger"
@@ -46,40 +46,40 @@
         </el-row>
         <el-row class="row">
           <el-col class="col" :span="spanNum" v-for="(RCurveUrl, index) in resultsData['rcureList']" :key="index">
-            <div v-if="index !== 1" :span="4" class="oneCol">{{ RCurveUrl }}</div>
+            <div v-if="index === 0" :span="4" class="oneCol">{{ RCurveUrl }}</div>
             <ImagePreview
               class="img"
               v-else
               :width="100"
               :height="100"
-              :src="'/api/profile' + RCurveUrl"
-              :preview-src-list="['/api/profile' + RCurveUrl]"
+              :src="'/api/profile/task' + RCurveUrl"
+              :preview-src-list="['/api/profile/task' + RCurveUrl]"
             />
           </el-col>
         </el-row>
         <el-row class="row">
           <el-col class="col" :span="spanNum" v-for="(PCurveUrl, index) in resultsData['pcureList']" :key="index">
-            <div v-if="index !== 1" class="oneCol">{{ PCurveUrl }}</div>
+            <div v-if="index === 0" class="oneCol">{{ PCurveUrl }}</div>
             <ImagePreview
               class="img"
               v-else
               :width="100"
               :height="100"
-              :src="'/api/profile' + PCurveUrl"
-              :preview-src-list="['/api/profile' + PCurveUrl]"
+              :src="'/api/profile/task' + PCurveUrl"
+              :preview-src-list="['/api/profile/task' + PCurveUrl]"
             />
           </el-col>
         </el-row>
         <el-row class="row">
           <el-col class="col" :span="spanNum" v-for="(F1CurveUrl, index) in resultsData['f1cureList']" :key="index">
-            <div v-if="index !== 1" class="oneCol">{{ F1CurveUrl }}</div>
+            <div v-if="index === 0" class="oneCol">{{ F1CurveUrl }}</div>
             <ImagePreview
               class="img"
               v-else
               :width="100"
               :height="100"
-              :src="'/api/profile' + F1CurveUrl"
-              :preview-src-list="['/api/profile' + F1CurveUrl]"
+              :src="'/api/profile/task' + F1CurveUrl"
+              :preview-src-list="['/api/profile/task' + F1CurveUrl]"
             />
           </el-col>
         </el-row>
@@ -93,7 +93,7 @@
         <el-row class="row" v-for="(item, index) in testResultsData['resultList']" :key="index">
           <el-col class="col" :span="spanNum" v-for="(url, index1) in item" :key="index1">
             <!-- <span>{{ url }}</span> -->
-            <ImagePreview class="img" :width="100" :height="100" :src="'/api/profile' + url" :preview-src-list="['/api/profile' + url]" />
+            <ImagePreview class="img" :width="100" :height="100" :src="'/api/profile/task' + url" :preview-src-list="['/api/profile/task' + url]" />
           </el-col>
         </el-row>
       </div>
@@ -115,14 +115,13 @@ import {
   delBizProcessApi,
   addBizProcessApi,
   updateBizProcessApi,
-  importTemplateApi,
-  importBizProcessDataApi,
   exportBizProcessApi,
   getBizProcessApi,
   getTrainResultApi,
   getVerifyResultApi,
   getTestResultApi
 } from '@/api/modules/task/bizProcess'
+// getTrainResultApi,getVerifyResultApi,getTestResultApi
 import { getSubtaskApi } from '@/api/modules/task/subtask'
 import { getDictsApi } from '@/api/modules/system/dictData'
 import { useRoute } from 'vue-router'
@@ -165,7 +164,7 @@ onMounted(() => {
   refreshList()
   timer.value = setInterval(() => {
     refreshList()
-  }, 100000)
+  }, 10000)
   // 组件挂载后,logRef 将指向实际的 DOM 元素
   if (logRef.value) {
     // 操作 logRef 对应的 DOM 元素
@@ -194,38 +193,35 @@ const downloadFile = async () => {
 
 // 批量添加算法业务处理
 const dialogRef = ref<InstanceType<typeof ImportExcel> | null>(null)
-const batchAdd = () => {
-  const params = {
-    title: '算法业务处理',
-    tempApi: importTemplateApi,
-    importApi: importBizProcessDataApi,
-    getTableList: proTable.value?.getTableList
-  }
-  dialogRef.value?.acceptParams(params)
-}
+// const batchAdd = () => {
+//   const params = {
+//     title: '算法业务处理',
+//     tempApi: importTemplateApi,
+//     importApi: importBizProcessDataApi,
+//     getTableList: proTable.value?.getTableList
+//   }
+//   dialogRef.value?.acceptParams(params)
+// }
 
 // 对比结果
 const contrastResults = () => {
-  if (taskStatus.value !== '2') {
-    let status1
-    getDictsApi('biz_task_status').then(res => {
-      status1 = res.data.find(item => {
-        return item.dictValue == taskStatus.value
-      })
-      ElMessage.warning(`算法状态为${status1.dictLabel},暂无对比结果`)
-    })
-  } else {
+  const statusFlag = bizProcessList.value.every(item => {
+    return item.status == '2'
+  })
+  if (statusFlag) {
     switch (taskType.value) {
       case '1':
         getTrainResultApi(subTaskId).then(res => {
           resultsFlag.value = false
           handleResultData(res.data)
+          resultVisible.value = true
         })
         break
       case '2':
         getVerifyResultApi(subTaskId).then(res => {
           resultsFlag.value = false
           handleResultData(res.data)
+          resultVisible.value = true
         })
         break
       case '3':
@@ -235,12 +231,14 @@ const contrastResults = () => {
           testResultsData.value = res.data as any
           const num = testResultsData.value['agNameList'].length
           spanNum.value = 24 / num <= 4 ? 4 : parseInt(24 / num)
+          resultVisible.value = true
         })
         break
       default:
         break
     }
-    resultVisible.value = true
+  } else {
+    ElMessage.warning(`所有算法状态为‘已完成’,才可以对比`)
   }
 }
 const handleResultData = data => {
@@ -362,14 +360,14 @@ const columns = reactive<ColumnProps<any>[]>([
     },
     width: 120
   },
-  {
-    prop: 'type',
-    label: '任务类型',
-    search: {
-      el: 'input'
-    },
-    width: 120
-  },
+  // {
+  //   prop: 'type',
+  //   label: '任务类型',
+  //   search: {
+  //     el: 'input'
+  //   },
+  //   width: 120
+  // },
   {
     prop: 'status',
     label: '任务状态',
@@ -453,13 +451,13 @@ const setItemsOptions = () => {
         placeholder: '请输入任务名称'
       }
     },
-    // {
-    //   label: '任务类型',
-    //   prop: 'type',
-    //   compOptions: {
-    //     placeholder: '请输入任务类型'
-    //   }
-    // },
+    {
+      label: '任务类型',
+      prop: 'type',
+      compOptions: {
+        placeholder: '请输入任务类型'
+      }
+    },
     {
       label: '任务状态',
       prop: 'status',