From 449d1191ff8212555fc9851ac9611f1da5d1b1d4 Mon Sep 17 00:00:00 2001 From: scholar <1145227973@qq.com> Date: Sat, 4 May 2024 22:28:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=E5=90=8C=E6=AF=94=E7=8E=AF=E6=AF=94?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=AE=A1=E7=AE=97=E7=9A=84bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ContractCountPerformance.vue | 14 +++++++------- .../components/ContractPricePerformance.vue | 14 +++++++------- .../components/ReceivablePricePerformance.vue | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/views/crm/statistics/performance/components/ContractCountPerformance.vue b/src/views/crm/statistics/performance/components/ContractCountPerformance.vue index f135caa8..5dc4d9e7 100644 --- a/src/views/crm/statistics/performance/components/ContractCountPerformance.vue +++ b/src/views/crm/statistics/performance/components/ContractCountPerformance.vue @@ -57,13 +57,13 @@ const echartsOption = reactive({ 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' }) } diff --git a/src/views/crm/statistics/performance/components/ContractPricePerformance.vue b/src/views/crm/statistics/performance/components/ContractPricePerformance.vue index 41228a22..0c33dc22 100644 --- a/src/views/crm/statistics/performance/components/ContractPricePerformance.vue +++ b/src/views/crm/statistics/performance/components/ContractPricePerformance.vue @@ -57,13 +57,13 @@ const echartsOption = reactive({ 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' }) } diff --git a/src/views/crm/statistics/performance/components/ReceivablePricePerformance.vue b/src/views/crm/statistics/performance/components/ReceivablePricePerformance.vue index 1efcf920..aa3f5b19 100644 --- a/src/views/crm/statistics/performance/components/ReceivablePricePerformance.vue +++ b/src/views/crm/statistics/performance/components/ReceivablePricePerformance.vue @@ -57,13 +57,13 @@ const echartsOption = reactive({ 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' }) } From f01dc0a539d7e52229bd64b5ac5b9afef86a308a Mon Sep 17 00:00:00 2001 From: scholar <1145227973@qq.com> Date: Sat, 11 May 2024 11:26:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/crm/statistics/performance/index.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/views/crm/statistics/performance/index.vue b/src/views/crm/statistics/performance/index.vue index ea43ed4d..469569af 100644 --- a/src/views/crm/statistics/performance/index.vue +++ b/src/views/crm/statistics/performance/index.vue @@ -75,6 +75,7 @@ import { defaultProps, handleTree } from '@/utils/tree' import ContractCountPerformance from './components/ContractCountPerformance.vue' import ContractPricePerformance from './components/ContractPricePerformance.vue' import ReceivablePricePerformance from './components/ReceivablePricePerformance.vue' +import dayjs from "dayjs" defineOptions({ name: 'CrmStatisticsCustomer' }) @@ -82,8 +83,8 @@ const queryParams = reactive({ deptId: useUserStore().getUser.deptId, userId: undefined, times: [ - // 默认显示当年的数据 - formatDate(beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7))) + formatDate(beginOfDay(new Date(new Date().getFullYear(),0, 1, 0, 0, 0))), // 默认查询当年的数据,比如2024年,起始时间2024-01-01 00:00:00 + formatDate(beginOfDay(new Date(new Date().getFullYear()+1,0, 1, 0, 0, 0))) //查询时间范围结束时间,2025-01-01 00:00:00 ] }) @@ -111,13 +112,13 @@ const handleQuery = () => { // 从 queryParams.times[0] 中获取到了年份 const selectYear = parseInt(queryParams.times[0]) - // 创建一个新的 Date 对象,设置为指定的年份的第一天 - const fullDate = new Date(selectYear, 0, 1, 0, 0, 0) + // 创建一个新的 Date 对象,设置为指定的年份的第一天,以及第二年的第一天,以时间段的方式,将查询时间传递给后端 + const fullDate = new Date(selectYear, 0, 1, 0, 0, 0) //比如2024年,起始时间2024-01-01 00:00:00 + const nextFullDate = new Date(selectYear+1, 0, 1, 0, 0, 0) //查询时间范围结束时间,2025-01-01 00:00:00 // 将完整的日期时间格式化为需要的字符串形式,比如 2004-01-01 00:00:00 - queryParams.times[0] = `${fullDate.getFullYear()}-${ - String(fullDate.getMonth() + 1).padStart(2, '0') - }-${String(fullDate.getDate()).padStart(2, '0')} ${String(fullDate.getHours()).padStart(2, '0')}:${String(fullDate.getMinutes()).padStart(2, '0')}:${String(fullDate.getSeconds()).padStart(2, '0')}` + queryParams.times[0] = dayjs(fullDate).format('YYYY-MM-DD HH:mm:ss') + queryParams.times[1] = dayjs(nextFullDate).format('YYYY-MM-DD HH:mm:ss') switch (activeTab.value) { case 'ContractCountPerformance':