优化代码实现。

This commit is contained in:
scholar 2024-05-11 11:26:47 +08:00
parent 449d1191ff
commit f01dc0a539

View File

@ -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))), // 20242024-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) //20242024-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':