Przeglądaj źródła

fix同比环比数据计算的bug。

scholar 1 rok temu
rodzic
commit
449d1191ff

+ 7 - 7
src/views/crm/statistics/performance/components/ContractCountPerformance.vue

@@ -57,13 +57,13 @@ const echartsOption = reactive<EChartsOption>({
       data: []
     },
     {
-      name: '比增长率(%)',
+      name: '比增长率(%)',
       type: 'line',
       yAxisIndex: 1,
       data: []
     },
     {
-      name: '比增长率(%)',
+      name: '比增长率(%)',
       type: 'line',
       yAxisIndex: 1,
       data: []
@@ -166,7 +166,7 @@ const loadData = async () => {
       (s: StatisticsPerformanceRespVO) => s.lastMonthCount
     )
     echartsOption.series[3]['data'] = performanceList.map(
-      (s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? (s.currentMonthCount / s.lastMonthCount*100).toFixed(2) : 'NULL'
+      (s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? ((s.currentMonthCount - s.lastMonthCount) / s.lastMonthCount*100).toFixed(2) : 'NULL'
     )
   }
   if (echartsOption.series && echartsOption.series[2] && echartsOption.series[2]['data']) {
@@ -174,7 +174,7 @@ const loadData = async () => {
       (s: StatisticsPerformanceRespVO) => s.lastYearCount
     )
     echartsOption.series[4]['data'] = performanceList.map(
-      (s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? (s.currentMonthCount / s.lastYearCount*100).toFixed(2) : 'NULL'
+      (s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? ((s.currentMonthCount - s.lastYearCount) / s.lastYearCount*100).toFixed(2) : 'NULL'
     )
   }
 
@@ -188,7 +188,7 @@ const loadData = async () => {
 // 初始化数据
 const columnsData = reactive([]);
 const tableData = reactive([{title: '当月合同数量统计(个)'}, {title: '上月合同数量统计(个)'},
-  {title: '去年当月合同数量统计(个)'}, {title: '同比增长率(%)'}, {title: '环比增长率(%)'}])
+  {title: '去年当月合同数量统计(个)'}, {title: '环比增长率(%)'}, {title: '同比增长率(%)'}])
 
 // 定义 convertListData 方法,数据行列转置,展示每月数据
 const convertListData = () => {
@@ -202,8 +202,8 @@ const convertListData = () => {
     tableData[0]['prop' + index] = item.currentMonthCount
     tableData[1]['prop' + index] = item.lastMonthCount
     tableData[2]['prop' + index] = item.lastYearCount
-    tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
-    tableData[4]['prop' + index] = item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
+    tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? ((item.currentMonthCount - item.lastMonthCount) / item.lastMonthCount * 100).toFixed(2) : 'NULL'
+    tableData[4]['prop' + index] = item.lastYearCount !== 0 ? ((item.currentMonthCount - item.lastYearCount) / item.lastYearCount * 100).toFixed(2) : 'NULL'
   })
 }
 

+ 7 - 7
src/views/crm/statistics/performance/components/ContractPricePerformance.vue

@@ -57,13 +57,13 @@ const echartsOption = reactive<EChartsOption>({
       data: []
     },
     {
-      name: '比增长率(%)',
+      name: '比增长率(%)',
       type: 'line',
       yAxisIndex: 1,
       data: []
     },
     {
-      name: '比增长率(%)',
+      name: '比增长率(%)',
       type: 'line',
       yAxisIndex: 1,
       data: []
@@ -166,7 +166,7 @@ const loadData = async () => {
       (s: StatisticsPerformanceRespVO) => s.lastMonthCount
     )
     echartsOption.series[3]['data'] = performanceList.map(
-      (s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? (s.currentMonthCount / s.lastMonthCount*100).toFixed(2) : 'NULL'
+      (s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? ((s.currentMonthCount - s.lastMonthCount) / s.lastMonthCount*100).toFixed(2) : 'NULL'
     )
   }
   if (echartsOption.series && echartsOption.series[2] && echartsOption.series[2]['data']) {
@@ -174,7 +174,7 @@ const loadData = async () => {
       (s: StatisticsPerformanceRespVO) => s.lastYearCount
     )
     echartsOption.series[4]['data'] = performanceList.map(
-      (s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? (s.currentMonthCount / s.lastYearCount*100).toFixed(2) : 'NULL'
+      (s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? ((s.currentMonthCount - s.lastYearCount) / s.lastYearCount*100).toFixed(2) : 'NULL'
     )
   }
 
@@ -188,7 +188,7 @@ const loadData = async () => {
 // 初始化数据
 const columnsData = reactive([]);
 const tableData = reactive([{title: '当月合同金额统计(元)'}, {title: '上月合同金额统计(元)'}, {title: '去年当月合同金额统计(元)'},
-  {title: '同比增长率(%)'}, {title: '环比增长率(%)'}])
+  {title: '环比增长率(%)'}, {title: '同比增长率(%)'}])
 
 // 定义 init 方法
 const convertListData = () => {
@@ -202,8 +202,8 @@ const convertListData = () => {
     tableData[0]['prop' + index] = item.currentMonthCount
     tableData[1]['prop' + index] = item.lastMonthCount
     tableData[2]['prop' + index] = item.lastYearCount
-    tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
-    tableData[4]['prop' + index] = item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
+    tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? ((item.currentMonthCount - item.lastMonthCount) / item.lastMonthCount*100).toFixed(2) : 'NULL'
+    tableData[4]['prop' + index] = item.lastYearCount !== 0 ? ((item.currentMonthCount - item.lastYearCount) / item.lastYearCount*100).toFixed(2) : 'NULL'
   })
 }
 

+ 7 - 7
src/views/crm/statistics/performance/components/ReceivablePricePerformance.vue

@@ -57,13 +57,13 @@ const echartsOption = reactive<EChartsOption>({
       data: []
     },
     {
-      name: '比增长率(%)',
+      name: '比增长率(%)',
       type: 'line',
       yAxisIndex: 1,
       data: []
     },
     {
-      name: '比增长率(%)',
+      name: '比增长率(%)',
       type: 'line',
       yAxisIndex: 1,
       data: []
@@ -166,7 +166,7 @@ const loadData = async () => {
       (s: StatisticsPerformanceRespVO) => s.lastMonthCount
     )
     echartsOption.series[3]['data'] = performanceList.map(
-      (s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? (s.currentMonthCount / s.lastMonthCount*100).toFixed(2) : 'NULL'
+      (s: StatisticsPerformanceRespVO) => s.lastMonthCount !== 0 ? ((s.currentMonthCount - s.lastMonthCount) / s.lastMonthCount*100).toFixed(2) : 'NULL'
     )
   }
   if (echartsOption.series && echartsOption.series[2] && echartsOption.series[1]['data']) {
@@ -174,7 +174,7 @@ const loadData = async () => {
       (s: StatisticsPerformanceRespVO) => s.lastYearCount
     )
     echartsOption.series[4]['data'] = performanceList.map(
-      (s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? (s.currentMonthCount / s.lastYearCount*100).toFixed(2) : 'NULL'
+      (s: StatisticsPerformanceRespVO) => s.lastYearCount !== 0 ? ((s.currentMonthCount - s.lastYearCount) / s.lastYearCount*100).toFixed(2) : 'NULL'
     )
   }
 
@@ -188,7 +188,7 @@ const loadData = async () => {
 // 初始化数据
 const columnsData = reactive([]);
 const tableData = reactive([{title: '当月回款金额统计(元)'}, {title: '上月回款金额统计(元)'},
-  {title: '去年当月回款金额统计(元)'}, {title: '同比增长率(%)'}, {title: '环比增长率(%)'}]);
+  {title: '去年当月回款金额统计(元)'}, {title: '环比增长率(%)'}, {title: '同比增长率(%)'}]);
 
 // 定义 init 方法
 const convertListData = () => {
@@ -202,8 +202,8 @@ const convertListData = () => {
     tableData[0]['prop' + index] = item.currentMonthCount
     tableData[1]['prop' + index] = item.lastMonthCount
     tableData[2]['prop' + index] = item.lastYearCount
-    tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? (item.currentMonthCount / item.lastMonthCount).toFixed(2) : 'NULL'
-    tableData[4]['prop' + index] = item.lastYearCount !== 0 ? (item.currentMonthCount / item.lastYearCount).toFixed(2) : 'NULL'
+    tableData[3]['prop' + index] = item.lastMonthCount !== 0 ? ((item.currentMonthCount - item.lastMonthCount) / item.lastMonthCount*100).toFixed(2) : 'NULL'
+    tableData[4]['prop' + index] = item.lastYearCount !== 0 ? ((item.currentMonthCount - item.lastYearCount) / item.lastYearCount*100).toFixed(2) : 'NULL'
   })
 }