瀏覽代碼

feat: 更改首页、对比结果、读取日志、更改类型显示

Rmengdi 11 月之前
父節點
當前提交
a1a22b6a13

+ 1 - 1
.env

@@ -1,5 +1,5 @@
 # title
-VITE_GLOB_APP_TITLE = 目标精确捕获系统
+VITE_GLOB_APP_TITLE = 算法任务系统
 
 # 本地运行端口号
 VITE_PORT = 8848

+ 4 - 0
src/api/interface/task/subtask.ts

@@ -89,6 +89,10 @@ export interface SubtaskForm {
 }
 
 export interface SubtaskQuery extends PageQuery {
+  /**
+   * 任务名称
+   */
+  taskId?: string
   /**
    * 任务名称
    */

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

@@ -6,7 +6,7 @@ import { BizProcessVO, BizProcessForm, BizProcessQuery } from '@/api/interface/t
  * @returns 返回列表
  */
 export const listBizProcessApi = (query: BizProcessQuery) => {
-  return http.get<BizProcessVO[]>('/task/bizProcess/list', query, { loading: true })
+  return http.get<BizProcessVO[]>('/task/bizProcess/list', query, { loading: false })
 }
 
 /**
@@ -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}`)
+}

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

@@ -6,7 +6,7 @@ import { SubtaskVO, SubtaskForm, SubtaskQuery } from '@/api/interface/task/subta
  * @returns 返回列表
  */
 export const listSubtaskApi = (query: SubtaskQuery) => {
-  return http.get<SubtaskVO[]>('/task/subtask/list', query, { loading: true })
+  return http.get<SubtaskVO[]>('/task/subtask/list', query, { loading: false })
 }
 
 /**

+ 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',

+ 4 - 4
src/views/taais/homePage/createTask.vue

@@ -197,7 +197,7 @@ const reasoningActiveTab = ref()
 let pageIndex = ref<number>(1)
 const selectTaskTreeRef = ref<InstanceType<typeof ElTree>>()
 
-let title = ref('目标精准捕获任务选择')
+let title = ref('算法任务选择')
 let nextBtnText = ref('下一步')
 const data1 = [
   {
@@ -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)
@@ -1176,9 +1175,10 @@ const delNumber = (start, end, dataList) => {
 }
 const onSubmit = () => {
   findParams(formItem)
-  console.log('111', formItem)
   createTaskApi(formItem).then(res => {
     console.log('createTask', res)
+    // const taskId=res
+    router.push({ path: `/task/subtask/`, query: { id: res.data } })
   })
 }
 const findParams = obj => {
@@ -1296,7 +1296,7 @@ watch(
   value => {
     switch (value) {
       case 1:
-        title.value = '任务创建:目标精准捕获任务选择'
+        title.value = '任务创建:算法任务选择'
         nextBtnText.value = '下一步'
         break
       case 2:

+ 13 - 12
src/views/taais/homePage/index.scss

@@ -70,7 +70,6 @@
 }
 %box-basic {
   width: 90%;
-  height: 700px;
   padding: 20px;
   margin: 0 auto;
 }
@@ -101,18 +100,22 @@
 
   position: relative;
   width: 90%;
-  margin-top: 50px;
   .btn {
-    margin-top: 10px;
-    margin-left: 100px;
+    margin-top: 20px;
+
+    // margin-left: 100px;
+  }
+  .prev {
+    position: absolute;
+    left: 150px;
   }
   .next {
     position: absolute;
-    right: 120px;
+    right: 150px;
   }
   .log {
     width: 90%;
-    height: 550px; /* 根据需要调整 */
+    height: 65vh; /* 根据需要调整 */
     padding: 10px;
 
     // padding-bottom: 80px;
@@ -128,20 +131,18 @@
     border-left: 3px solid #4aff84;
   }
 }
-
-// :deep(.dv-border-box-1 .border-box-content) {
-//   text-align: left;
-// }
+:deep(.dv-border-box-1 .border-box-content) {
+  text-align: left;
+}
 .trainResult-container {
   @extend %box-basic;
 
   width: 90%;
   padding: 3px 20px;
-  margin-top: 15px;
   .table {
     position: relative;
     width: 100%;
-    height: 600px;
+    height: 70vh;
     margin-top: -15px;
     .btn {
       margin-top: 10px;

+ 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' }
 ])

+ 1 - 1
src/views/taais/homePage/inferResult.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bigBox">
-    <dv-border-box1 ref="borderRef" style="width: 1200px; height: 730px; margin: 0 auto">
+    <dv-border-box1 ref="borderRef" style="width: 80%; height: 100%; margin: 0 auto">
       <div class="trainResult-container">
         <h4>推理结果</h4>
         <div class="table">

+ 2 - 2
src/views/taais/homePage/logPage.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bigBox">
-    <dv-border-box1 ref="borderRef" style="width: 1200px; height: 700px; margin: 0 auto">
+    <dv-border-box1 ref="borderRef" style="width: 80%; height: 100%; margin: 0 auto">
       <div class="logPage-container">
         <el-divider content-position="left">
           <span style="font-size: 18px; font-weight: 700">{{ title }}</span>
@@ -8,7 +8,7 @@
         <div class="log">
           <div class="p" v-for="(item, index) in logInfo" :key="index">{{ item }}</div>
         </div>
-        <el-button class="btn" @click="goTrainResult()"> 上一步 </el-button>
+        <el-button class="btn prev" @click="goTrainResult()"> 上一步 </el-button>
         <el-button type="primary" v-if="over" class="btn next" @click="onResult()"> 查看结果 </el-button>
       </div>
     </dv-border-box1>

+ 258 - 9
src/views/task/bizProcess/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="table-box">
-    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listBizProcessApi">
+    <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>
@@ -16,6 +16,7 @@
         >
           批量删除
         </el-button>
+        <el-button type="primary" v-auth="['task:bizProcess:add']" icon="View" @click="contrastResults()"> 对比结果 </el-button>
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
@@ -26,18 +27,72 @@
           编辑
         </el-button>
         <el-button type="primary" link icon="Delete" v-auth="['task:bizProcess:remove']" @click="deleteBizProcess(scope.row)"> 删除 </el-button>
+        <el-button type="primary" link icon="View" v-auth="['task:bizProcess:query']" @click="viewLog(scope.row)"> 查看日志 </el-button>
       </template>
     </ProTable>
     <FormDialog ref="formDialogRef" />
     <ImportExcel ref="dialogRef" />
+    <el-dialog v-model="dialogVisible" title="日志" width="70%">
+      <div class="log">
+        <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 style="width: 100%" 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>
+    </el-dialog>
   </div>
 </template>
 
 <script setup lang="tsx" name="BizProcess">
-import { ref, reactive } from 'vue'
+import { ref, reactive, onMounted, onUnmounted, nextTick, watch } from 'vue'
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
-import { ElMessageBox } from 'element-plus'
+import { ElMessageBox, ElMessage } from 'element-plus'
 import ProTable from '@/components/ProTable/index.vue'
 import ImportExcel from '@/components/ImportExcel/index.vue'
 import FormDialog from '@/components/FormDialog/index.vue'
@@ -50,12 +105,51 @@ 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 logList = ref()
+let logInfo = ref([] as string[])
+let taskType = ref()
+let taskStatus = ref()
 
+let bizProcessList = ref()
+// 每隔10秒请求一下列表
+const timer = ref() // 定时器
+const refreshList = () => {
+  setTimeout(() => {
+    listBizProcessApi({
+      pageNum: 1,
+      pageSize: 100,
+      subTaskId
+    }).then(res => {
+      bizProcessList.value = res.data['list']
+    })
+  }, 0)
+}
+onMounted(() => {
+  getSubtaskApi(subTaskId).then(res => {
+    taskType.value = res.data.type
+    taskStatus.value = res.data.status
+  })
+  refreshList()
+  timer.value = setInterval(() => {
+    refreshList()
+  }, 100000)
+})
 // 删除算法业务处理信息
 const deleteBizProcess = async (params: any) => {
   await useHandleData(delBizProcessApi, params.id, '删除【' + params.id + '】算法业务处理')
@@ -88,6 +182,97 @@ const batchAdd = () => {
   dialogRef.value?.acceptParams(params)
 }
 
+// 对比结果
+const contrastResults = () => {
+  // if (taskStatus.value !== '3') {
+  //   ElMessage.warning(`算法状态为${taskStatus.value},暂无对比结果`)
+  //   return
+  // }
+  switch (taskType.value) {
+    case '1':
+      getTrainResultApi(subTaskId).then(res => {
+        handleResultData(res.data)
+      })
+      break
+    case '2':
+      getVerifyResultApi(subTaskId).then(res => {
+        handleResultData(res.data)
+      })
+      break
+    case '3':
+      getTestResultApi(subTaskId).then(res => {
+        console.log('333', res)
+      })
+      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 => {
+  // if (taskStatus.value !== '0') {
+  //   ElMessage.warning('算法状态为待处理,暂无日志')
+  //   return
+  // }
+  console.log(row.log)
+  const url = '/api/profile/task/log.log'
+  fetchLogFile(url)
+    .then(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 => {
+      console.error('Failed to fetch the log file:', error)
+      ElMessage.error('日志读取错误')
+    })
+}
+
+const fetchLogFile = async url => {
+  try {
+    const response = await fetch(url, { method: 'GET' })
+    if (!response.ok) {
+      throw new Error(`HTTP error! status: ${response.status}`)
+    }
+    return await response.text()
+  } catch (error) {
+    throw error
+  }
+}
+let timer2 = ref()
+const info = logText => {
+  let index = 0
+  const logContainer = document.querySelector('.log')
+  timer2.value = setInterval(() => {
+    if (index < logText.length) {
+      logInfo.value.push(logText[index])
+      index++
+      nextTick(() => {
+        if (logContainer) {
+          logContainer.scrollTop = logContainer.scrollHeight
+        }
+      })
+    } else {
+      clearInterval(timer2.value)
+    }
+  }, 300)
+}
 const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
 // 打开弹框的功能
 const openDialog = async (type: number, title: string, row?: any) => {
@@ -108,7 +293,19 @@ const openDialog = async (type: number, title: string, row?: any) => {
   }
   formDialogRef.value?.openDialog(params)
 }
-
+onUnmounted(() => {
+  clearInterval(timer.value)
+  timer.value = null
+})
+watch(
+  () => dialogVisible.value,
+  val => {
+    if (!val) {
+      clearInterval(timer2.value)
+      timer2.value = null
+    }
+  }
+)
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
   { type: 'selection', fixed: 'left', width: 70 },
@@ -140,10 +337,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',
@@ -197,6 +397,8 @@ const columns = reactive<ColumnProps<any>[]>([
   },
   { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
 ])
+// 结果表格配置项
+// const resultColumns = reactive<ColumnProps<any>[]>([])
 // 表单配置项
 let itemsOptions: ProForm.ItemsOptions[] = []
 const setItemsOptions = () => {
@@ -226,7 +428,11 @@ const setItemsOptions = () => {
       label: '任务状态',
       prop: 'status',
       compOptions: {
-        placeholder: '请输入任务状态'
+        elTagName: 'select',
+        labelKey: 'dictLabel',
+        valueKey: 'dictValue',
+        enum: () => getDictsApi('biz_task_status'),
+        placeholder: '请选择任务状态'
       }
     },
     {
@@ -310,3 +516,46 @@ const setItemsOptions = () => {
   ]
 }
 </script>
+<style scoped lang="scss">
+.log {
+  width: 90%;
+  height: 60vh; /* 根据需要调整 */
+  padding: 10px;
+
+  // padding-bottom: 80px;
+  margin-left: 50px;
+  overflow-y: auto;
+  font-family: 'Courier New', monospace;
+  color: #4aff84;
+  background-color: #1e1e1e;
+}
+.p {
+  padding-left: 10px;
+  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>

+ 43 - 18
src/views/task/subtask/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="table-box">
-    <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listSubtaskApi">
+    <ProTable ref="proTable" :is-show-search="false" :columns="columns" row-key="id" :data="subTaskList">
       <!-- 表格 header 按钮 -->
       <template #tableHeader="scope">
         <el-button type="primary" v-auth="['task:subtask:add']" icon="CirclePlus" @click="openDialog(1, '算法子任务新增')"> 新增 </el-button>
@@ -19,9 +19,7 @@
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
-        <el-button type="primary" link icon="View" v-auth="['task:subtask:query']" @click="openDialog(3, '算法子任务查看', scope.row)">
-          查看
-        </el-button>
+        <el-button type="primary" link icon="View" v-auth="['task:subtask:query']" @click="viewDetails(scope.row)"> 查看详情 </el-button>
         <el-button type="primary" link icon="EditPen" v-auth="['task:subtask:edit']" @click="openDialog(2, '算法子任务编辑', scope.row)">
           编辑
         </el-button>
@@ -34,13 +32,14 @@
 </template>
 
 <script setup lang="tsx" name="Subtask">
-import { ref, reactive } from 'vue'
+import { ref, reactive, onUnmounted, onMounted } from 'vue'
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
 import { ElMessageBox } from 'element-plus'
 import ProTable from '@/components/ProTable/index.vue'
 import ImportExcel from '@/components/ImportExcel/index.vue'
 import FormDialog from '@/components/FormDialog/index.vue'
+import { useRoute, useRouter } from 'vue-router'
 import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
 import {
   listSubtaskApi,
@@ -53,10 +52,37 @@ import {
   getSubtaskApi
 } from '@/api/modules/task/subtask'
 import { getDictsApi } from '@/api/modules/system/dictData'
-
+const router = useRouter()
+const route = useRoute()
+const taskId = route.query.id as string
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
+let subTaskList = ref()
 
+// 每隔10秒请求一下列表
+const timer = ref() // 定时器
+const refreshList = () => {
+  setTimeout(() => {
+    listSubtaskApi({
+      pageNum: 1,
+      pageSize: 100,
+      taskId: taskId
+    }).then(res => {
+      subTaskList.value = res.data['list']
+    })
+  }, 0)
+}
+onMounted(() => {
+  // timer
+  refreshList()
+  timer.value = setInterval(() => {
+    refreshList()
+  }, 10000)
+})
+// 查看详情
+const viewDetails = row => {
+  router.push({ path: `/task/bizProcess/`, query: { id: row.id } })
+}
 // 删除算法子任务信息
 const deleteSubtask = async (params: any) => {
   await useHandleData(delSubtaskApi, params.id, '删除【' + params.id + '】算法子任务')
@@ -109,7 +135,10 @@ const openDialog = async (type: number, title: string, row?: any) => {
   }
   formDialogRef.value?.openDialog(params)
 }
-
+onUnmounted(() => {
+  clearInterval(timer.value)
+  timer.value = null
+})
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
   { type: 'selection', fixed: 'left', width: 70 },
@@ -119,8 +148,7 @@ const columns = reactive<ColumnProps<any>[]>([
     label: '任务名称',
     search: {
       el: 'input'
-    },
-    width: 120
+    }
   },
   {
     prop: 'status',
@@ -135,15 +163,13 @@ const columns = reactive<ColumnProps<any>[]>([
   {
     prop: 'type',
     label: '任务类型',
-    search: {
-      el: 'input'
-    },
-    width: 120
+    tag: true,
+    enum: () => getDictsApi('biz_ag_type'),
+    fieldNames: { label: 'dictLabel', value: 'dictValue' }
   },
   {
     prop: 'parameters',
-    label: '调用算法时所用的参数',
-    width: 120
+    label: '调用算法时所用的参数'
   },
   {
     prop: 'startTime',
@@ -165,10 +191,9 @@ const columns = reactive<ColumnProps<any>[]>([
   },
   {
     prop: 'costSecond',
-    label: '耗时',
-    width: 120
+    label: '耗时'
   },
-  { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
+  { prop: 'operation', label: '操作', width: 270, fixed: 'right' }
 ])
 // 表单配置项
 let itemsOptions: ProForm.ItemsOptions[] = []

+ 8 - 7
src/views/task/task/index.vue

@@ -19,7 +19,7 @@
       </template>
       <!-- 表格操作 -->
       <template #operation="scope">
-        <el-button type="primary" link icon="View" v-auth="['task:task:query']" @click="openDialog(3, '算法任务查看', scope.row)"> 查看 </el-button>
+        <el-button type="primary" link icon="View" v-auth="['task:task:query']" @click="viewDetails(scope.row)"> 查看详情 </el-button>
         <el-button type="primary" link icon="EditPen" v-auth="['task:task:edit']" @click="openDialog(2, '算法任务编辑', scope.row)"> 编辑 </el-button>
         <el-button type="primary" link icon="Delete" v-auth="['task:task:remove']" @click="deleteTask(scope.row)"> 删除 </el-button>
       </template>
@@ -34,6 +34,7 @@ import { ref, reactive } from 'vue'
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
 import { ElMessageBox } from 'element-plus'
+import { useRouter } from 'vue-router'
 import ProTable from '@/components/ProTable/index.vue'
 import ImportExcel from '@/components/ImportExcel/index.vue'
 import FormDialog from '@/components/FormDialog/index.vue'
@@ -49,7 +50,7 @@ import {
   getTaskApi
 } from '@/api/modules/task/task'
 import { getDictsApi } from '@/api/modules/system/dictData'
-
+const router = useRouter()
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
 
@@ -105,6 +106,10 @@ const openDialog = async (type: number, title: string, row?: any) => {
   }
   formDialogRef.value?.openDialog(params)
 }
+// 查看详情
+const viewDetails = row => {
+  router.push({ path: `/task/subtask/`, query: { id: row.id } })
+}
 
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
@@ -153,7 +158,7 @@ const columns = reactive<ColumnProps<any>[]>([
     },
     width: 120
   },
-  { prop: 'operation', label: '操作', width: 230, fixed: 'right' }
+  { prop: 'operation', label: '操作', width: 270, fixed: 'right' }
 ])
 // 表单配置项
 let itemsOptions: ProForm.ItemsOptions[] = []
@@ -170,10 +175,6 @@ const setItemsOptions = () => {
     {
       label: '任务状态',
       prop: 'status',
-      options: {
-        labelKey: 'dictLabel',
-        valueKey: 'dictValue'
-      },
       compOptions: {
         elTagName: 'select',
         labelKey: 'dictLabel',