Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 01d86a8f
authored
Jan 26, 2026
by
Lin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 日期切换防抖处理
1 parent
00d6172c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
src/views/earlyWarningManager/strategyCentre/compoments/clendarCustom.vue
src/views/earlyWarningManager/strategyCentre/compoments/clendarCustom.vue
View file @
01d86a8
...
...
@@ -41,6 +41,8 @@
</
template
>
<
script
>
import
util
from
'@/libs/util'
// 日期工具方法
const
DateUtils
=
{
// 格式化日期为 YYYY-MM-DD
...
...
@@ -390,12 +392,22 @@ export default {
deep
:
true
}
},
created
()
{
// 创建防抖版本的 notifyDateRangeChange
this
.
debouncedNotifyDateRangeChange
=
util
.
debounce
(
this
.
notifyDateRangeChange
,
300
);
},
mounted
()
{
// 初始化日期范围
if
(
!
this
.
internalDateRange
.
startDate
||
!
this
.
internalDateRange
.
endDate
)
{
this
.
initDateRange
();
}
},
beforeDestroy
()
{
// 组件销毁时取消防抖函数的延迟执行
if
(
this
.
debouncedNotifyDateRangeChange
&&
typeof
this
.
debouncedNotifyDateRangeChange
.
cancel
===
'function'
)
{
this
.
debouncedNotifyDateRangeChange
.
cancel
();
}
},
methods
:
{
// 处理时间范围类型切换
handleTimeRangeChange
(
type
)
{
...
...
@@ -452,7 +464,7 @@ export default {
const
now
=
new
Date
();
const
range
=
this
.
currentStrategy
.
init
(
now
);
this
.
internalDateRange
=
range
;
this
.
n
otifyDateRangeChange
();
this
.
debouncedN
otifyDateRangeChange
();
},
// 切换日期范围(左右箭头)
...
...
@@ -470,7 +482,7 @@ export default {
if
(
newRange
)
{
this
.
internalDateRange
=
newRange
;
this
.
n
otifyDateRangeChange
();
this
.
debouncedN
otifyDateRangeChange
();
}
},
...
...
@@ -557,7 +569,7 @@ export default {
this
.
selectedStartDate
=
null
;
}
this
.
n
otifyDateRangeChange
();
this
.
debouncedN
otifyDateRangeChange
();
}
else
if
(
!
value
)
{
// 清空选择时,重置临时记录
if
(
this
.
limitHalfYear
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment