From c10b514779632cdfc71bf54aa4b095de64e0fbca Mon Sep 17 00:00:00 2001 From: lbw_9527443 <780139497@qq.com> Date: Sat, 30 Aug 2025 17:19:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=94=80=E5=94=AE=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=BD=B4):=20=E6=B7=BB=E5=8A=A0=E5=AD=90=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=BD=B4=E9=98=B6=E6=AE=B5=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现子时间轴各阶段的点击选择功能,将筛选后的客户数据转换为统一格式并传递给父组件 --- .../components/SalesTimelineWithTaskList.vue | 87 +++++++++++++++---- my-vue-app/src/views/person/sale.vue | 39 +++++++++ 2 files changed, 107 insertions(+), 19 deletions(-) diff --git a/my-vue-app/src/views/person/components/SalesTimelineWithTaskList.vue b/my-vue-app/src/views/person/components/SalesTimelineWithTaskList.vue index 7cbf3c0..4e2a187 100644 --- a/my-vue-app/src/views/person/components/SalesTimelineWithTaskList.vue +++ b/my-vue-app/src/views/person/components/SalesTimelineWithTaskList.vue @@ -36,7 +36,7 @@ - +
@@ -46,14 +46,14 @@ 转化率: {{ getCourseConversionRate(1) }}%
-
+
课1 {{ getCourseStageCount(1, '课1') }}
-
+
付定金 @@ -69,35 +69,35 @@ 课2
-
+
课2 {{ getCourseStageCount(2, '课2') }}
-
+
点击支付 {{ getCourseStageCount(2, '点击未支付') }}
-
+
付定金 {{ getCourseStageCount(2, '付定金') }}
-
+
定金转化 {{ getCourseStageCount(2, '定金转化') }}
-
+
成交 @@ -113,35 +113,35 @@ 课3
-
+
课3 {{ getCourseStageCount(3, '课3') }}
-
+
点击未支付 {{ getCourseStageCount(3, '点击未支付') }}
-
+
付定金 {{ getCourseStageCount(3, '付定金') }}
-
+
定金转化 {{ getCourseStageCount(3, '定金转化') }}
-
+
成交 @@ -157,35 +157,35 @@ 课4
-
+
课4 {{ getCourseStageCount(4, '课4') }}
-
+
点击未付 {{ getCourseStageCount(4, '点击未支付') }}
-
+
付定金 {{ getCourseStageCount(4, '付定金') }}
-
+
定金转化 {{ getCourseStageCount(4, '定金转化') }}
-
+
成交 @@ -195,7 +195,7 @@
-
+
@@ -768,6 +768,55 @@ const getHealthClass = (health) => { return 'health-danger'; } }; + +// 选择课程阶段 +const selectCourseStage = (courseNumber, stageType) => { + let filteredCustomers = []; + + if (stageType === `课${courseNumber}`) { + // 课程阶段:从customersList中筛选 + filteredCustomers = props.customersList.filter(customer => { + const classNum = customer.class_num; + const classSituation = customer.class_situation; + + // 检查class_num字段 + if (classNum && Array.isArray(classNum)) { + return classNum.includes(courseNumber); + } + + // 检查class_situation字段 + if (classSituation) { + if (Array.isArray(classSituation)) { + return classSituation.includes(courseNumber); + } + if (typeof classSituation === 'object') { + return classSituation.hasOwnProperty(courseNumber.toString()); + } + } + + return false; + }); + } else { + // 其他阶段:从courseCustomers中筛选 + if (props.courseCustomers?.['课1-4']) { + filteredCustomers = props.courseCustomers['课1-4'].filter(customer => { + // 检查客户是否参加了指定课程并且类型匹配 + const hasAttendedCourse = customer.class_num && customer.class_num.includes(courseNumber); + return hasAttendedCourse && customer.type === stageType; + }); + } + } + + // 发送子时间轴选择事件给父组件,使用不同的事件名称避免与主轴冲突 + emit('sub-stage-select', { + filteredCustomers, + stageType: `课${courseNumber}-${stageType}`, + customerCount: filteredCustomers.length, + courseNumber, + originalStageType: stageType, + keepSubTimeline: true // 标识保持子时间轴显示 + }); +};