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

pull/438/head
scholar 2024-05-04 22:28:37 +08:00
parent f4dd1bed63
commit 449d1191ff
3 changed files with 21 additions and 21 deletions

View File

@ -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'
})
}

View File

@ -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'
})
}

View File

@ -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'
})
}