ソースを参照

Merge branch 'dev-rmd' into develop_Allen

allen 11 ヶ月 前
コミット
684de7f4a0

+ 24 - 0
src/api/modules/task/bizProcess.ts

@@ -68,3 +68,27 @@ export const importBizProcessDataApi = (data: any) => {
 export const exportBizProcessApi = (data: any) => {
   return http.downloadPost('/task/bizProcess/export', data)
 }
+
+/**
+ * @name 查看训练结果
+ * @returns returns
+ */
+export const getTrainResultApi = (subtaskId: string | number) => {
+  return http.get(`/task/bizProcess/getTranResult/${subtaskId}`)
+}
+
+/**
+ * @name 查看验证结果
+ * @returns returns
+ */
+export const getVerifyResultApi = (subtaskId: string | number) => {
+  return http.get(`/task/bizProcess/getVerifyResult/${subtaskId}`)
+}
+
+/**
+ * @name 查看测试结果
+ * @returns returns
+ */
+export const getTestResultApi = (subtaskId: string | number) => {
+  return http.get(`/task/bizProcess/getTestResult/${subtaskId}`)
+}

+ 7 - 7
src/views/ag/config/index.vue

@@ -164,13 +164,13 @@ const setItemsOptions = () => {
         placeholder: '请选择类型'
       }
     },
-    {
-      label: '父id',
-      prop: 'parentId',
-      compOptions: {
-        placeholder: '请输入父id'
-      }
-    },
+    // {
+    //   label: '父id',
+    //   prop: 'parentId',
+    //   compOptions: {
+    //     placeholder: '请输入父id'
+    //   }
+    // },
     {
       label: '分系统',
       prop: 'subsystem',

+ 0 - 1
src/views/taais/homePage/createTask.vue

@@ -1007,7 +1007,6 @@ const addForm = (params, index, arrayName) => {
     })
     formItems.value[0].model[`task${i}`] = item.defaultValue
   })
-  console.log('formItems', formItems)
 }
 const agloChange = (propName, agloId) => {
   const Column = formItems.value[0].items.find(column => column.prop === propName)

+ 26 - 38
src/views/taais/homePage/index.vue

@@ -2,27 +2,31 @@
   <div class="home-container">
     <dv-border-box1 ref="borderRef" style="width: 100%; height: 100%; margin: 0 auto">
       <div class="table-box">
-        <ProTable
+        <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listTaskApi" :tool-button="false">
+          <template #tableHeader="">
+            <el-button type="primary" v-auth="['system:user:add']" :icon="CirclePlus" @click="createTask()"> 创建任务 </el-button>
+          </template>
+          <!-- 表格操作 -->
+          <template #operation="scope">
+            <el-button type="primary" link icon="View" v-auth="['task:task:query']" @click="viewDetails(scope.row)"> 查看详情 </el-button>
+            <el-button type="primary" link :icon="View" @click="openDialog(3, '任务查看', scope.row)">查看</el-button>
+          </template>
+        </ProTable>
+        <!-- <ProTable
           ref="proTable"
-          row-key="userId"
-          :data="taskDataList.data"
-          :indent="20"
+          row-key="id"
           :columns="columns"
-          :data-callback="dataCallback"
+          :request-api="listTaskApi"
           :request-auto="false"
-          :init-param="initParam"
           :tool-button="false"
-          :search-col="{ xs: 1, sm: 1, md: 2, lg: 3, xl: 3 }"
         >
-          <!-- 表格 header 按钮 -->
           <template #tableHeader="">
             <el-button type="primary" v-auth="['system:user:add']" :icon="CirclePlus" @click="createTask()"> 创建任务 </el-button>
           </template>
-          <!-- 表格操作 -->
           <template #operation="scope">
             <el-button type="primary" link :icon="View" @click="openDialog(3, '任务查看', scope.row)">查看</el-button>
           </template>
-        </ProTable>
+        </ProTable> -->
       </div>
     </dv-border-box1>
   </div>
@@ -37,8 +41,10 @@ import { CirclePlus, View } from '@element-plus/icons-vue'
 import { useRouter } from 'vue-router'
 import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
 import { addUserApi, updateUserApi, deptTreeSelectApi } from '@/api/modules/system/user'
-import { getTaskApi } from '@/api/modules/taais/task'
-import taskDataList from '@/assets/mock/taskData.json'
+// import { getTaskApi } from '@/api/modules/taais/task'
+import { listTaskApi, getTaskApi } from '@/api/modules/task/task'
+import { getDictsApi } from '@/api/modules/system/dictData'
+// import taskDataList from '@/assets/mock/taskData.json'
 // import { getDictsApi } from '@/api/modules/system/dictData'
 onMounted(() => {
   getTreeFilter()
@@ -57,18 +63,15 @@ const getTreeFilter = async () => {
   treeFilterData.value = data
   initParam.deptId = treeFilterData.value[0].id
 }
-const dataCallback = (data: any) => {
-  return data
+// 查看详情
+const viewDetails = row => {
+  router.push({ path: `/task/subtask/`, query: { id: row.id } })
 }
 // 批量添加用户
 const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
 // 打开弹框的功能
 const openDialog = async (type: number, title: string, row?: any) => {
   let res = getTaskApi(row?.taskId || null)
-  console.log('res', res)
-
-  // postOptions.value = res.data.posts
-  // roleOptions.value = res.data.roles
   // 表单项配置
   const fieldList: Form.FieldItem[] = [
     {
@@ -96,31 +99,16 @@ const router = useRouter()
 const createTask = () => {
   router.push(`/createTask`)
 }
-// 跳转详情页
-// const toDetail = (row: { tableId: any }) => {
-//   router.push(`/tool/tool-edit/index/${row.tableId}`)
-// }
-// const getTaskApi
 // 表格配置项
 const columns = reactive<ColumnProps<User.ResUserList>[]>([
   // { type: 'selection', fixed: 'left', width: 70 },
-  { prop: 'taskName', label: '任务名称' },
+  { prop: 'name', label: '任务名称' },
   {
     prop: 'status',
-    label: '用户状态'
-    // enum: () => getDictsApi('sys_normal_disable'),
-    // fieldNames: { label: 'dictLabel', value: 'dictValue' },
-    // render: scope => {
-    //   return (
-    //     <el-switch
-    //       model-value={scope.row.status}
-    //       active-text={scope.row.status === '1' ? '禁用' : '启用'}
-    //       active-value={'0'}
-    //       inactive-value={'1'}
-    //       onClick={() => changeStatus(scope.row)}
-    //     />
-    //   )
-    // }
+    label: '任务状态',
+    tag: true,
+    enum: () => getDictsApi('biz_task_status'),
+    fieldNames: { label: 'dictLabel', value: 'dictValue' }
   },
   { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
 ])

+ 169 - 12
src/views/task/bizProcess/index.vue

@@ -16,7 +16,7 @@
         >
           批量删除
         </el-button>
-        <el-button type="primary" v-auth="['task:bizProcess:add']" icon="CirclePlus" @click="contrastResults()"> 对比结果 </el-button>
+        <el-button type="primary" v-auth="['task:bizProcess:add']" icon="View" @click="contrastResults()"> 对比结果 </el-button>
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
@@ -37,6 +37,66 @@
         <div class="p" v-for="(item, index) in logInfo" :key="index">{{ item }}</div>
       </div>
     </el-dialog>
+    <el-dialog v-model="resultVisible" title="对比结果" width="70%">
+      <div v-if="!resultsFlag" class="resultShow">
+        <el-row class="headerRow">
+          <el-col class="col" :span="4" v-for="(agloName, index) in resultsData['agNameList']" :key="index">
+            <span>{{ agloName }}</span>
+          </el-col>
+        </el-row>
+        <el-row class="row">
+          <el-col class="col" :span="4" v-for="(RCurveUrl, index) in resultsData['rcureList']" :key="index">
+            <div v-if="index !== 1" class="oneCol">{{ RCurveUrl }}</div>
+            <ImagePreview
+              class="img"
+              v-else
+              :width="100"
+              :height="100"
+              :src="'/api/profile' + RCurveUrl"
+              :preview-src-list="['/api/profile' + RCurveUrl]"
+            />
+          </el-col>
+        </el-row>
+        <el-row class="row">
+          <el-col class="col" :span="4" v-for="(PCurveUrl, index) in resultsData['pcureList']" :key="index">
+            <div v-if="index !== 1" class="oneCol">{{ PCurveUrl }}</div>
+            <ImagePreview
+              class="img"
+              v-else
+              :width="100"
+              :height="100"
+              :src="'/api/profile' + PCurveUrl"
+              :preview-src-list="['/api/profile' + PCurveUrl]"
+            />
+          </el-col>
+        </el-row>
+        <el-row class="row">
+          <el-col class="col" :span="4" v-for="(F1CurveUrl, index) in resultsData['f1cureList']" :key="index">
+            <div v-if="index !== 1" class="oneCol">{{ F1CurveUrl }}</div>
+            <ImagePreview
+              class="img"
+              v-else
+              :width="100"
+              :height="100"
+              :src="'/api/profile' + F1CurveUrl"
+              :preview-src-list="['/api/profile' + F1CurveUrl]"
+            />
+          </el-col>
+        </el-row>
+      </div>
+      <div v-if="resultsFlag" class="resultShow">
+        <el-row class="row">
+          <el-col class="col" :span="4" v-for="(agloName, index) in testResultsData['agNameList']" :key="index">
+            <span>{{ agloName }}</span>
+          </el-col>
+        </el-row>
+        <el-row v-for="(item, index) in testResultsData['resultList']" :key="index">
+          <el-col class="col" :span="4" v-for="(url, index1) in item" :key="index1">
+            <span>{{ url }}</span>
+          </el-col>
+        </el-row>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -57,15 +117,28 @@ import {
   importTemplateApi,
   importBizProcessDataApi,
   exportBizProcessApi,
-  getBizProcessApi
+  getBizProcessApi,
+  getTrainResultApi,
+  getVerifyResultApi,
+  getTestResultApi
 } from '@/api/modules/task/bizProcess'
+import { getSubtaskApi } from '@/api/modules/task/subtask'
+import { getDictsApi } from '@/api/modules/system/dictData'
 import { useRoute } from 'vue-router'
+import ImagePreview from '@/components/ImagePreview/index.vue'
 const route = useRoute()
 const subTaskId = route.query.id as string
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
 const dialogVisible = ref(false)
+const resultVisible = ref(false)
+let resultsData = ref({})
+let testResultsData = ref({})
+let resultsFlag = ref(false)
+let logList = ref()
 let logInfo = ref([] as string[])
+let taskType = ref()
+let taskStatus = ref()
 
 let bizProcessList = ref()
 // 每隔10秒请求一下列表
@@ -82,7 +155,10 @@ const refreshList = () => {
   }, 0)
 }
 onMounted(() => {
-  // timer
+  getSubtaskApi(subTaskId).then(res => {
+    taskType.value = res.data.type
+    taskStatus.value = res.data.status
+  })
   refreshList()
   timer.value = setInterval(() => {
     refreshList()
@@ -122,14 +198,62 @@ const batchAdd = () => {
 
 // 对比结果
 const contrastResults = () => {
-  console.log('对比结果')
+  // if (taskStatus.value !== '3') {
+  //   ElMessage.warning(`算法状态为${taskStatus.value},暂无对比结果`)
+  //   return
+  // }
+  switch (taskType.value) {
+    case '1':
+      getTrainResultApi(subTaskId).then(res => {
+        resultsFlag.value = false
+        handleResultData(res.data)
+      })
+      break
+    case '2':
+      getVerifyResultApi(subTaskId).then(res => {
+        resultsFlag.value = false
+        handleResultData(res.data)
+      })
+      break
+    case '3':
+      getTestResultApi(subTaskId).then(res => {
+        console.log('333', res)
+        resultsFlag.value = true
+        testResultsData.value = res.data as any
+      })
+      break
+    default:
+      break
+  }
+  resultVisible.value = true
+}
+const handleResultData = data => {
+  resultsData.value = data
+  resultsData.value['agNameList'].unshift('')
+  resultsData.value['rcureList'].unshift('R_curve')
+  resultsData.value['pcureList'].unshift('P_curve')
+  resultsData.value['f1cureList'].unshift('F1_curve')
 }
 // 查看日志
 const viewLog = row => {
-  fetchLogFile(row.log)
+  // if (taskStatus.value !== '0') {
+  //   ElMessage.warning('算法状态为待处理,暂无日志')
+  //   return
+  // }
+  console.log(row.log)
+  const url = '/api/profile/task/log.log'
+  fetchLogFile(url)
     .then(text => {
-      console.log('text', text)
-      info(text)
+      logList.value = text.split('\n')
+      // console.log('logList.value', logList.value)
+      // if (taskStatus.value === '1') {
+      //   info(logList.value)
+      //   dialogVisible.value = true
+      // } else if (taskStatus.value === '2') {
+      //   logInfo.value = logList.value
+      //   dialogVisible.value = true
+      // }
+      info(logList.value)
       dialogVisible.value = true
     })
     .catch(error => {
@@ -139,7 +263,6 @@ const viewLog = row => {
 }
 
 const fetchLogFile = async url => {
-  console.log('url', url)
   try {
     const response = await fetch(url, { method: 'GET' })
     if (!response.ok) {
@@ -166,7 +289,7 @@ const info = logText => {
     } else {
       clearInterval(timer2.value)
     }
-  }, 50)
+  }, 300)
 }
 const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
 // 打开弹框的功能
@@ -197,6 +320,7 @@ watch(
   val => {
     if (!val) {
       clearInterval(timer2.value)
+      timer2.value = null
     }
   }
 )
@@ -231,10 +355,13 @@ const columns = reactive<ColumnProps<any>[]>([
   {
     prop: 'status',
     label: '任务状态',
+    tag: true,
+    enum: () => getDictsApi('biz_task_status'),
     search: {
-      el: 'input'
+      el: 'tree-select'
     },
-    width: 120
+    width: 100,
+    fieldNames: { label: 'dictLabel', value: 'dictValue' }
   },
   {
     prop: 'algorithmId',
@@ -288,6 +415,8 @@ const columns = reactive<ColumnProps<any>[]>([
   },
   { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
 ])
+// 结果表格配置项
+// const resultColumns = reactive<ColumnProps<any>[]>([])
 // 表单配置项
 let itemsOptions: ProForm.ItemsOptions[] = []
 const setItemsOptions = () => {
@@ -317,7 +446,11 @@ const setItemsOptions = () => {
       label: '任务状态',
       prop: 'status',
       compOptions: {
-        placeholder: '请输入任务状态'
+        elTagName: 'select',
+        labelKey: 'dictLabel',
+        valueKey: 'dictValue',
+        enum: () => getDictsApi('biz_task_status'),
+        placeholder: '请选择任务状态'
       }
     },
     {
@@ -419,4 +552,28 @@ const setItemsOptions = () => {
   margin-bottom: 5px;
   border-left: 3px solid #4aff84;
 }
+.resultShow {
+  width: 100%;
+  height: 60vh;
+  overflow: hidden;
+  overflow: scroll scroll;
+  .headerRow {
+    height: 50px;
+    font-size: 1.5rem;
+    line-height: 50px;
+    text-align: center;
+  }
+  .row {
+    .col {
+      text-align: center;
+      .oneCol {
+        margin-top: 45px;
+        font-size: 1.2rem;
+      }
+      .img {
+        margin: 10px 0;
+      }
+    }
+  }
+}
 </style>

+ 3 - 3
src/views/task/subtask/index.vue

@@ -163,9 +163,9 @@ const columns = reactive<ColumnProps<any>[]>([
   {
     prop: 'type',
     label: '任务类型',
-    search: {
-      el: 'input'
-    }
+    tag: true,
+    enum: () => getDictsApi('biz_ag_type'),
+    fieldNames: { label: 'dictLabel', value: 'dictValue' }
   },
   {
     prop: 'parameters',