Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
ddfd3928
提交
ddfd3928
authored
1月 27, 2022
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 仪表板过滤组件首次加载失效
上级
0b4581fd
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
395 行增加
和
18 行删除
+395
-18
ComponentWrapper.vue
.../components/canvas/components/Editor/ComponentWrapper.vue
+5
-0
Preview.vue
frontend/src/components/canvas/components/Editor/Preview.vue
+7
-2
index.vue
frontend/src/components/canvas/components/Editor/index.vue
+7
-2
UserView.vue
frontend/src/components/canvas/custom-component/UserView.vue
+18
-9
NumberRangeServiceImpl.js
...c/components/widget/serviceImpl/NumberRangeServiceImpl.js
+33
-0
NumberSelectGridServiceImpl.js
...ponents/widget/serviceImpl/NumberSelectGridServiceImpl.js
+9
-0
NumberSelectServiceImpl.js
.../components/widget/serviceImpl/NumberSelectServiceImpl.js
+9
-0
TextInputServiceImpl.js
...src/components/widget/serviceImpl/TextInputServiceImpl.js
+9
-0
TextSelectGridServiceImpl.js
...omponents/widget/serviceImpl/TextSelectGridServiceImpl.js
+9
-0
TextSelectServiceImpl.js
...rc/components/widget/serviceImpl/TextSelectServiceImpl.js
+10
-1
TimeDateRangeServiceImpl.js
...components/widget/serviceImpl/TimeDateRangeServiceImpl.js
+61
-1
TimeDateServiceImpl.js
.../src/components/widget/serviceImpl/TimeDateServiceImpl.js
+61
-1
TimeMonthServiceImpl.js
...src/components/widget/serviceImpl/TimeMonthServiceImpl.js
+61
-1
TimeYearServiceImpl.js
.../src/components/widget/serviceImpl/TimeYearServiceImpl.js
+61
-1
conditionUtil.js
frontend/src/utils/conditionUtil.js
+35
-0
没有找到文件。
frontend/src/components/canvas/components/Editor/ComponentWrapper.vue
浏览文件 @
ddfd3928
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
:search-count=
"searchCount"
:search-count=
"searchCount"
:h=
"config.style.height"
:h=
"config.style.height"
:edit-mode=
"'preview'"
:edit-mode=
"'preview'"
:filters=
"filters"
:terminal=
"terminal"
:terminal=
"terminal"
/>
/>
</div>
</div>
...
@@ -74,6 +75,10 @@ export default {
...
@@ -74,6 +75,10 @@ export default {
terminal
:
{
terminal
:
{
type
:
String
,
type
:
String
,
default
:
'pc'
default
:
'pc'
},
filters
:
{
type
:
Array
,
default
:
()
=>
[]
}
}
},
},
data
()
{
data
()
{
...
...
frontend/src/components/canvas/components/Editor/Preview.vue
浏览文件 @
ddfd3928
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
:search-count=
"searchCount"
:search-count=
"searchCount"
:in-screen=
"inScreen"
:in-screen=
"inScreen"
:terminal=
"terminal"
:terminal=
"terminal"
:filters=
"filterMap[item.propValue && item.propValue.viewId]"
/>
/>
<!--视图详情-->
<!--视图详情-->
<el-dialog
<el-dialog
...
@@ -65,7 +66,7 @@ import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog'
...
@@ -65,7 +66,7 @@ import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog'
import
CanvasOptBar
from
'@/components/canvas/components/Editor/CanvasOptBar'
import
CanvasOptBar
from
'@/components/canvas/components/Editor/CanvasOptBar'
import
UserViewMobileDialog
from
'@/components/canvas/custom-component/UserViewMobileDialog'
import
UserViewMobileDialog
from
'@/components/canvas/custom-component/UserViewMobileDialog'
import
bus
from
'@/utils/bus'
import
bus
from
'@/utils/bus'
import
{
buildFilterMap
}
from
'@/utils/conditionUtil'
export
default
{
export
default
{
components
:
{
UserViewMobileDialog
,
ComponentWrapper
,
UserViewDialog
,
CanvasOptBar
},
components
:
{
UserViewMobileDialog
,
ComponentWrapper
,
UserViewDialog
,
CanvasOptBar
},
model
:
{
model
:
{
...
@@ -193,7 +194,11 @@ export default {
...
@@ -193,7 +194,11 @@ export default {
'componentData'
,
'componentData'
,
'canvasStyleData'
,
'canvasStyleData'
,
'componentGap'
'componentGap'
])
]),
filterMap
()
{
const
map
=
buildFilterMap
(
this
.
componentData
)
return
map
}
},
},
watch
:
{
watch
:
{
componentData
:
{
componentData
:
{
...
...
frontend/src/components/canvas/components/Editor/index.vue
浏览文件 @
ddfd3928
...
@@ -101,6 +101,7 @@
...
@@ -101,6 +101,7 @@
:id=
"'component' + item.id"
:id=
"'component' + item.id"
ref=
"wrapperChild"
ref=
"wrapperChild"
class=
"component"
class=
"component"
:filters=
"filterMap[item.propValue.viewId]"
:style=
"getComponentStyleDefault(item.style)"
:style=
"getComponentStyleDefault(item.style)"
:prop-value=
"item.propValue"
:prop-value=
"item.propValue"
:element=
"item"
:element=
"item"
...
@@ -191,7 +192,7 @@ import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar'
...
@@ -191,7 +192,7 @@ import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar'
import
DragShadow
from
'@/components/DeDrag/shadow'
import
DragShadow
from
'@/components/DeDrag/shadow'
import
bus
from
'@/utils/bus'
import
bus
from
'@/utils/bus'
import
LinkJumpSet
from
'@/views/panel/LinkJumpSet'
import
LinkJumpSet
from
'@/views/panel/LinkJumpSet'
import
{
buildFilterMap
}
from
'@/utils/conditionUtil'
// 挤占式画布
// 挤占式画布
import
_
from
'lodash'
import
_
from
'lodash'
import
$
from
'jquery'
import
$
from
'jquery'
...
@@ -930,6 +931,7 @@ export default {
...
@@ -930,6 +931,7 @@ export default {
dragComponentInfo
()
{
dragComponentInfo
()
{
return
this
.
$store
.
state
.
dragComponentInfo
return
this
.
$store
.
state
.
dragComponentInfo
},
},
...
mapState
([
...
mapState
([
'componentData'
,
'componentData'
,
'curComponent'
,
'curComponent'
,
...
@@ -941,7 +943,10 @@ export default {
...
@@ -941,7 +943,10 @@ export default {
'componentGap'
,
'componentGap'
,
'mobileLayoutStatus'
,
'mobileLayoutStatus'
,
'curCanvasScale'
'curCanvasScale'
])
]),
filterMap
()
{
return
buildFilterMap
(
this
.
componentData
)
}
},
},
watch
:
{
watch
:
{
customStyle
:
{
customStyle
:
{
...
...
frontend/src/components/canvas/custom-component/UserView.vue
浏览文件 @
ddfd3928
...
@@ -114,11 +114,15 @@ export default {
...
@@ -114,11 +114,15 @@ export default {
terminal
:
{
terminal
:
{
type
:
String
,
type
:
String
,
default
:
'pc'
default
:
'pc'
},
filters
:
{
type
:
Array
,
default
:
()
=>
[]
}
}
},
},
data
()
{
data
()
{
return
{
return
{
filterInit
:
false
,
// 标记是否已经通过watch.filters 进行初始化,如果filterInit=true 则create放弃数据初始化防止数据覆盖
isFirstLoad
:
true
,
// 是否是第一次加载
refId
:
null
,
refId
:
null
,
chart
:
BASE_CHART_STRING
,
chart
:
BASE_CHART_STRING
,
requestStatus
:
'success'
,
requestStatus
:
'success'
,
...
@@ -179,7 +183,7 @@ export default {
...
@@ -179,7 +183,7 @@ export default {
},
},
filter
()
{
filter
()
{
const
filter
=
{}
const
filter
=
{}
filter
.
filter
=
this
.
element
.
filters
filter
.
filter
=
this
.
isFirstLoad
?
this
.
filters
:
this
.
c
filters
filter
.
linkageFilters
=
this
.
element
.
linkageFilters
filter
.
linkageFilters
=
this
.
element
.
linkageFilters
filter
.
drill
=
this
.
drillClickDimensionList
filter
.
drill
=
this
.
drillClickDimensionList
filter
.
resultCount
=
this
.
resultCount
filter
.
resultCount
=
this
.
resultCount
...
@@ -187,7 +191,7 @@ export default {
...
@@ -187,7 +191,7 @@ export default {
filter
.
queryFrom
=
'panel'
filter
.
queryFrom
=
'panel'
return
filter
return
filter
},
},
filters
()
{
c
filters
()
{
// 必要 勿删勿该 watch数组,哪怕发生变化 oldValue等于newValue ,深拷贝解决
// 必要 勿删勿该 watch数组,哪怕发生变化 oldValue等于newValue ,深拷贝解决
if
(
!
this
.
element
.
filters
)
return
[]
if
(
!
this
.
element
.
filters
)
return
[]
return
JSON
.
parse
(
JSON
.
stringify
(
this
.
element
.
filters
))
return
JSON
.
parse
(
JSON
.
stringify
(
this
.
element
.
filters
))
...
@@ -242,11 +246,13 @@ export default {
...
@@ -242,11 +246,13 @@ export default {
},
},
watch
:
{
watch
:
{
'filters'
:
function
(
val1
,
val2
)
{
'cfilters'
:
{
if
(
isChange
(
val1
,
val2
))
{
handler
:
function
(
val1
,
val2
)
{
this
.
filterInit
=
true
if
(
isChange
(
val1
,
val2
)
&&
!
this
.
isFirstLoad
)
{
this
.
getData
(
this
.
element
.
propValue
.
viewId
)
this
.
getData
(
this
.
element
.
propValue
.
viewId
)
}
}
},
deep
:
true
},
},
linkageFilters
:
{
linkageFilters
:
{
handler
(
newVal
,
oldVal
)
{
handler
(
newVal
,
oldVal
)
{
...
@@ -318,7 +324,8 @@ export default {
...
@@ -318,7 +324,8 @@ export default {
this
.
refId
=
uuid
.
v1
this
.
refId
=
uuid
.
v1
if
(
this
.
element
&&
this
.
element
.
propValue
&&
this
.
element
.
propValue
.
viewId
)
{
if
(
this
.
element
&&
this
.
element
.
propValue
&&
this
.
element
.
propValue
.
viewId
)
{
// 如果watch.filters 已经进行数据初始化时候,此处放弃数据初始化
// 如果watch.filters 已经进行数据初始化时候,此处放弃数据初始化
!
this
.
filterInit
&&
this
.
getData
(
this
.
element
.
propValue
.
viewId
,
false
)
this
.
getData
(
this
.
element
.
propValue
.
viewId
,
false
)
}
}
},
},
methods
:
{
methods
:
{
...
@@ -399,6 +406,7 @@ export default {
...
@@ -399,6 +406,7 @@ export default {
this
.
requestStatus
=
'error'
this
.
requestStatus
=
'error'
this
.
message
=
response
.
message
this
.
message
=
response
.
message
}
}
this
.
isFirstLoad
=
false
return
true
return
true
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
this
.
requestStatus
=
'error'
this
.
requestStatus
=
'error'
...
@@ -413,6 +421,7 @@ export default {
...
@@ -413,6 +421,7 @@ export default {
this
.
message
=
err
this
.
message
=
err
}
}
}
}
this
.
isFirstLoad
=
false
return
true
return
true
})
})
}
}
...
...
frontend/src/components/widget/serviceImpl/NumberRangeServiceImpl.js
浏览文件 @
ddfd3928
...
@@ -67,6 +67,39 @@ class NumberRangeServiceImpl extends WidgetService {
...
@@ -67,6 +67,39 @@ class NumberRangeServiceImpl extends WidgetService {
return
field
[
'deType'
]
===
2
||
field
[
'deType'
]
===
3
return
field
[
'deType'
]
===
2
||
field
[
'deType'
]
===
3
})
})
}
}
getParam
(
element
)
{
if
(
element
.
options
.
value
&&
element
.
options
.
value
.
length
>
0
)
{
const
values
=
this
.
element
.
options
.
value
const
min
=
values
[
0
]
let
max
=
null
if
(
values
.
length
>
1
)
{
max
=
values
[
1
]
}
const
param
=
{
component
:
element
,
value
:
[
min
,
max
],
operator
:
'between'
}
if
(
min
&&
max
)
{
return
param
}
if
(
!
min
&&
!
max
)
{
param
.
value
=
[]
return
param
}
if
(
min
)
{
param
.
value
=
[
min
]
param
.
operator
=
'ge'
return
param
}
if
(
max
)
{
param
.
value
=
[
max
]
param
.
operator
=
'le'
return
param
}
}
}
}
}
const
numberRangeServiceImpl
=
new
NumberRangeServiceImpl
()
const
numberRangeServiceImpl
=
new
NumberRangeServiceImpl
()
export
default
numberRangeServiceImpl
export
default
numberRangeServiceImpl
frontend/src/components/widget/serviceImpl/NumberSelectGridServiceImpl.js
浏览文件 @
ddfd3928
...
@@ -81,6 +81,15 @@ class NumberSelectGridServiceImpl extends WidgetService {
...
@@ -81,6 +81,15 @@ class NumberSelectGridServiceImpl extends WidgetService {
}
}
})
})
}
}
getParam
(
element
)
{
const
value
=
element
.
options
.
value
const
param
=
{
component
:
element
,
value
:
!
value
?
[]
:
Array
.
isArray
(
value
)
?
value
:
value
.
toString
().
split
(
','
),
operator
:
element
.
options
.
attrs
.
multiple
?
'in'
:
'eq'
}
return
param
}
}
}
const
numberSelectGridServiceImpl
=
new
NumberSelectGridServiceImpl
()
const
numberSelectGridServiceImpl
=
new
NumberSelectGridServiceImpl
()
export
default
numberSelectGridServiceImpl
export
default
numberSelectGridServiceImpl
frontend/src/components/widget/serviceImpl/NumberSelectServiceImpl.js
浏览文件 @
ddfd3928
...
@@ -82,6 +82,15 @@ class NumberSelectServiceImpl extends WidgetService {
...
@@ -82,6 +82,15 @@ class NumberSelectServiceImpl extends WidgetService {
}
}
})
})
}
}
getParam
(
element
)
{
const
value
=
element
.
options
.
value
const
param
=
{
component
:
element
,
value
:
!
value
?
[]
:
Array
.
isArray
(
value
)
?
value
:
value
.
toString
().
split
(
','
),
operator
:
element
.
options
.
attrs
.
multiple
?
'in'
:
'eq'
}
return
param
}
}
}
const
numberSelectServiceImpl
=
new
NumberSelectServiceImpl
()
const
numberSelectServiceImpl
=
new
NumberSelectServiceImpl
()
export
default
numberSelectServiceImpl
export
default
numberSelectServiceImpl
frontend/src/components/widget/serviceImpl/TextInputServiceImpl.js
浏览文件 @
ddfd3928
...
@@ -67,6 +67,15 @@ class TextInputServiceImpl extends WidgetService {
...
@@ -67,6 +67,15 @@ class TextInputServiceImpl extends WidgetService {
return
field
[
'deType'
]
===
0
return
field
[
'deType'
]
===
0
})
})
}
}
getParam
(
element
)
{
const
value
=
element
.
options
.
value
const
param
=
{
component
:
element
,
value
:
!
value
?
[]
:
Array
.
isArray
(
value
)
?
value
:
[
value
],
operator
:
'like'
}
return
param
}
}
}
const
textInputServiceImpl
=
new
TextInputServiceImpl
()
const
textInputServiceImpl
=
new
TextInputServiceImpl
()
export
default
textInputServiceImpl
export
default
textInputServiceImpl
frontend/src/components/widget/serviceImpl/TextSelectGridServiceImpl.js
浏览文件 @
ddfd3928
...
@@ -81,6 +81,15 @@ class TextSelectGridServiceImpl extends WidgetService {
...
@@ -81,6 +81,15 @@ class TextSelectGridServiceImpl extends WidgetService {
}
}
})
})
}
}
getParam
(
element
)
{
const
value
=
element
.
options
.
value
const
param
=
{
component
:
element
,
value
:
!
value
?
[]
:
Array
.
isArray
(
value
)
?
value
:
value
.
toString
().
split
(
','
),
operator
:
element
.
options
.
attrs
.
multiple
?
'in'
:
'eq'
}
return
param
}
}
}
const
textSelectGridServiceImpl
=
new
TextSelectGridServiceImpl
()
const
textSelectGridServiceImpl
=
new
TextSelectGridServiceImpl
()
export
default
textSelectGridServiceImpl
export
default
textSelectGridServiceImpl
frontend/src/components/widget/serviceImpl/TextSelectServiceImpl.js
浏览文件 @
ddfd3928
import
{
WidgetService
}
from
'../service/WidgetService'
import
{
WidgetService
}
from
'../service/WidgetService'
const
leftPanel
=
{
const
leftPanel
=
{
icon
:
'iconfont icon-xialakuang'
,
icon
:
'iconfont icon-xialakuang'
,
label
:
'detextselect.label'
,
label
:
'detextselect.label'
,
...
@@ -81,6 +80,16 @@ class TextSelectServiceImpl extends WidgetService {
...
@@ -81,6 +80,16 @@ class TextSelectServiceImpl extends WidgetService {
}
}
})
})
}
}
getParam
(
element
)
{
const
value
=
element
.
options
.
value
const
param
=
{
component
:
element
,
value
:
!
value
?
[]
:
Array
.
isArray
(
value
)
?
value
:
value
.
toString
().
split
(
','
),
operator
:
element
.
options
.
attrs
.
multiple
?
'in'
:
'eq'
}
return
param
}
}
}
const
textSelectServiceImpl
=
new
TextSelectServiceImpl
()
const
textSelectServiceImpl
=
new
TextSelectServiceImpl
()
export
default
textSelectServiceImpl
export
default
textSelectServiceImpl
frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js
浏览文件 @
ddfd3928
import
{
import
{
WidgetService
WidgetService
}
from
'../service/WidgetService'
}
from
'../service/WidgetService'
import
{
timeSection
}
from
'@/utils'
const
leftPanel
=
{
const
leftPanel
=
{
icon
:
'iconfont icon-riqi'
,
icon
:
'iconfont icon-riqi'
,
label
:
'dedaterange.label'
,
label
:
'dedaterange.label'
,
...
@@ -222,6 +224,64 @@ class TimeDateRangeServiceImpl extends WidgetService {
...
@@ -222,6 +224,64 @@ class TimeDateRangeServiceImpl extends WidgetService {
return
false
return
false
}
}
}
}
getParam
(
element
)
{
let
timeArr
=
[]
if
(
element
.
options
.
attrs
.
default
.
isDynamic
)
{
let
value
=
this
.
dynamicDateFormNow
(
element
)
value
=
this
.
formatFilterValue
(
value
)
timeArr
=
this
.
formatValues
(
value
,
element
)
}
else
{
let
value
=
this
.
fillValueDerfault
(
element
)
value
=
this
.
formatFilterValue
(
value
)
timeArr
=
this
.
formatValues
(
value
,
element
)
}
const
param
=
{
component
:
element
,
value
:
timeArr
,
operator
:
'between'
}
return
param
}
fillValueDerfault
(
element
)
{
const
defaultV
=
element
.
options
.
value
===
null
?
''
:
element
.
options
.
value
.
toString
()
if
(
element
.
options
.
attrs
.
type
===
'daterange'
)
{
if
(
defaultV
===
null
||
typeof
defaultV
===
'undefined'
||
defaultV
===
''
||
defaultV
===
'[object Object]'
)
{
return
[]
}
return
defaultV
.
split
(
','
).
map
(
item
=>
parseFloat
(
item
))
}
else
{
if
(
defaultV
===
null
||
typeof
defaultV
===
'undefined'
||
defaultV
===
''
||
defaultV
===
'[object Object]'
)
{
return
null
}
return
parseFloat
(
defaultV
.
split
(
','
)[
0
])
}
}
formatFilterValue
(
values
)
{
if
(
values
===
null
)
return
[]
if
(
Array
.
isArray
(
values
))
return
values
return
[
values
]
}
formatValues
(
values
,
element
)
{
if
(
!
values
||
values
.
length
===
0
)
{
return
[]
}
if
(
element
.
options
.
attrs
.
type
===
'daterange'
)
{
if
(
values
.
length
!==
2
)
{
return
null
}
let
start
=
values
[
0
]
let
end
=
values
[
1
]
start
=
timeSection
(
start
,
'date'
)[
0
]
end
=
timeSection
(
end
,
'date'
)[
1
]
const
results
=
[
start
,
end
]
return
results
}
else
{
const
value
=
values
[
0
]
return
timeSection
(
parseFloat
(
value
),
element
.
options
.
attrs
.
type
)
}
}
}
}
const
timeDateRangeServiceImpl
=
new
TimeDateRangeServiceImpl
()
const
timeDateRangeServiceImpl
=
new
TimeDateRangeServiceImpl
()
export
default
timeDateRangeServiceImpl
export
default
timeDateRangeServiceImpl
frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js
浏览文件 @
ddfd3928
import
{
import
{
WidgetService
WidgetService
}
from
'../service/WidgetService'
}
from
'../service/WidgetService'
import
{
timeSection
}
from
'@/utils'
const
leftPanel
=
{
const
leftPanel
=
{
icon
:
'iconfont icon-ri'
,
icon
:
'iconfont icon-ri'
,
label
:
'dedate.label'
,
label
:
'dedate.label'
,
...
@@ -153,6 +155,64 @@ class TimeDateServiceImpl extends WidgetService {
...
@@ -153,6 +155,64 @@ class TimeDateServiceImpl extends WidgetService {
}
}
}
}
}
}
getParam
(
element
)
{
let
timeArr
=
[]
if
(
element
.
options
.
attrs
.
default
.
isDynamic
)
{
let
value
=
this
.
dynamicDateFormNow
(
element
)
value
=
this
.
formatFilterValue
(
value
)
timeArr
=
this
.
formatValues
(
value
,
element
)
}
else
{
let
value
=
this
.
fillValueDerfault
(
element
)
value
=
this
.
formatFilterValue
(
value
)
timeArr
=
this
.
formatValues
(
value
,
element
)
}
const
param
=
{
component
:
element
,
value
:
timeArr
,
operator
:
'between'
}
return
param
}
fillValueDerfault
(
element
)
{
const
defaultV
=
element
.
options
.
value
===
null
?
''
:
element
.
options
.
value
.
toString
()
if
(
element
.
options
.
attrs
.
type
===
'daterange'
)
{
if
(
defaultV
===
null
||
typeof
defaultV
===
'undefined'
||
defaultV
===
''
||
defaultV
===
'[object Object]'
)
{
return
[]
}
return
defaultV
.
split
(
','
).
map
(
item
=>
parseFloat
(
item
))
}
else
{
if
(
defaultV
===
null
||
typeof
defaultV
===
'undefined'
||
defaultV
===
''
||
defaultV
===
'[object Object]'
)
{
return
null
}
return
parseFloat
(
defaultV
.
split
(
','
)[
0
])
}
}
formatFilterValue
(
values
)
{
if
(
values
===
null
)
return
[]
if
(
Array
.
isArray
(
values
))
return
values
return
[
values
]
}
formatValues
(
values
,
element
)
{
if
(
!
values
||
values
.
length
===
0
)
{
return
[]
}
if
(
element
.
options
.
attrs
.
type
===
'daterange'
)
{
if
(
values
.
length
!==
2
)
{
return
null
}
let
start
=
values
[
0
]
let
end
=
values
[
1
]
start
=
timeSection
(
start
,
'date'
)[
0
]
end
=
timeSection
(
end
,
'date'
)[
1
]
const
results
=
[
start
,
end
]
return
results
}
else
{
const
value
=
values
[
0
]
return
timeSection
(
parseFloat
(
value
),
element
.
options
.
attrs
.
type
)
}
}
}
}
const
timeDateServiceImpl
=
new
TimeDateServiceImpl
({
const
timeDateServiceImpl
=
new
TimeDateServiceImpl
({
name
:
'timeDateWidget'
name
:
'timeDateWidget'
...
...
frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js
浏览文件 @
ddfd3928
import
{
WidgetService
}
from
'../service/WidgetService'
import
{
WidgetService
}
from
'../service/WidgetService'
import
{
timeSection
}
from
'@/utils'
const
leftPanel
=
{
const
leftPanel
=
{
icon
:
'iconfont icon-yue'
,
icon
:
'iconfont icon-yue'
,
label
:
'deyearmonth.label'
,
label
:
'deyearmonth.label'
,
...
@@ -119,6 +121,64 @@ class TimeMonthServiceImpl extends WidgetService {
...
@@ -119,6 +121,64 @@ class TimeMonthServiceImpl extends WidgetService {
}
}
}
}
}
}
getParam
(
element
)
{
let
timeArr
=
[]
if
(
element
.
options
.
attrs
.
default
.
isDynamic
)
{
let
value
=
this
.
dynamicDateFormNow
(
element
)
value
=
this
.
formatFilterValue
(
value
)
timeArr
=
this
.
formatValues
(
value
,
element
)
}
else
{
let
value
=
this
.
fillValueDerfault
(
element
)
value
=
this
.
formatFilterValue
(
value
)
timeArr
=
this
.
formatValues
(
value
,
element
)
}
const
param
=
{
component
:
element
,
value
:
timeArr
,
operator
:
'between'
}
return
param
}
fillValueDerfault
(
element
)
{
const
defaultV
=
element
.
options
.
value
===
null
?
''
:
element
.
options
.
value
.
toString
()
if
(
element
.
options
.
attrs
.
type
===
'daterange'
)
{
if
(
defaultV
===
null
||
typeof
defaultV
===
'undefined'
||
defaultV
===
''
||
defaultV
===
'[object Object]'
)
{
return
[]
}
return
defaultV
.
split
(
','
).
map
(
item
=>
parseFloat
(
item
))
}
else
{
if
(
defaultV
===
null
||
typeof
defaultV
===
'undefined'
||
defaultV
===
''
||
defaultV
===
'[object Object]'
)
{
return
null
}
return
parseFloat
(
defaultV
.
split
(
','
)[
0
])
}
}
formatFilterValue
(
values
)
{
if
(
values
===
null
)
return
[]
if
(
Array
.
isArray
(
values
))
return
values
return
[
values
]
}
formatValues
(
values
,
element
)
{
if
(
!
values
||
values
.
length
===
0
)
{
return
[]
}
if
(
element
.
options
.
attrs
.
type
===
'daterange'
)
{
if
(
values
.
length
!==
2
)
{
return
null
}
let
start
=
values
[
0
]
let
end
=
values
[
1
]
start
=
timeSection
(
start
,
'date'
)[
0
]
end
=
timeSection
(
end
,
'date'
)[
1
]
const
results
=
[
start
,
end
]
return
results
}
else
{
const
value
=
values
[
0
]
return
timeSection
(
parseFloat
(
value
),
element
.
options
.
attrs
.
type
)
}
}
}
}
const
timeMonthServiceImpl
=
new
TimeMonthServiceImpl
()
const
timeMonthServiceImpl
=
new
TimeMonthServiceImpl
()
export
default
timeMonthServiceImpl
export
default
timeMonthServiceImpl
frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js
浏览文件 @
ddfd3928
import
{
WidgetService
}
from
'../service/WidgetService'
import
{
WidgetService
}
from
'../service/WidgetService'
import
{
timeSection
}
from
'@/utils'
const
leftPanel
=
{
const
leftPanel
=
{
icon
:
'iconfont icon-nian'
,
icon
:
'iconfont icon-nian'
,
label
:
'deyear.label'
,
label
:
'deyear.label'
,
...
@@ -110,6 +112,64 @@ class TimeYearServiceImpl extends WidgetService {
...
@@ -110,6 +112,64 @@ class TimeYearServiceImpl extends WidgetService {
return
new
Date
(
dynamicSuffix
===
'before'
?
(
nowYear
-
dynamicPrefix
)
:
(
nowYear
+
dynamicPrefix
),
0
,
1
).
getTime
()
return
new
Date
(
dynamicSuffix
===
'before'
?
(
nowYear
-
dynamicPrefix
)
:
(
nowYear
+
dynamicPrefix
),
0
,
1
).
getTime
()
}
}
}
}
getParam
(
element
)
{
let
timeArr
=
[]
if
(
element
.
options
.
attrs
.
default
.
isDynamic
)
{
let
value
=
this
.
dynamicDateFormNow
(
element
)
value
=
this
.
formatFilterValue
(
value
)
timeArr
=
this
.
formatValues
(
value
,
element
)
}
else
{
let
value
=
this
.
fillValueDerfault
(
element
)
value
=
this
.
formatFilterValue
(
value
)
timeArr
=
this
.
formatValues
(
value
,
element
)
}
const
param
=
{
component
:
element
,
value
:
timeArr
,
operator
:
'between'
}
return
param
}
fillValueDerfault
(
element
)
{
const
defaultV
=
element
.
options
.
value
===
null
?
''
:
element
.
options
.
value
.
toString
()
if
(
element
.
options
.
attrs
.
type
===
'daterange'
)
{
if
(
defaultV
===
null
||
typeof
defaultV
===
'undefined'
||
defaultV
===
''
||
defaultV
===
'[object Object]'
)
{
return
[]
}
return
defaultV
.
split
(
','
).
map
(
item
=>
parseFloat
(
item
))
}
else
{
if
(
defaultV
===
null
||
typeof
defaultV
===
'undefined'
||
defaultV
===
''
||
defaultV
===
'[object Object]'
)
{
return
null
}
return
parseFloat
(
defaultV
.
split
(
','
)[
0
])
}
}
formatFilterValue
(
values
)
{
if
(
values
===
null
)
return
[]
if
(
Array
.
isArray
(
values
))
return
values
return
[
values
]
}
formatValues
(
values
,
element
)
{
if
(
!
values
||
values
.
length
===
0
)
{
return
[]
}
if
(
element
.
options
.
attrs
.
type
===
'daterange'
)
{
if
(
values
.
length
!==
2
)
{
return
null
}
let
start
=
values
[
0
]
let
end
=
values
[
1
]
start
=
timeSection
(
start
,
'date'
)[
0
]
end
=
timeSection
(
end
,
'date'
)[
1
]
const
results
=
[
start
,
end
]
return
results
}
else
{
const
value
=
values
[
0
]
return
timeSection
(
parseFloat
(
value
),
element
.
options
.
attrs
.
type
)
}
}
}
}
const
timeYearServiceImpl
=
new
TimeYearServiceImpl
()
const
timeYearServiceImpl
=
new
TimeYearServiceImpl
()
export
default
timeYearServiceImpl
export
default
timeYearServiceImpl
frontend/src/utils/conditionUtil.js
浏览文件 @
ddfd3928
import
{
Condition
}
from
'@/components/widget/bean/Condition'
import
{
Condition
}
from
'@/components/widget/bean/Condition'
import
{
ApplicationContext
}
from
'@/utils/ApplicationContext'
/**
/**
* 判断两个conditions数组是否相同
* 判断两个conditions数组是否相同
* @param {*} conditions1
* @param {*} conditions1
...
@@ -36,3 +38,36 @@ export const formatLinkageCondition = obj => {
...
@@ -36,3 +38,36 @@ export const formatLinkageCondition = obj => {
const
condition
=
new
Condition
(
null
,
fieldId
,
operator
,
value
,
viewIds
)
const
condition
=
new
Condition
(
null
,
fieldId
,
operator
,
value
,
viewIds
)
return
condition
return
condition
}
}
export
const
buildFilterMap
=
panelItems
=>
{
const
viewIdMatch
=
(
viewIds
,
viewId
)
=>
!
viewIds
||
viewIds
.
length
===
0
||
viewIds
.
includes
(
viewId
)
const
result
=
{}
panelItems
.
forEach
(
element
=>
{
if
(
element
.
type
===
'view'
)
{
result
[
element
.
propValue
.
viewId
]
=
[]
}
})
panelItems
.
forEach
(
element
=>
{
if
(
element
.
type
!==
'custom'
)
{
return
true
}
const
widget
=
ApplicationContext
.
getService
(
element
.
serviceName
)
const
param
=
widget
.
getParam
(
element
)
const
condition
=
formatCondition
(
param
)
const
vValid
=
valueValid
(
condition
)
const
filterComponentId
=
condition
.
componentId
Object
.
keys
(
result
).
forEach
(
viewId
=>
{
const
vidMatch
=
viewIdMatch
(
condition
.
viewIds
,
viewId
)
const
viewFilters
=
result
[
viewId
]
let
j
=
viewFilters
.
length
while
(
j
--
)
{
const
filter
=
viewFilters
[
j
]
if
(
filter
.
componentId
===
filterComponentId
)
{
viewFilters
.
splice
(
j
,
1
)
}
}
vidMatch
&&
vValid
&&
viewFilters
.
push
(
condition
)
})
})
return
result
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论