fix: 修复多个组件的数据处理和API调用问题
修复QualityCalls组件录音数据处理逻辑,确保正确显示动态数据 修正sale.vue中选中客户后获取统计数据的调用顺序 更新API基础路径为生产环境地址 优化CenterOverview组件默认值和显示逻辑 修复SalesTimelineWithTaskList组件课程显示和阶段计数问题
This commit is contained in:
@@ -347,11 +347,11 @@ const stages = computed(() => {
|
||||
|
||||
const stageList = [
|
||||
{ id: 0, name: '全部', displayName: '全部', count: totalCount, color: '#f3f4f6' },
|
||||
{ id: 1, name: '待加微', displayName: '待加微', count: getStageCount('待加微'), color: '#e3f2fd' ,unName:'已加微'},
|
||||
{ id: 2, name: '待填表单', displayName: '待填表单', count: getStageCount('待填表单'), color: '#90caf9' ,unName:'已填表单'},
|
||||
{ id: 3, name: '待入群', displayName: '待入群', count: getStageCount('待入群'), color: '#bbdefb' ,unName:'已入群'},
|
||||
{ id: 4, name: '待联系', displayName: '待联系', count: getStageCount('待联系'), color: '#bbdefb' ,unName:'已联系'},
|
||||
{ id: 5, name: '待到课', displayName: '待到课', count: getStageCount('待到课'), color: '#bbdefb' ,unName:'已到课'},
|
||||
{ id: 1, name: '待加微', displayName: '待加微', count: getStageCount('待加微'), color: '#e3f2fd' },
|
||||
{ id: 2, name: '待填表单', displayName: '待填表单', count: getStageCount('待填表单'), color: '#90caf9' },
|
||||
{ id: 3, name: '待入群', displayName: '待入群', count: getStageCount('待入群'), color: '#bbdefb' },
|
||||
{ id: 4, name: '待联系', displayName: '待联系', count: getStageCount('待联系'), color: '#bbdefb' },
|
||||
{ id: 5, name: '待到课', displayName: '待到课', count: getStageCount('待到课'), color: '#bbdefb'},
|
||||
{ id: 6, name: '课1', displayName: '课1', count: getStageCount('课1'), color: '#81c784' },
|
||||
{ id: 7, name: '课2', displayName: '课2', count: getStageCount('课2'), color: '#64b5f6' },
|
||||
{ id: 8, name: '课3', displayName: '课3', count: getStageCount('课3'), color: '#ffb74d' },
|
||||
@@ -515,19 +515,21 @@ const closeModal = () => {
|
||||
const getAttendedLessons = (classSituation, classNum) => {
|
||||
// 优先使用 class_num 字段
|
||||
if (classNum && Array.isArray(classNum) && classNum.length > 0) {
|
||||
return classNum.sort((a, b) => a - b).join(' ');
|
||||
const filteredClassNum = classNum.filter(num => num !== -1);
|
||||
return filteredClassNum.length > 0 ? filteredClassNum.sort((a, b) => a - b).join(' ') : '未到课';
|
||||
}
|
||||
|
||||
// 如果没有 class_num,则使用 class_situation
|
||||
if (!classSituation) return '未到课';
|
||||
|
||||
if (Array.isArray(classSituation)) {
|
||||
return classSituation.join(' ');
|
||||
const filteredSituation = classSituation.filter(item => item !== -1);
|
||||
return filteredSituation.length > 0 ? filteredSituation.join(' ') : '未到课';
|
||||
}
|
||||
if (typeof classSituation === 'object') {
|
||||
const lessonNumbers = Object.keys(classSituation)
|
||||
.map(key => parseInt(key))
|
||||
.filter(num => !isNaN(num))
|
||||
.filter(num => !isNaN(num) && num !== -1)
|
||||
.sort((a, b) => a - b);
|
||||
return lessonNumbers.length > 0 ? lessonNumbers.join(' ') : '未到课';
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ const hideTooltip = () => {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* ... 您的样式代码不变 ... */
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -624,6 +624,7 @@ const selectContact = (id) => {
|
||||
// 当选中客户后,获取客户表单数据
|
||||
nextTick(async () => {
|
||||
if (selectedContact.value && selectedContact.value.name) {
|
||||
await getStatisticsData()
|
||||
await getCustomerForm();
|
||||
await getCustomerChat();
|
||||
await getCustomerCall();
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</span>
|
||||
<span class="card-trend positive">{{ props.overallData.CenterPerformance?.center_monthly_vs_previous_deals }} vs 上期</span>
|
||||
</div>
|
||||
<div class="card-value">{{ props.overallData.CenterPerformance.center_monthly_deal_count || '552,000' }} 单</div>
|
||||
<div class="card-value">{{ props.overallData.CenterPerformance.center_monthly_deal_count || '0' }} 单</div>
|
||||
<div class="card-subtitle">月目标完成率: {{ props.overallData.CenterPerformance?.center_monthly_target_completion_rate || '56%' }}</div>
|
||||
</div>
|
||||
|
||||
@@ -34,8 +34,7 @@
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
活跃组数
|
||||
<i
|
||||
@mouseenter="showTooltip($event, 'activeGroups')"
|
||||
<i @mouseenter="showTooltip($event, 'activeGroups')"
|
||||
@mouseleave="hideTooltip">ⓘ</i>
|
||||
</span>
|
||||
<span class="card-trend stable">{{ props.overallData.TotalGroupCount?.center_total_team_count}}/{{ props.overallData.TotalGroupCount?.center_total_team_count }} 组</span>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<!-- Top Section - Center Overview and Action Items -->
|
||||
<div class="top-section">
|
||||
<!-- Center Performance Overview -->
|
||||
<CenterOverview :overall-data="overallCenterPerformance" @update-check-type="updateCheckType" />
|
||||
<CenterOverview :key="CheckType" :overall-data="overallCenterPerformance" @update-check-type="updateCheckType" />
|
||||
|
||||
<!-- Action Items (Compact) -->
|
||||
<div class="action-items-compact">
|
||||
|
||||
@@ -180,9 +180,15 @@ import MarkdownIt from 'markdown-it'
|
||||
|
||||
export default {
|
||||
name: 'QualityCalls',
|
||||
props: {
|
||||
qualityCalls: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
recordings: [
|
||||
staticRecordings: [
|
||||
{
|
||||
id: 1,
|
||||
name: '常家硕-张三丰-亮剑二部-20分钟通话-25-07-16_18-23-04-44196-215.mp3',
|
||||
@@ -247,6 +253,32 @@ export default {
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
// 处理传入的录音数据
|
||||
recordings() {
|
||||
if (!this.qualityCalls || !this.qualityCalls.excellent_record_list) {
|
||||
return this.staticRecordings;
|
||||
}
|
||||
|
||||
const recordings = [];
|
||||
Object.keys(this.qualityCalls.excellent_record_list).forEach(userName => {
|
||||
this.qualityCalls.excellent_record_list[userName].forEach((record, index) => {
|
||||
recordings.push({
|
||||
id: recordings.length + 1,
|
||||
name: record.obj_file_name ? record.obj_file_name.split('/').pop() : `${record.sale_name}-录音-${index + 1}`,
|
||||
size: 2048576, // 默认大小
|
||||
duration: '00:03:45', // 默认时长
|
||||
date: new Date().toISOString().split('T')[0],
|
||||
url: record.obj_file_name,
|
||||
transcription: record.context || null,
|
||||
score: record.score,
|
||||
sop: record.sop,
|
||||
sale_name: record.sale_name
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return recordings;
|
||||
},
|
||||
// 格式化分析结果
|
||||
formattedAnalysisResult() {
|
||||
if (!this.analysisResult) return ''
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
/>
|
||||
<!-- 优质通话 -->
|
||||
<quality-calls
|
||||
:quality-calls="qualityCalls"
|
||||
:quality-calls="excellentRecord"
|
||||
@play-call="playCall"
|
||||
@download-call="downloadCall"
|
||||
/>
|
||||
@@ -496,6 +496,19 @@ const params={
|
||||
try {
|
||||
const res = await getExcellentRecordFile(params)
|
||||
excellentRecord.value = res.data
|
||||
/**
|
||||
* "user_name": "赵世敬",
|
||||
"user_level": 5,
|
||||
"excellent_record_list": {
|
||||
"马然": [
|
||||
{
|
||||
"sale_name": "马然",
|
||||
"sop": ...,
|
||||
"context": "...",
|
||||
"obj_file_name": "http://192.168.3.112:5000/api/record/download/马然-20分钟通话-25-08-20_20-24-43-653520-759.mp3",
|
||||
"score": 55.0
|
||||
},]}
|
||||
*/
|
||||
} catch (error) {
|
||||
console.error("获取优秀录音失败:", error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user