parent
08315bf54b
commit
ed64a9c5a3
|
|
@ -19,10 +19,11 @@ const ruleFormRef = ref<FormInstance>()
|
||||||
const ruleForm = reactive<RuleForm>({
|
const ruleForm = reactive<RuleForm>({
|
||||||
vidPath: '',
|
vidPath: '',
|
||||||
function: [
|
function: [
|
||||||
// 'runSam3',
|
'runAudioRecognition',
|
||||||
// 'runHazardCheck',
|
'runSam3',
|
||||||
// 'runGenerateReport',
|
'runHazardCheck',
|
||||||
// 'runAudioRecognition',
|
'runGenerateReport',
|
||||||
|
'convertToMp4',
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -71,30 +72,47 @@ async function runCheck(formEl: FormInstance | undefined) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (valid) {
|
if (valid) {
|
||||||
isRunningCheck.value = true
|
runProcess()
|
||||||
startTimer()
|
}
|
||||||
if (ruleForm.function.includes('runAudioRecognition')) {
|
}
|
||||||
await runApiAudio('recognize', 'GET', {
|
|
||||||
path: vidPaths.value[vidPaths.value.indexOf(ruleForm.vidPath)],
|
async function runProcess() {
|
||||||
|
isRunningCheck.value = true
|
||||||
|
startTimer()
|
||||||
|
const tasks: Promise<any>[] = []
|
||||||
|
|
||||||
|
if (ruleForm.function.includes('runAudioRecognition')) {
|
||||||
|
tasks.push(runApiAudio('recognize', 'GET', {
|
||||||
|
path: vidPaths.value[vidPaths.value.indexOf(ruleForm.vidPath)],
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ruleForm.function.includes('convertToMp4')) {
|
||||||
|
tasks.push(runApiAudio('convert', 'GET', {
|
||||||
|
path: vidPaths.value[vidPaths.value.indexOf(ruleForm.vidPath)],
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.push(runApi('/run', {
|
||||||
|
vid_file: vidPaths.value[vidPaths.value.indexOf(ruleForm.vidPath)],
|
||||||
|
run_sam3: ruleForm.function.includes('runSam3'),
|
||||||
|
run_inspection: ruleForm.function.includes('runHazardCheck'),
|
||||||
|
gen_report: ruleForm.function.includes('runGenerateReport'),
|
||||||
|
}))
|
||||||
|
|
||||||
|
await Promise.all(tasks).then((results) => {
|
||||||
|
isRunningCheck.value = false
|
||||||
|
// 判定是否成功运行
|
||||||
|
const lastRes = results[results.length - 1]
|
||||||
|
if (lastRes !== 'error') {
|
||||||
|
router.push({
|
||||||
|
path: '/nav/hazardCheckResult',
|
||||||
|
query: { vid_file: vidPaths.value[vidPaths.value.indexOf(ruleForm.vidPath)] },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await runApi('/run', {
|
})
|
||||||
vid_file: vidPaths.value[vidPaths.value.indexOf(ruleForm.vidPath)],
|
|
||||||
run_sam3: ruleForm.function.includes('runSam3'),
|
stopTimer()
|
||||||
run_inspection: ruleForm.function.includes('runHazardCheck'),
|
|
||||||
gen_report: ruleForm.function.includes('runGenerateReport'),
|
|
||||||
}).then((res) => {
|
|
||||||
isRunningCheck.value = false
|
|
||||||
stopTimer()
|
|
||||||
// 判定是否成功运行
|
|
||||||
if (res !== 'error') {
|
|
||||||
router.push({
|
|
||||||
path: '/nav/hazardCheckResult',
|
|
||||||
query: { vid_file: vidPaths.value[vidPaths.value.indexOf(ruleForm.vidPath)] },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reloadFiles() {
|
async function reloadFiles() {
|
||||||
|
|
@ -153,6 +171,12 @@ onMounted(() => {
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="功能选择" prop="function">
|
<el-form-item label="功能选择" prop="function">
|
||||||
<el-checkbox-group v-model="ruleForm.function" class="checkbox-group">
|
<el-checkbox-group v-model="ruleForm.function" class="checkbox-group">
|
||||||
|
<el-checkbox value="convertToMp4" name="function">
|
||||||
|
视频转码
|
||||||
|
</el-checkbox>
|
||||||
|
<el-checkbox value="runAudioRecognition" name="function">
|
||||||
|
音频识别
|
||||||
|
</el-checkbox>
|
||||||
<el-checkbox value="runSam3" name="function">
|
<el-checkbox value="runSam3" name="function">
|
||||||
物体识别
|
物体识别
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
|
|
@ -162,9 +186,6 @@ onMounted(() => {
|
||||||
<el-checkbox value="runGenerateReport" name="function">
|
<el-checkbox value="runGenerateReport" name="function">
|
||||||
生成报告
|
生成报告
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<el-checkbox value="runAudioRecognition" name="function">
|
|
||||||
音频识别
|
|
||||||
</el-checkbox>
|
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!isRunningCheck">
|
<el-form-item v-if="!isRunningCheck">
|
||||||
|
|
|
||||||
|
|
@ -327,29 +327,17 @@ onMounted(async () => {
|
||||||
const vidFile = router.currentRoute.value.query.vid_file as string
|
const vidFile = router.currentRoute.value.query.vid_file as string
|
||||||
if (vidFile) {
|
if (vidFile) {
|
||||||
// 调用接口获取完整视频路径
|
// 调用接口获取完整视频路径
|
||||||
runApi('/get_full_vid_path', {
|
runApiAudio('/getVidUrl', 'GET', {
|
||||||
vid_file: vidFile,
|
path: vidFile,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
if (res === 'error') {
|
||||||
|
console.error('获取视频路径失败')
|
||||||
|
return
|
||||||
|
}
|
||||||
// console.log('接口调用成功,返回数据:', res)
|
// console.log('接口调用成功,返回数据:', res)
|
||||||
vidUrl.value = (res as string[])[0]
|
vidUrl.value = res.url
|
||||||
|
|
||||||
// 截取文件名
|
|
||||||
const fileName = vidUrl.value.split('\\').pop() || ''
|
|
||||||
// 去掉文件扩展名
|
|
||||||
const fileNameNoExt = fileName.split('.')[0]
|
|
||||||
// 文件扩展名
|
|
||||||
// const fileExt = fileName.split('.')[1]
|
|
||||||
// 临时拼接视频路径
|
|
||||||
vidUrl.value = `http://localhost:8086/${fileNameNoExt}_h264.mp4`
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 临时拼接视频路径
|
|
||||||
// 去掉文件扩展名
|
|
||||||
// const fileNameNoExt = vidFile.split('.')[0]
|
|
||||||
// // 文件扩展名
|
|
||||||
// const fileExt = vidFile.split('.')[1]
|
|
||||||
// vidUrl.value = `http://localhost:8086/${fileNameNoExt}_h264.${fileExt}`
|
|
||||||
|
|
||||||
// 调用接口获取隐患数据
|
// 调用接口获取隐患数据
|
||||||
runApi('/run', {
|
runApi('/run', {
|
||||||
vid_file: vidFile,
|
vid_file: vidFile,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue