Skip to content

Commit 449d119

Browse files
committed
fix同比环比数据计算的bug。
1 parent f4dd1be commit 449d119

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/views/crm/statistics/performance/components/ContractCountPerformance.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ const echartsOption = reactive<EChartsOption>({
5757
data: []
5858
},
5959
{
60-
name: '同比增长率(%)',
60+
name: '环比增长率(%)',
6161
type: 'line',
6262
yAxisIndex: 1,
6363
data: []
6464
},
6565
{
66-
name: '环比增长率(%)',
66+
name: '同比增长率(%)',
6767
type: 'line',
6868
yAxisIndex: 1,
6969
data: []
@@ -166,15 +166,15 @@ const loadData = async () => {
166166
(s: StatisticsPerformanceRespVO) => s.lastMonthCount
167167
)
168168
echartsOption.series[3]['data'] = performanceList.map(
169-
(s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? (s.currentMonthCount / s.lastMonthCount*100).toFixed(2) : 'NULL'
169+
(s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? ((s.currentMonthCount - s.lastMonthCount) / s.lastMonthCount*100).toFixed(2) : 'NULL'
170170
)
171171
}
172172
if (echartsOption.series && echartsOption.series[2] && echartsOption.series[2]['data']) {
173173
echartsOption.series[2]['data'] = performanceList.map(
174174
(s: StatisticsPerformanceRespVO) => s.lastYearCount
175175
)
176176
echartsOption.series[4]['data'] = performanceList.map(
177-
(s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? (s.currentMonthCount / s.lastYearCount*100).toFixed(2) : 'NULL'
177+
(s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? ((s.currentMonthCount - s.lastYearCount) / s.lastYearCount*100).toFixed(2) : 'NULL'
178178
)
179179
}
180180
@@ -188,7 +188,7 @@ const loadData = async () => {
188188
// 初始化数据
189189
const columnsData = reactive([]);
190190
const tableData = reactive([{title: '当月合同数量统计(个)'}, {title: '上月合同数量统计(个)'},
191-
{title: '去年当月合同数量统计(个)'}, {title: '同比增长率(%)'}, {title: '环比增长率(%)'}])
191+
{title: '去年当月合同数量统计(个)'}, {title: '环比增长率(%)'}, {title: '同比增长率(%)'}])
192192
193193
// 定义 convertListData 方法,数据行列转置,展示每月数据
194194
const convertListData = () => {
@@ -202,8 +202,8 @@ const convertListData = () => {
202202
tableData[0]['prop' + index] = item.currentMonthCount
203203
tableData[1]['prop' + index] = item.lastMonthCount
204204
tableData[2]['prop' + index] = item.lastYearCount
205-
tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
206-
tableData[4]['prop' + index] = item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
205+
tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? ((item.currentMonthCount - item.lastMonthCount) / item.lastMonthCount * 100).toFixed(2) : 'NULL'
206+
tableData[4]['prop' + index] = item.lastYearCount !== 0 ? ((item.currentMonthCount - item.lastYearCount) / item.lastYearCount * 100).toFixed(2) : 'NULL'
207207
})
208208
}
209209

src/views/crm/statistics/performance/components/ContractPricePerformance.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ const echartsOption = reactive<EChartsOption>({
5757
data: []
5858
},
5959
{
60-
name: '同比增长率(%)',
60+
name: '环比增长率(%)',
6161
type: 'line',
6262
yAxisIndex: 1,
6363
data: []
6464
},
6565
{
66-
name: '环比增长率(%)',
66+
name: '同比增长率(%)',
6767
type: 'line',
6868
yAxisIndex: 1,
6969
data: []
@@ -166,15 +166,15 @@ const loadData = async () => {
166166
(s: StatisticsPerformanceRespVO) => s.lastMonthCount
167167
)
168168
echartsOption.series[3]['data'] = performanceList.map(
169-
(s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? (s.currentMonthCount / s.lastMonthCount*100).toFixed(2) : 'NULL'
169+
(s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? ((s.currentMonthCount - s.lastMonthCount) / s.lastMonthCount*100).toFixed(2) : 'NULL'
170170
)
171171
}
172172
if (echartsOption.series && echartsOption.series[2] && echartsOption.series[2]['data']) {
173173
echartsOption.series[2]['data'] = performanceList.map(
174174
(s: StatisticsPerformanceRespVO) => s.lastYearCount
175175
)
176176
echartsOption.series[4]['data'] = performanceList.map(
177-
(s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? (s.currentMonthCount / s.lastYearCount*100).toFixed(2) : 'NULL'
177+
(s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? ((s.currentMonthCount - s.lastYearCount) / s.lastYearCount*100).toFixed(2) : 'NULL'
178178
)
179179
}
180180
@@ -188,7 +188,7 @@ const loadData = async () => {
188188
// 初始化数据
189189
const columnsData = reactive([]);
190190
const tableData = reactive([{title: '当月合同金额统计(元)'}, {title: '上月合同金额统计(元)'}, {title: '去年当月合同金额统计(元)'},
191-
{title: '同比增长率(%)'}, {title: '环比增长率(%)'}])
191+
{title: '环比增长率(%)'}, {title: '同比增长率(%)'}])
192192
193193
// 定义 init 方法
194194
const convertListData = () => {
@@ -202,8 +202,8 @@ const convertListData = () => {
202202
tableData[0]['prop' + index] = item.currentMonthCount
203203
tableData[1]['prop' + index] = item.lastMonthCount
204204
tableData[2]['prop' + index] = item.lastYearCount
205-
tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
206-
tableData[4]['prop' + index] = item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
205+
tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? ((item.currentMonthCount - item.lastMonthCount) / item.lastMonthCount*100).toFixed(2) : 'NULL'
206+
tableData[4]['prop' + index] = item.lastYearCount !== 0 ? ((item.currentMonthCount - item.lastYearCount) / item.lastYearCount*100).toFixed(2) : 'NULL'
207207
})
208208
}
209209

src/views/crm/statistics/performance/components/ReceivablePricePerformance.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ const echartsOption = reactive<EChartsOption>({
5757
data: []
5858
},
5959
{
60-
name: '同比增长率(%)',
60+
name: '环比增长率(%)',
6161
type: 'line',
6262
yAxisIndex: 1,
6363
data: []
6464
},
6565
{
66-
name: '环比增长率(%)',
66+
name: '同比增长率(%)',
6767
type: 'line',
6868
yAxisIndex: 1,
6969
data: []
@@ -166,15 +166,15 @@ const loadData = async () => {
166166
(s: StatisticsPerformanceRespVO) => s.lastMonthCount
167167
)
168168
echartsOption.series[3]['data'] = performanceList.map(
169-
(s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? (s.currentMonthCount / s.lastMonthCount*100).toFixed(2) : 'NULL'
169+
(s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? ((s.currentMonthCount - s.lastMonthCount) / s.lastMonthCount*100).toFixed(2) : 'NULL'
170170
)
171171
}
172172
if (echartsOption.series && echartsOption.series[2] && echartsOption.series[1]['data']) {
173173
echartsOption.series[2]['data'] = performanceList.map(
174174
(s: StatisticsPerformanceRespVO) => s.lastYearCount
175175
)
176176
echartsOption.series[4]['data'] = performanceList.map(
177-
(s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? (s.currentMonthCount / s.lastYearCount*100).toFixed(2) : 'NULL'
177+
(s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? ((s.currentMonthCount - s.lastYearCount) / s.lastYearCount*100).toFixed(2) : 'NULL'
178178
)
179179
}
180180
@@ -188,7 +188,7 @@ const loadData = async () => {
188188
// 初始化数据
189189
const columnsData = reactive([]);
190190
const tableData = reactive([{title: '当月回款金额统计(元)'}, {title: '上月回款金额统计(元)'},
191-
{title: '去年当月回款金额统计(元)'}, {title: '同比增长率(%)'}, {title: '环比增长率(%)'}]);
191+
{title: '去年当月回款金额统计(元)'}, {title: '环比增长率(%)'}, {title: '同比增长率(%)'}]);
192192
193193
// 定义 init 方法
194194
const convertListData = () => {
@@ -202,8 +202,8 @@ const convertListData = () => {
202202
tableData[0]['prop' + index] = item.currentMonthCount
203203
tableData[1]['prop' + index] = item.lastMonthCount
204204
tableData[2]['prop' + index] = item.lastYearCount
205-
tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
206-
tableData[4]['prop' + index] = item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
205+
tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? ((item.currentMonthCount - item.lastMonthCount) / item.lastMonthCount*100).toFixed(2) : 'NULL'
206+
tableData[4]['prop' + index] = item.lastYearCount !== 0 ? ((item.currentMonthCount - item.lastYearCount) / item.lastYearCount*100).toFixed(2) : 'NULL'
207207
})
208208
}
209209

0 commit comments

Comments
 (0)