Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f01dc0a5
authored
May 11, 2024
by
scholar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码实现。
parent
449d1191
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
src/views/crm/statistics/performance/index.vue
+8
-7
No files found.
src/views/crm/statistics/performance/index.vue
View file @
f01dc0a5
...
...
@@ -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
().
get
Time
()
-
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
().
get
FullYear
()
+
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'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment