Explorar o código

feat: 解决提出的部分问题

Rmengdi hai 11 meses
pai
achega
c2066a8432

+ 8 - 0
src/api/modules/task/task.ts

@@ -9,6 +9,14 @@ export const listTaskApi = (query: TaskQuery) => {
   return http.get<TaskVO[]>('/task/task/list', query, { loading: true })
 }
 
+/**
+ * @name 查询所有算法
+ * @returns 返回列表
+ */
+export const getAlgorithmOptionApi = () => {
+  return http.get<TaskVO[]>('/task/task/getAlgorithmOption')
+}
+
 /**
  * @name 查询算法任务详细
  * @param id id

+ 1 - 1
src/components/ProForm/index.vue

@@ -25,7 +25,7 @@
               <SelectIcon v-model:icon-value="formModel[item.prop]" />
             </template>
             <template v-else-if="item.compOptions.elTagName === 'file-upload'">
-              <FileUpload v-model:model-value="formModel[item.prop]" />
+              <FileUpload v-model:model-value="formModel[item.prop]" v-bind="$attrs" />
             </template>
             <template v-else-if="item.compOptions.elTagName === 'img-upload'">
               <uploadImg v-model:image-url="formModel[item.prop]" />

+ 1 - 1
src/routers/modules/routerData.json

@@ -26,7 +26,7 @@
         "link": "",
         "full": false,
         "affix": false,
-        "noCache": true,
+        "noCache": false,
         "activeMenu": "/index"
       }
     },

+ 2 - 0
src/typings/ProForm.d.ts

@@ -118,6 +118,8 @@ declare namespace ProForm {
     checkStrictly?: boolean // 可选
     renderAfterExpand?: boolean // 可选
     controlsPosition?: 'left' | 'right' // 可选
+    fileSize?: number
+    fileType?: Array
     onChange?: (value: any) => void
     onSelect?: (value: any) => void
     onRemove?: (value: any) => void

+ 18 - 4
src/views/ag/model/index.vue

@@ -34,7 +34,7 @@
 </template>
 
 <script setup lang="tsx" name="Model">
-import { ref, reactive } from 'vue'
+import { ref, reactive, onMounted } from 'vue'
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
 import { ElMessageBox } from 'element-plus'
@@ -52,9 +52,11 @@ import {
   exportModelApi,
   getModelApi
 } from '@/api/modules/ag/model'
+import { getAlgorithmOptionApi } from '@/api/modules/task/task'
 
 // ProTable 实例
 const proTable = ref<ProTableInstance>()
+let allAgloData = ref([] as any[])
 
 // 删除算法模型配置信息
 const deleteModel = async (params: any) => {
@@ -154,7 +156,11 @@ const setItemsOptions = () => {
       prop: 'algorithmId',
       rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
       compOptions: {
-        placeholder: '请输入算法'
+        elTagName: 'select',
+        labelKey: 'name',
+        valueKey: 'id',
+        enum: allAgloData.value,
+        placeholder: '请选择算法'
       }
     },
     {
@@ -170,8 +176,11 @@ const setItemsOptions = () => {
       prop: 'modelAddress',
       rules: [{ required: true, message: '模型不能为空', trigger: 'blur' }],
       compOptions: {
-        // placeholder: '请输入模型'
-        elTagName: 'file-upload'
+        elTagName: 'file-upload',
+        fileSize: 4096,
+        fileType: ['pt']
+        // props: { fileSize: 4096, fileType: ['pt'] }
+        // props: { accept: '.pt' }
       }
     },
     {
@@ -197,4 +206,9 @@ const setItemsOptions = () => {
     }
   ]
 }
+onMounted(() => {
+  getAlgorithmOptionApi().then(res => {
+    allAgloData.value = res.data
+  })
+})
 </script>

+ 12 - 11
src/views/taais/homePage/createTask.vue

@@ -145,7 +145,7 @@ let initParam3 = reactive({ type: 3 })
 let initParam4 = reactive({ type: 4 })
 const proTable = ref<ProTableInstance>()
 let model = ref({
-  taskType: '1'
+  taskType: '2'
 })
 
 let formItem = reactive({
@@ -257,13 +257,13 @@ const data1 = [
   }
 ]
 const taskTypeData = [
-  {
-    label: '多数据单算法',
-    value: '1'
-  },
   {
     label: '单数据多算法',
     value: '2'
+  },
+  {
+    label: '多数据单算法',
+    value: '1'
   }
 ]
 const dataColumns = reactive<ColumnProps<any>[]>([
@@ -284,8 +284,8 @@ const dataColumns = reactive<ColumnProps<any>[]>([
     width: 120
   },
   {
-    prop: 'objectType',
-    label: '目标类型',
+    prop: 'batchNum',
+    label: '批次号',
     search: {
       el: 'input',
       defaultValue: ''
@@ -293,8 +293,8 @@ const dataColumns = reactive<ColumnProps<any>[]>([
     width: 120
   },
   {
-    prop: 'objectSubtype',
-    label: '目标类型',
+    prop: 'objectType',
+    label: '目标类型',
     search: {
       el: 'input',
       defaultValue: ''
@@ -302,14 +302,15 @@ const dataColumns = reactive<ColumnProps<any>[]>([
     width: 120
   },
   {
-    prop: 'batchNum',
-    label: '批次号',
+    prop: 'objectSubtype',
+    label: '目标子类型',
     search: {
       el: 'input',
       defaultValue: ''
     },
     width: 120
   },
+
   {
     prop: 'scene',
     label: '场景',

+ 60 - 54
src/views/task/bizProcess/index.vue

@@ -33,7 +33,7 @@
     <FormDialog ref="formDialogRef" />
     <ImportExcel ref="dialogRef" />
     <el-dialog v-model="dialogVisible" title="日志" width="70%">
-      <div class="log">
+      <div class="log" ref="logRef">
         <div class="p" v-for="(item, index) in logInfo" :key="index">{{ item }}</div>
       </div>
     </el-dialog>
@@ -102,7 +102,7 @@
 </template>
 
 <script setup lang="tsx" name="BizProcess">
-import { ref, reactive, onMounted, onUnmounted, nextTick, watch } from 'vue'
+import { ref, reactive, onMounted, onUnmounted, watch, nextTick } from 'vue'
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
 import { ElMessageBox, ElMessage } from 'element-plus'
@@ -137,8 +137,9 @@ let resultsData = ref({})
 let testResultsData = ref({})
 let resultsFlag = ref(false)
 let spanNum = ref<number>(4)
-let logList = ref()
-let logInfo = ref([] as string[])
+// let logList = ref()
+const logRef = ref<HTMLElement | null>(null) // 显式声明 logRef 的类型;
+let logInfo = ref([] as any[])
 let taskType = ref()
 let taskStatus = ref()
 
@@ -165,6 +166,11 @@ onMounted(() => {
   timer.value = setInterval(() => {
     refreshList()
   }, 100000)
+  // 组件挂载后,logRef 将指向实际的 DOM 元素
+  if (logRef.value) {
+    // 操作 logRef 对应的 DOM 元素
+    logRef.value.scrollTop = logRef.value.scrollHeight
+  }
 })
 // 删除算法业务处理信息
 const deleteBizProcess = async (params: any) => {
@@ -247,20 +253,20 @@ const viewLog = row => {
   //   return
   // }
   console.log(row.log)
-  const url = '/api/profile/task/log.log'
+
+  const url = `/api/profile/${row.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)
+      logInfo.value = []
+      logInfo.value = text.split('\n')
       dialogVisible.value = true
+      nextTick(() => {
+        const logContainer = logRef.value
+        if (logContainer) {
+          // 显式地将 logContainer 断言为 HTMLElement
+          ;(logContainer as HTMLElement).scrollTop = (logContainer as HTMLElement).scrollHeight
+        }
+      })
     })
     .catch(error => {
       console.error('Failed to fetch the log file:', error)
@@ -279,24 +285,24 @@ const fetchLogFile = async url => {
     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)
-}
+// 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) => {
@@ -325,23 +331,23 @@ watch(
   () => dialogVisible.value,
   val => {
     if (!val) {
-      clearInterval(timer2.value)
-      timer2.value = null
+      // clearInterval(timer2.value)
+      // timer2.value = null
     }
   }
 )
 // 表格配置项
 const columns = reactive<ColumnProps<any>[]>([
   { type: 'selection', fixed: 'left', width: 70 },
-  { prop: 'id', label: '主键ID' },
-  {
-    prop: 'subTaskId',
-    label: '子任务id',
-    search: {
-      el: 'input'
-    },
-    width: 120
-  },
+  // { prop: 'id', label: '主键ID' },
+  // {
+  //   prop: 'subTaskId',
+  //   label: '子任务id',
+  //   search: {
+  //     el: 'input'
+  //   },
+  //   width: 120
+  // },
   {
     prop: 'name',
     label: '任务名称',
@@ -369,16 +375,16 @@ const columns = reactive<ColumnProps<any>[]>([
     width: 100,
     fieldNames: { label: 'dictLabel', value: 'dictValue' }
   },
-  {
-    prop: 'algorithmId',
-    label: '算法',
-    width: 120
-  },
-  {
-    prop: 'modelId',
-    label: '模型',
-    width: 120
-  },
+  // {
+  //   prop: 'algorithmId',
+  //   label: '算法',
+  //   width: 120
+  // },
+  // {
+  //   prop: 'modelId',
+  //   label: '模型',
+  //   width: 120
+  // },
   {
     prop: 'parameters',
     label: '调用算法时所用的参数',

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

@@ -167,10 +167,10 @@ const columns = reactive<ColumnProps<any>[]>([
     enum: () => getDictsApi('biz_ag_type'),
     fieldNames: { label: 'dictLabel', value: 'dictValue' }
   },
-  {
-    prop: 'parameters',
-    label: '调用算法时所用的参数'
-  },
+  // {
+  //   prop: 'parameters',
+  //   label: '调用算法时所用的参数'
+  // },
   {
     prop: 'startTime',
     label: '开始时间',