feat(统计模式): 添加按月/按期统计切换功能并优化客户阶段显示
- 在CenterOverview组件中添加统计模式切换按钮 - 实现统计模式切换逻辑并触发数据重新加载 - 优化SalesTimelineWithTaskList的客户阶段显示和计算逻辑 - 更新API调用参数以支持不同统计模式 - 调整样式和布局以适应新功能
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
<!-- Top Section - Center Overview and Action Items -->
|
||||
<div class="top-section">
|
||||
<!-- Center Performance Overview -->
|
||||
<CenterOverview :overall-data="overallCenterPerformance" />
|
||||
<CenterOverview :overall-data="overallCenterPerformance" @update-check-type="updateCheckType" />
|
||||
|
||||
<!-- Action Items (Compact) -->
|
||||
<div class="action-items-compact">
|
||||
@@ -181,6 +181,7 @@
|
||||
const router = useRouter();
|
||||
// 用户store实例
|
||||
const userStore = useUserStore();
|
||||
const CheckType = ref('month')
|
||||
// 营期调控逻辑
|
||||
// This would ideally come from a prop or API call based on the logged-in user
|
||||
const centerData = ref({
|
||||
@@ -417,7 +418,10 @@ const centerData = ref({
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const res = await getOverallCenterPerformance(hasParams ? params : undefined)
|
||||
const res = await getOverallCenterPerformance(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
if (res.code === 200) {
|
||||
overallCenterPerformance.value.CenterPerformance = res.data
|
||||
}
|
||||
@@ -430,7 +434,10 @@ const centerData = ref({
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const res = await getTotalGroupCount(hasParams ? params : undefined)
|
||||
const res = await getTotalGroupCount(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
if (res.code === 200) {
|
||||
overallCenterPerformance.value.TotalGroupCount = res.data
|
||||
}
|
||||
@@ -443,7 +450,10 @@ const centerData = ref({
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const res = await getCenterConversionRate(hasParams ? params : undefined)
|
||||
const res = await getCenterConversionRate(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
if (res.code === 200) {
|
||||
overallCenterPerformance.value.CenterConversionRate = res.data
|
||||
}
|
||||
@@ -456,7 +466,10 @@ const centerData = ref({
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const res = await getTotalCallCount(hasParams ? params : undefined)
|
||||
const res = await getTotalCallCount(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
if (res.code === 200) {
|
||||
overallCenterPerformance.value.TotalCallCount = res.data
|
||||
}
|
||||
@@ -469,7 +482,10 @@ const centerData = ref({
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const res = await getNewCustomer(hasParams ? params : undefined)
|
||||
const res = await getNewCustomer(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
if (res.code === 200) {
|
||||
overallCenterPerformance.value.NewCustomer = res.data
|
||||
}
|
||||
@@ -482,7 +498,10 @@ const centerData = ref({
|
||||
const params = getRequestParams()
|
||||
const hasParams = params.user_name
|
||||
try {
|
||||
const res = await getDepositConversionRate(hasParams ? params : undefined)
|
||||
const res = await getDepositConversionRate(hasParams ? {
|
||||
...params,
|
||||
check_type: CheckType.value
|
||||
} : {check_type: CheckType.value})
|
||||
if (res.code === 200) {
|
||||
overallCenterPerformance.value.DepositConversionRate = res.data
|
||||
}
|
||||
@@ -773,6 +792,27 @@ const conversionRateVsAverage = ref({})
|
||||
}
|
||||
})
|
||||
|
||||
// 更新CheckType并重新获取数据
|
||||
const updateCheckType = async (newValue) => {
|
||||
CheckType.value = newValue
|
||||
console.log('CheckType已更新为:', newValue)
|
||||
|
||||
// 重新调用相关API函数
|
||||
isLoading.value = true
|
||||
try {
|
||||
await CenterOverallCenterPerformance()
|
||||
await CenterTotalGroupCount()
|
||||
await CenterConversionRate()
|
||||
await CenterTotalCallCount()
|
||||
await CenterNewCustomer()
|
||||
await CenterDepositConversionRate()
|
||||
} catch (error) {
|
||||
console.error('重新获取数据失败:', error)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 工具提示状态
|
||||
const tooltip = reactive({
|
||||
visible: false,
|
||||
|
||||
Reference in New Issue
Block a user