Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
41e8830d
提交
41e8830d
authored
1月 10, 2022
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 动态日期过滤组件月份逻辑
上级
05b3773f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
77 行增加
和
52 行删除
+77
-52
TimeDateRangeServiceImpl.js
...components/widget/serviceImpl/TimeDateRangeServiceImpl.js
+2
-10
TimeDateServiceImpl.js
.../src/components/widget/serviceImpl/TimeDateServiceImpl.js
+11
-11
DeDateDefault.vue
...end/src/views/panel/filter/defaultValue/DeDateDefault.vue
+59
-25
DeDateRangeDefault.vue
...rc/views/panel/filter/defaultValue/DeDateRangeDefault.vue
+5
-6
没有找到文件。
frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js
浏览文件 @
41e8830d
...
@@ -159,18 +159,10 @@ class TimeDateRangeServiceImpl extends WidgetService {
...
@@ -159,18 +159,10 @@ class TimeDateRangeServiceImpl extends WidgetService {
const
nowYear
=
now
.
getFullYear
()
const
nowYear
=
now
.
getFullYear
()
const
nowDate
=
now
.
getDate
()
const
nowDate
=
now
.
getDate
()
const
tarYear
=
nowYear
if
(
dynamicSuffix
===
'before'
)
{
if
(
dynamicSuffix
===
'before'
)
{
const
deffMonth
=
nowMonth
-
dynamicPrefix
return
new
Date
(
nowYear
,
nowMonth
-
dynamicPrefix
,
nowDate
).
getTime
()
let
diffYear
=
deffMonth
/
12
if
(
deffMonth
<
0
)
{
diffYear
-=
1
}
return
new
Date
(
tarYear
+
diffYear
,
nowMonth
-
dynamicPrefix
%
12
,
nowDate
).
getTime
()
}
else
{
}
else
{
const
deffMonth
=
nowMonth
+
dynamicPrefix
return
new
Date
(
nowYear
,
nowMonth
+
dynamicPrefix
,
nowDate
).
getTime
()
const
diffYear
=
deffMonth
/
12
return
new
Date
(
tarYear
+
diffYear
,
deffMonth
%
12
,
nowDate
).
getTime
()
}
}
}
}
if
(
dynamicInfill
===
'year'
)
{
if
(
dynamicInfill
===
'year'
)
{
...
...
frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js
浏览文件 @
41e8830d
import
{
WidgetService
}
from
'../service/WidgetService'
import
{
WidgetService
}
from
'../service/WidgetService'
const
leftPanel
=
{
const
leftPanel
=
{
icon
:
'iconfont icon-ri'
,
icon
:
'iconfont icon-ri'
,
...
@@ -45,7 +47,9 @@ const drawPanel = {
...
@@ -45,7 +47,9 @@ const drawPanel = {
class
TimeDateServiceImpl
extends
WidgetService
{
class
TimeDateServiceImpl
extends
WidgetService
{
constructor
(
options
=
{})
{
constructor
(
options
=
{})
{
Object
.
assign
(
options
,
{
name
:
'timeDateWidget'
})
Object
.
assign
(
options
,
{
name
:
'timeDateWidget'
})
super
(
options
)
super
(
options
)
this
.
filterDialog
=
true
this
.
filterDialog
=
true
this
.
showSwitch
=
false
this
.
showSwitch
=
false
...
@@ -111,16 +115,10 @@ class TimeDateServiceImpl extends WidgetService {
...
@@ -111,16 +115,10 @@ class TimeDateServiceImpl extends WidgetService {
const
nowYear
=
now
.
getFullYear
()
const
nowYear
=
now
.
getFullYear
()
const
nowDate
=
now
.
getDate
()
const
nowDate
=
now
.
getDate
()
const
tarYear
=
nowYear
if
(
dynamicSuffix
===
'before'
)
{
if
(
dynamicSuffix
===
'before'
)
{
const
deffMonth
=
nowMonth
-
dynamicPrefix
return
new
Date
(
nowYear
,
nowMonth
-
dynamicPrefix
,
nowDate
).
getTime
()
const
diffYear
=
Math
.
floor
(
deffMonth
/
12
)
return
new
Date
(
tarYear
+
diffYear
,
nowMonth
-
dynamicPrefix
%
12
,
nowDate
).
getTime
()
}
else
{
}
else
{
const
deffMonth
=
nowMonth
+
dynamicPrefix
return
new
Date
(
nowYear
,
nowMonth
+
dynamicPrefix
,
nowDate
).
getTime
()
const
diffYear
=
deffMonth
/
12
return
new
Date
(
tarYear
+
diffYear
,
deffMonth
%
12
,
nowDate
).
getTime
()
}
}
}
}
if
(
dynamicInfill
===
'year'
)
{
if
(
dynamicInfill
===
'year'
)
{
...
@@ -134,5 +132,7 @@ class TimeDateServiceImpl extends WidgetService {
...
@@ -134,5 +132,7 @@ class TimeDateServiceImpl extends WidgetService {
}
}
}
}
}
}
const
timeDateServiceImpl
=
new
TimeDateServiceImpl
({
name
:
'timeDateWidget'
})
const
timeDateServiceImpl
=
new
TimeDateServiceImpl
({
name
:
'timeDateWidget'
})
export
default
timeDateServiceImpl
export
default
timeDateServiceImpl
frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue
浏览文件 @
41e8830d
...
@@ -11,7 +11,12 @@
...
@@ -11,7 +11,12 @@
<el-form-item
v-if=
"element.options.attrs.default.isDynamic"
:label=
"$t('dynamic_time.relative')"
>
<el-form-item
v-if=
"element.options.attrs.default.isDynamic"
:label=
"$t('dynamic_time.relative')"
>
<el-select
v-model=
"element.options.attrs.default.dkey"
placeholder=
""
class=
"relative-time"
@
change=
"dkeyChange"
>
<el-select
v-model=
"element.options.attrs.default.dkey"
placeholder=
""
class=
"relative-time"
@
change=
"dkeyChange"
>
<el-option
:label=
"$t('dynamic_time.today')"
:value=
"0"
/>
<el-option
:label=
"$t('dynamic_time.today')"
:value=
"0"
/>
<el-option
:label=
"$t('dynamic_time.yesterday')"
:value=
"1"
/>
<el-option
:label=
"$t('dynamic_time.yesterday')"
:value=
"1"
/>
<el-option
:label=
"$t('dynamic_time.firstOfMonth')"
:value=
"2"
/>
<el-option
:label=
"$t('dynamic_time.firstOfMonth')"
:value=
"2"
/>
...
@@ -22,12 +27,31 @@
...
@@ -22,12 +27,31 @@
<div
class=
"inline"
>
<div
class=
"inline"
>
<el-form-item
v-if=
"element.options.attrs.default.isDynamic && element.options.attrs.default.dkey === 3"
label=
""
>
<el-form-item
<el-input
v-model=
"element.options.attrs.default.dynamicPrefix"
type=
"number"
size=
"mini"
:min=
"1"
:max=
"12"
@
input=
"dynamicPrefixChange"
/>
v-if=
"element.options.attrs.default.isDynamic && element.options.attrs.default.dkey === 3"
label=
""
>
<el-input
v-model=
"element.options.attrs.default.dynamicPrefix"
type=
"number"
size=
"mini"
:min=
"1"
:max=
"12"
@
input=
"dynamicPrefixChange"
/>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"element.options.attrs.default.isDynamic && element.options.attrs.default.dkey === 3"
label=
""
class=
"no-label-item"
>
<el-form-item
<el-select
v-model=
"element.options.attrs.default.dynamicInfill"
size=
"mini"
placeholder=
""
@
change=
"dynamicInfillChange"
>
v-if=
"element.options.attrs.default.isDynamic && element.options.attrs.default.dkey === 3"
label=
""
class=
"no-label-item"
>
<el-select
v-model=
"element.options.attrs.default.dynamicInfill"
size=
"mini"
placeholder=
""
@
change=
"dynamicInfillChange"
>
<el-option
:label=
"$t('dynamic_time.date')"
value=
"day"
/>
<el-option
:label=
"$t('dynamic_time.date')"
value=
"day"
/>
<el-option
:label=
"$t('dynamic_time.week')"
value=
"week"
/>
<el-option
:label=
"$t('dynamic_time.week')"
value=
"week"
/>
<el-option
:label=
"$t('dynamic_time.month')"
value=
"month"
/>
<el-option
:label=
"$t('dynamic_time.month')"
value=
"month"
/>
...
@@ -35,9 +59,18 @@
...
@@ -35,9 +59,18 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
v-if=
"element.options.attrs.default.isDynamic && element.options.attrs.default.dkey === 3"
label=
""
class=
"no-label-item"
>
<el-form-item
v-if=
"element.options.attrs.default.isDynamic && element.options.attrs.default.dkey === 3"
<el-select
v-model=
"element.options.attrs.default.dynamicSuffix"
size=
"mini"
placeholder=
""
@
change=
"dynamicSuffixChange"
>
label=
""
class=
"no-label-item"
>
<el-select
v-model=
"element.options.attrs.default.dynamicSuffix"
size=
"mini"
placeholder=
""
@
change=
"dynamicSuffixChange"
>
<el-option
:label=
"$t('dynamic_time.before')"
value=
"before"
/>
<el-option
:label=
"$t('dynamic_time.before')"
value=
"before"
/>
<el-option
:label=
"$t('dynamic_time.after')"
value=
"after"
/>
<el-option
:label=
"$t('dynamic_time.after')"
value=
"after"
/>
</el-select>
</el-select>
...
@@ -46,13 +79,7 @@
...
@@ -46,13 +79,7 @@
</div>
</div>
<el-form-item
v-if=
"element.options.attrs.default.isDynamic"
:label=
"$t('dynamic_time.preview')"
>
<el-form-item
v-if=
"element.options.attrs.default.isDynamic"
:label=
"$t('dynamic_time.preview')"
>
<el-date-picker
<el-date-picker
v-model=
"dval"
type=
"date"
disabled
placeholder=
""
class=
"relative-time"
/>
v-model=
"dval"
type=
"date"
disabled
placeholder=
""
class=
"relative-time"
/>
</el-form-item>
</el-form-item>
<el-form-item
v-else
:label=
"$t('dynamic_time.set')"
>
<el-form-item
v-else
:label=
"$t('dynamic_time.set')"
>
...
@@ -71,7 +98,9 @@
...
@@ -71,7 +98,9 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
ApplicationContext
}
from
'@/utils/ApplicationContext'
import
{
ApplicationContext
}
from
'@/utils/ApplicationContext'
export
default
{
export
default
{
name
:
'DeDateDefault'
,
name
:
'DeDateDefault'
,
props
:
{
props
:
{
...
@@ -117,22 +146,27 @@ export default {
...
@@ -117,22 +146,27 @@ export default {
}
}
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.inline
{
.inline
{
display
:
flex
;
display
:
flex
;
>>>
.el-input--mini
{
min-width
:
70px
;
}
}
}
.inline
{
.inline
{
.el-form-item
{
.el-form-item
{
margin-bottom
:
5px
!
important
;
margin-bottom
:
5px
!
important
;
.el-form-item__content
>
.el-input--mini
{
min-width
:
70px
;
}
}
}
}
}
.relative-time
{
width
:
100%
;
.relative-time
{
}
width
:
100%
!
important
;
}
</
style
>
</
style
>
frontend/src/views/panel/filter/defaultValue/DeDateRangeDefault.vue
浏览文件 @
41e8830d
...
@@ -223,21 +223,20 @@ export default {
...
@@ -223,21 +223,20 @@ export default {
.inline-first
,
.inline-first
,
.inline
{
.inline
{
display
:
flex
;
display
:
flex
;
>>>
.el-input--mini
{
min-width
:
70px
;
}
}
}
.inline-first
{
.inline-first
{
.el-form-item
{
.el-form-item
{
margin-bottom
:
5px
!
important
;
margin-bottom
:
5px
!
important
;
.el-form-item__content
>
.el-input--mini
{
min-width
:
70px
;
}
}
}
}
}
.relative-time
{
.relative-time
{
width
:
100%
;
width
:
100%
!
important
;
}
}
</
style
>
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论