From d6a4ff3843f1acbbf1d145739fb9026f6d71e64a Mon Sep 17 00:00:00 2001 From: lbw_9527443 <780139497@qq.com> Date: Tue, 12 Aug 2025 22:58:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=A2=E9=98=9F=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=9B=A2=E9=98=9F=E4=B8=9A=E7=BB=A9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96=E7=BB=84?= =?UTF-8?q?=E5=90=8D=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构团队管理页面,使用API获取真实业绩数据替换模拟数据 添加团队业绩详情接口调用逻辑 优化组名解析逻辑以支持单横线和双横线格式 移除冗余的模拟数据代码 --- my-vue-app/src/api/senorManger.js | 1 + .../components/GroupComparison.vue | 21 +- .../src/views/senorManger/seniorManager.vue | 598 ++---------------- 3 files changed, 66 insertions(+), 554 deletions(-) diff --git a/my-vue-app/src/api/senorManger.js b/my-vue-app/src/api/senorManger.js index b52c03b..5013b1a 100644 --- a/my-vue-app/src/api/senorManger.js +++ b/my-vue-app/src/api/senorManger.js @@ -64,3 +64,4 @@ export const getTeamRankingInfo = (params) => { + diff --git a/my-vue-app/src/views/senorManger/components/GroupComparison.vue b/my-vue-app/src/views/senorManger/components/GroupComparison.vue index 6071dff..5189368 100644 --- a/my-vue-app/src/views/senorManger/components/GroupComparison.vue +++ b/my-vue-app/src/views/senorManger/components/GroupComparison.vue @@ -61,10 +61,23 @@ const processedGroups = computed(() => { const performance = formalPlural[groupName] || 0 const conversionRate = parseFloat(compositionTransformation[groupName]) || 0 - // 从组名中提取组长信息 - const nameParts = groupName.split('-') - const name = nameParts[0] || groupName - const leader = nameParts[1] || '未知' + // 从组名中提取组长信息,处理单个'-'和双个'--'两种格式 + let name, leader + if (groupName.includes('--')) { + // 处理双横线格式:"星火一部--张瑾" + const parts = groupName.split('--') + name = parts[0] || groupName + leader = parts[1] || '未知' + } else if (groupName.includes('-')) { + // 处理单横线格式:"巅峰五部-时永帅" + const parts = groupName.split('-') + name = parts[0] || groupName + leader = parts[1] || '未知' + } else { + // 没有分隔符的情况:"技术部" + name = groupName + leader = '未知' + } return { id: index + 1, diff --git a/my-vue-app/src/views/senorManger/seniorManager.vue b/my-vue-app/src/views/senorManger/seniorManager.vue index 2d22902..5341b26 100644 --- a/my-vue-app/src/views/senorManger/seniorManager.vue +++ b/my-vue-app/src/views/senorManger/seniorManager.vue @@ -64,7 +64,7 @@
成员数: - {{ selectedGroup.memberCount }}人 + {{ teamPerformanceDetail.group_details.length }}人
今日业绩: @@ -79,54 +79,48 @@

{{ member.name }}

-

{{ member.position }}

-

{{ member.phone }}

-
- {{ getStatusText(member.status) }} - 入职: {{ member.joinDate }} -
-
- +
今日业绩 - {{ formatCurrency(member.todayPerformance) }} + {{ member.today_performance }} +
月度业绩 - {{ formatCurrency(member.monthlyPerformance) }} + {{ member.monthly_performance }} +
转化率 - {{ member.conversionRate }}% + {{ member.conversion_rate_this_period }}
通话次数 - {{ member.callCount }} + {{ member.call_count_this_period }}
新增客户 - {{ member.newClients }} + {{ member.new_customers_this_period }}
成交订单 - {{ member.deals }} + {{ member.deals_this_period }}
@@ -151,11 +145,8 @@ import ProblemRanking from './components/ProblemRanking.vue' import StatisticalIndicators from './components/StatisticalIndicators.vue' import UserDropdown from '@/components/UserDropdown.vue' import { getOverallTeamPerformance,getTotalGroupCount,getConversionRate,getTotalCallCount, - getNewCustomer,getDepositConversionRate,getActiveCustomerCommunicationRate,getAverageAnswerTime, - getTimeoutRate,getTableFillingRate,getUrgentNeedToAddress,getTeamRanking } from '@/api/senorManger.js' - - - + getNewCustomer,getDepositConversionRate,getActiveCustomerCommunicationRate,getAverageAnswerTime, + getTimeoutRate,getTableFillingRate,getUrgentNeedToAddress,getTeamRanking,getTeamRankingInfo } from '@/api/senorManger.js' import { useUserStore } from '@/stores/user.js' @@ -396,6 +387,23 @@ async function fetchTeamRanking() { } } +// 团队业绩详情 +const teamPerformanceDetail = ref({}) +async function fetchTeamPerformanceDetail(department) { + const params={ + user_name: userStore.userInfo.username, + user_level: userStore.userInfo.user_level.toString(), + department: department + } + try { + teamPerformanceDetail.value = {} + const response = await getTeamRankingInfo(params) + teamPerformanceDetail.value = response.data + console.log('团队业绩详情:', response.data) + } catch (error) { + console.error('获取团队业绩详情失败:', error) + } +} // 初始化时获取数据 onMounted(async ()=>{ // await fetchOverallTeamPerformance() @@ -410,544 +418,34 @@ onMounted(async ()=>{ // await fetchTableFillingRate() await fetchUrgentNeedToAddress() await fetchTeamRanking() - // await fetchProblemRanking() - - }) - - - - - - - - - - - - - - - - // 组别数据 -const groups = [ - { - id: 1, - name: '精英组', - leader: '李主管', - memberCount: 8, - todayPerformance: 156000, - monthlyTarget: 800000, - monthlyProgress: 65, - conversionRate: 6.8, - avgCallTime: 7.2, - newClients: 28, - deals: 12, - status: 'excellent', - trend: 'up', - alerts: [], - members: [ - { - id: 1, - name: '张小明', - position: '高级销售', - phone: '138****1234', - todayPerformance: 25000, - monthlyPerformance: 180000, - conversionRate: 8.2, - callCount: 45, - newClients: 6, - deals: 3, - status: 'excellent', - joinDate: '2022-03-15' - }, - { - id: 2, - name: '王丽华', - position: '销售专员', - phone: '139****5678', - todayPerformance: 22000, - monthlyPerformance: 165000, - conversionRate: 7.5, - callCount: 38, - newClients: 5, - deals: 2, - status: 'excellent', - joinDate: '2021-08-20' - }, - { - id: 3, - name: '刘强东', - position: '销售专员', - phone: '137****9012', - todayPerformance: 18000, - monthlyPerformance: 142000, - conversionRate: 6.8, - callCount: 42, - newClients: 4, - deals: 2, - status: 'good', - joinDate: '2022-01-10' - }, - { - id: 4, - name: '陈美玲', - position: '销售专员', - phone: '136****3456', - todayPerformance: 20000, - monthlyPerformance: 158000, - conversionRate: 7.1, - callCount: 40, - newClients: 5, - deals: 2, - status: 'good', - joinDate: '2021-11-05' - }, - { - id: 5, - name: '赵志伟', - position: '销售专员', - phone: '135****7890', - todayPerformance: 16000, - monthlyPerformance: 125000, - conversionRate: 6.2, - callCount: 35, - newClients: 3, - deals: 1, - status: 'good', - joinDate: '2022-05-18' - }, - { - id: 6, - name: '孙晓燕', - position: '销售专员', - phone: '134****2345', - todayPerformance: 19000, - monthlyPerformance: 148000, - conversionRate: 6.9, - callCount: 37, - newClients: 4, - deals: 2, - status: 'good', - joinDate: '2021-12-12' - }, - { - id: 7, - name: '周建华', - position: '销售专员', - phone: '133****6789', - todayPerformance: 17000, - monthlyPerformance: 135000, - conversionRate: 6.5, - callCount: 33, - newClients: 3, - deals: 1, - status: 'good', - joinDate: '2022-02-28' - }, - { - id: 8, - name: '吴雅琴', - position: '销售专员', - phone: '132****0123', - todayPerformance: 19000, - monthlyPerformance: 152000, - conversionRate: 7.0, - callCount: 39, - newClients: 4, - deals: 2, - status: 'good', - joinDate: '2021-09-15' - } - ] - }, - { - id: 2, - name: '冲锋组', - leader: '张主管', - memberCount: 10, - todayPerformance: 142000, - monthlyTarget: 900000, - monthlyProgress: 58, - conversionRate: 5.9, - avgCallTime: 6.8, - newClients: 32, - deals: 10, - status: 'good', - trend: 'up', - alerts: ['需要加强追单环节'], - members: [ - { - id: 9, - name: '李建国', - position: '高级销售', - phone: '138****4567', - todayPerformance: 18000, - monthlyPerformance: 145000, - conversionRate: 6.8, - callCount: 42, - newClients: 4, - deals: 2, - status: 'good', - joinDate: '2021-06-10' - }, - { - id: 10, - name: '马晓丽', - position: '销售专员', - phone: '139****8901', - todayPerformance: 16000, - monthlyPerformance: 128000, - conversionRate: 6.2, - callCount: 38, - newClients: 3, - deals: 1, - status: 'good', - joinDate: '2022-04-22' - }, - { - id: 11, - name: '杨志强', - position: '销售专员', - phone: '137****2345', - todayPerformance: 14000, - monthlyPerformance: 112000, - conversionRate: 5.8, - callCount: 35, - newClients: 3, - deals: 1, - status: 'average', - joinDate: '2022-07-08' - }, - { - id: 12, - name: '黄美娟', - position: '销售专员', - phone: '136****6789', - todayPerformance: 15000, - monthlyPerformance: 120000, - conversionRate: 6.0, - callCount: 36, - newClients: 3, - deals: 1, - status: 'good', - joinDate: '2021-10-30' - }, - { - id: 13, - name: '林志华', - position: '销售专员', - phone: '135****0123', - todayPerformance: 13000, - monthlyPerformance: 105000, - conversionRate: 5.5, - callCount: 32, - newClients: 2, - deals: 1, - status: 'average', - joinDate: '2022-08-15' - }, - { - id: 14, - name: '郑小芳', - position: '销售专员', - phone: '134****4567', - todayPerformance: 14000, - monthlyPerformance: 115000, - conversionRate: 5.9, - callCount: 34, - newClients: 3, - deals: 1, - status: 'good', - joinDate: '2021-12-05' - }, - { - id: 15, - name: '何建明', - position: '销售专员', - phone: '133****8901', - todayPerformance: 12000, - monthlyPerformance: 98000, - conversionRate: 5.2, - callCount: 30, - newClients: 2, - deals: 0, - status: 'attention', - joinDate: '2022-09-20' - }, - { - id: 16, - name: '谢雅琳', - position: '销售专员', - phone: '132****2345', - todayPerformance: 15000, - monthlyPerformance: 122000, - conversionRate: 6.1, - callCount: 37, - newClients: 4, - deals: 1, - status: 'good', - joinDate: '2021-07-18' - }, - { - id: 17, - name: '罗志勇', - position: '销售专员', - phone: '131****6789', - todayPerformance: 13000, - monthlyPerformance: 108000, - conversionRate: 5.6, - callCount: 33, - newClients: 3, - deals: 1, - status: 'average', - joinDate: '2022-06-12' - }, - { - id: 18, - name: '蔡美华', - position: '销售专员', - phone: '130****0123', - todayPerformance: 12000, - monthlyPerformance: 102000, - conversionRate: 5.4, - callCount: 31, - newClients: 2, - deals: 1, - status: 'average', - joinDate: '2022-03-25' - } - ] - }, - { - id: 3, - name: '突破组', - leader: '王主管', - memberCount: 7, - todayPerformance: 89000, - monthlyTarget: 700000, - monthlyProgress: 45, - conversionRate: 4.2, - avgCallTime: 5.5, - newClients: 18, - deals: 6, - status: 'warning', - trend: 'down', - alerts: ['转化率偏低', '通话时长不足'], - members: [ - { - id: 19, - name: '徐志强', - position: '销售专员', - phone: '138****7890', - todayPerformance: 15000, - monthlyPerformance: 118000, - conversionRate: 5.2, - callCount: 28, - newClients: 3, - deals: 1, - status: 'average', - joinDate: '2022-01-20' - }, - { - id: 20, - name: '袁美丽', - position: '销售专员', - phone: '139****1234', - todayPerformance: 13000, - monthlyPerformance: 95000, - conversionRate: 4.8, - callCount: 25, - newClients: 2, - deals: 1, - status: 'attention', - joinDate: '2022-05-08' - }, - { - id: 21, - name: '冯建华', - position: '销售专员', - phone: '137****5678', - todayPerformance: 12000, - monthlyPerformance: 88000, - conversionRate: 4.2, - callCount: 22, - newClients: 2, - deals: 0, - status: 'attention', - joinDate: '2022-08-30' - }, - { - id: 22, - name: '邓小芳', - position: '销售专员', - phone: '136****9012', - todayPerformance: 11000, - monthlyPerformance: 82000, - conversionRate: 3.9, - callCount: 20, - newClients: 2, - deals: 1, - status: 'attention', - joinDate: '2022-09-15' - }, - { - id: 23, - name: '韩志明', - position: '销售专员', - phone: '135****3456', - todayPerformance: 14000, - monthlyPerformance: 105000, - conversionRate: 4.6, - callCount: 26, - newClients: 3, - deals: 1, - status: 'average', - joinDate: '2021-11-22' - }, - { - id: 24, - name: '曾雅琴', - position: '销售专员', - phone: '134****7890', - todayPerformance: 12000, - monthlyPerformance: 92000, - conversionRate: 4.1, - callCount: 23, - newClients: 2, - deals: 1, - status: 'attention', - joinDate: '2022-04-10' - }, - { - id: 25, - name: '彭建国', - position: '销售专员', - phone: '133****1234', - todayPerformance: 12000, - monthlyPerformance: 90000, - conversionRate: 4.0, - callCount: 21, - newClients: 2, - deals: 1, - status: 'attention', - joinDate: '2022-07-05' - } - ] - }, - { - id: 4, - name: '新星组', - leader: '赵主管', - memberCount: 6, - todayPerformance: 67000, - monthlyTarget: 600000, - monthlyProgress: 38, - conversionRate: 3.8, - avgCallTime: 4.9, - newClients: 15, - deals: 4, - status: 'attention', - trend: 'stable', - alerts: ['新人培训需加强', '客户跟进不及时'], - members: [ - { - id: 26, - name: '廖志华', - position: '销售专员', - phone: '138****5678', - todayPerformance: 12000, - monthlyPerformance: 85000, - conversionRate: 4.2, - callCount: 18, - newClients: 3, - deals: 1, - status: 'attention', - joinDate: '2022-10-15' - }, - { - id: 27, - name: '范美玲', - position: '销售专员', - phone: '139****9012', - todayPerformance: 11000, - monthlyPerformance: 78000, - conversionRate: 3.8, - callCount: 16, - newClients: 2, - deals: 0, - status: 'attention', - joinDate: '2022-11-20' - }, - { - id: 28, - name: '方建明', - position: '销售专员', - phone: '137****3456', - todayPerformance: 10000, - monthlyPerformance: 72000, - conversionRate: 3.5, - callCount: 15, - newClients: 2, - deals: 1, - status: 'poor', - joinDate: '2022-12-08' - }, - { - id: 29, - name: '石雅芳', - position: '销售专员', - phone: '136****7890', - todayPerformance: 11000, - monthlyPerformance: 80000, - conversionRate: 3.9, - callCount: 17, - newClients: 3, - deals: 1, - status: 'attention', - joinDate: '2022-09-28' - }, - { - id: 30, - name: '姚志勇', - position: '销售专员', - phone: '135****1234', - todayPerformance: 12000, - monthlyPerformance: 88000, - conversionRate: 4.0, - callCount: 19, - newClients: 3, - deals: 1, - status: 'attention', - joinDate: '2022-08-12' - }, - { - id: 31, - name: '汤美华', - position: '销售专员', - phone: '134****5678', - todayPerformance: 11000, - monthlyPerformance: 82000, - conversionRate: 3.7, - callCount: 16, - newClients: 2, - deals: 0, - status: 'attention', - joinDate: '2022-10-30' - } - ] - } -] - +const groups=[] // 当前选中的组别,默认为第一个 const selectedGroup = ref(groups[0]) // 选择组别函数 const selectGroup = (group) => { selectedGroup.value = group + // 获取部门名称并调用团队业绩详情接口 + // 从teamRanking数据中查找对应的原始部门名称 + let department = group.name + if (teamRanking.value && teamRanking.value.formal_plural) { + // 在formal_plural中查找匹配的部门名称 + const departmentKeys = Object.keys(teamRanking.value.formal_plural) + const matchedDepartment = departmentKeys.find(key => { + // 提取部门名称的主要部分进行匹配 + const mainName = key.split('-')[0] || key + return group.name.includes(mainName) || mainName.includes(group.name) + }) + if (matchedDepartment) { + department = matchedDepartment + } + } + console.log('选中的部门:', group.name, '-> 发送的部门名称:', department) + fetchTeamPerformanceDetail(department) } // 格式化货币