|
@@ -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: '调用算法时所用的参数',
|