@@ -40,16 +40,7 @@
< / div >
< div class = "section-title" > 运行方式 < / div >
< div class = "run-mode-zone" >
< label class = "run-mode-row" >
< input type = "radio" name = "brand-run-mode" value = "immediate" v-model = "runMode" / >
< span class = "run-mode-text" > 立即执行 ( 前台运行 , 可实时取消 ) < / span >
< / label >
< label class = "run-mode-row" >
< input type = "radio" name = "brand-run-mode" value = "queue" v-model = "runMode" / >
< span class = "run-mode-text" > 添加到任务队列 ( 后台排队执行 ) < / span >
< / label >
< / div >
< p class = "loading-msg" > 提交后立即开始检测 , 可在右侧任务列表查看进度或取消 。 < / p >
< div class = "run-row" >
< button
@@ -58,7 +49,7 @@
: disabled = "!selectedPaths.length || submitting || !hasBridge || !hasUid"
@click ="submitRun"
>
{ { submitting ? '提交中...' : runMode === 'immediate' ? '立即运行品牌检测' : '添加到任务队列 ' } }
{ { submitting ? '提交中...' : '立即运行品牌检测 ' } }
< / button >
< / div >
< p v-if = "!hasBridge || !hasUid" class="env-tip" >
@@ -121,7 +112,6 @@ import type { TaskItemView, TaskStatCard } from '@/shared/components/tasks/types
import { getPywebviewApi } from '@/shared/bridges/pywebview'
import {
cancelBrandTask ,
createBrandTask ,
deleteBrandTask ,
getBrandTaskDownloadUrl ,
getBrandTasks ,
@@ -136,7 +126,6 @@ import type { BrandExpandFolderItem } from '@/shared/api/types/modules/brand'
const uploadedFiles = ref < UploadFileVo [ ] > ( [ ] )
const strategy = ref < 'Terms' | 'Simple' > ( 'Terms' )
const runMode = ref < 'immediate' | 'queue' > ( 'immediate' )
const submitting = ref ( false )
const tasks = ref < BrandTaskItem [ ] > ( [ ] )
@@ -364,20 +353,11 @@ async function submitRun() {
relativePath : f . relativePath ,
fileUrl : f . url || f . localPath ,
} ) )
if ( runMode . value === 'immediate' ) {
const res = await runBrandNow ( files , strategy . value )
if ( res . success && res . task _id ) {
ElMessage . success ( ` 已创建任务 ${ res . task _id } ,客户端开始检测 ` )
} else {
throw new Error ( ( res as { error ? : string } ) . error || '运行失败' )
}
const res = await runBrandNow ( files , strategy . value )
if ( res . success && res . task _id ) {
ElMessage . success ( ` 已创建任务 ${ res . task _id } ,开始检测 ` )
} else {
const res = await createBrandTask ( files , strategy . value )
if ( res . success && res . task _id ) {
ElMessage . success ( ` 任务 ${ res . task _id } 已添加到队列 ` )
} else {
throw new Error ( ( res as { error ? : string } ) . error || '添加失败' )
}
throw new Error ( ( res as { error ? : string } ) . error || '运行失败' )
}
uploadedFiles . value = [ ]
await loadTasks ( )