|
@@ -251,23 +251,30 @@ const handleResultData = data => {
|
|
|
resultsData.value['f1cureList'].unshift('F1_curve')
|
|
|
}
|
|
|
// 查看日志
|
|
|
+let timer2 = ref()
|
|
|
const viewLog = row => {
|
|
|
- // if (taskStatus.value !== '0') {
|
|
|
+ // if (row.status === '0') {
|
|
|
// ElMessage.warning('算法状态为待处理,暂无日志')
|
|
|
// return
|
|
|
// }
|
|
|
- console.log(row.log)
|
|
|
-
|
|
|
- const url = `/api/profile/${row.log}`
|
|
|
+ const url = `/api/profile${row.log}`
|
|
|
+ logShow(url)
|
|
|
+ dialogVisible.value = true
|
|
|
+ timer2.value = setInterval(() => {
|
|
|
+ if (dialogVisible.value) {
|
|
|
+ logShow(url)
|
|
|
+ }
|
|
|
+ }, 5000)
|
|
|
+}
|
|
|
+// 日志读取
|
|
|
+const logShow = (url: any) => {
|
|
|
fetchLogFile(url)
|
|
|
.then(text => {
|
|
|
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
|
|
|
}
|
|
|
})
|
|
@@ -277,7 +284,6 @@ const viewLog = row => {
|
|
|
ElMessage.error('日志读取错误')
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
const fetchLogFile = async url => {
|
|
|
try {
|
|
|
const response = await fetch(url, { method: 'GET' })
|
|
@@ -289,24 +295,6 @@ 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)
|
|
|
-// }
|
|
|
const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
|
|
|
// 打开弹框的功能
|
|
|
const openDialog = async (type: number, title: string, row?: any) => {
|
|
@@ -335,8 +323,8 @@ watch(
|
|
|
() => dialogVisible.value,
|
|
|
val => {
|
|
|
if (!val) {
|
|
|
- // clearInterval(timer2.value)
|
|
|
- // timer2.value = null
|
|
|
+ clearInterval(timer2.value)
|
|
|
+ timer2.value = null
|
|
|
}
|
|
|
}
|
|
|
)
|