|
|
|
@ -270,7 +270,8 @@ export default {
|
|
|
|
|
sentimentAnalysis: [],
|
|
|
|
|
keyEntities: [],
|
|
|
|
|
logs: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
errorMessage: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -312,37 +313,67 @@ export default {
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
...mapActions('process', [
|
|
|
|
|
'processAnalysis'
|
|
|
|
|
'processAnalysis',
|
|
|
|
|
'setStepStatus'
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
startAnalysis() {
|
|
|
|
|
this.isLoading = true
|
|
|
|
|
this.analysisStatus = 'running'
|
|
|
|
|
this.analysisProgress = 0
|
|
|
|
|
this.analysisStatus = 'running';
|
|
|
|
|
this.isLoading = true;
|
|
|
|
|
this.analysisProgress = 0;
|
|
|
|
|
this.errorMessage = '';
|
|
|
|
|
|
|
|
|
|
// 模拟分析过程
|
|
|
|
|
this.analysisTimer = setInterval(() => {
|
|
|
|
|
this.analysisProgress += Math.floor(Math.random() * 5) + 1
|
|
|
|
|
|
|
|
|
|
if (this.analysisProgress >= 100) {
|
|
|
|
|
clearInterval(this.analysisTimer)
|
|
|
|
|
this.analysisProgress = 100
|
|
|
|
|
this.isLoading = false
|
|
|
|
|
this.analysisStatus = 'completed'
|
|
|
|
|
|
|
|
|
|
// 生成模拟分析结果
|
|
|
|
|
this.resultData = this.generateMockResult()
|
|
|
|
|
|
|
|
|
|
// 通知处理流程管理器
|
|
|
|
|
this.$emit('next')
|
|
|
|
|
// 模拟分析过程的进度
|
|
|
|
|
this.progressTimer = setInterval(() => {
|
|
|
|
|
if (this.analysisProgress < 100) {
|
|
|
|
|
this.analysisProgress += Math.floor(Math.random() * 5) + 1;
|
|
|
|
|
if (this.analysisProgress > 100) {
|
|
|
|
|
this.analysisProgress = 100;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
clearInterval(this.progressTimer);
|
|
|
|
|
this.completeAnalysis();
|
|
|
|
|
}
|
|
|
|
|
}, 300);
|
|
|
|
|
|
|
|
|
|
// 在真实场景中,这里应该调用API来执行大模型分析
|
|
|
|
|
// 模拟API调用延迟
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
try {
|
|
|
|
|
this.loadAnalysisResultData();
|
|
|
|
|
this.analysisStatus = 'completed';
|
|
|
|
|
this.setStepStatus({ step: 'analysis', status: 'completed' });
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('分析过程出错:', error);
|
|
|
|
|
this.analysisStatus = 'error';
|
|
|
|
|
this.errorMessage = '分析过程中发生错误:' + (error.message || '未知错误');
|
|
|
|
|
clearInterval(this.progressTimer);
|
|
|
|
|
}
|
|
|
|
|
}, 300)
|
|
|
|
|
}, 8000);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
loadAnalysisResultData() {
|
|
|
|
|
console.log('加载分析结果数据');
|
|
|
|
|
this.resultData = this.generateMockResult();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleRetry() {
|
|
|
|
|
this.analysisStatus = 'pending'
|
|
|
|
|
this.analysisProgress = 0
|
|
|
|
|
this.$emit('retry')
|
|
|
|
|
this.errorMessage = '';
|
|
|
|
|
this.startAnalysis();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
completeAnalysis() {
|
|
|
|
|
this.isLoading = false;
|
|
|
|
|
this.isCompleted = true;
|
|
|
|
|
this.$emit('next');
|
|
|
|
|
|
|
|
|
|
// 使用路由实例的push方法时通过catch优雅处理NavigationDuplicated错误
|
|
|
|
|
// 这样处理路由跳转,即使调用了多次相同的路由也不会报错
|
|
|
|
|
this.$router.push('/statistics').catch(err => {
|
|
|
|
|
if (err.name !== 'NavigationDuplicated') {
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
generateMockResult() {
|
|
|
|
@ -505,7 +536,10 @@ export default {
|
|
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
if (this.analysisTimer) {
|
|
|
|
|
clearInterval(this.analysisTimer)
|
|
|
|
|
clearInterval(this.analysisTimer);
|
|
|
|
|
}
|
|
|
|
|
if (this.progressTimer) {
|
|
|
|
|
clearInterval(this.progressTimer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|