Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
5af4158d
提交
5af4158d
authored
4月 19, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:设置条件绑定视图
上级
153ac357
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
127 行增加
和
15 行删除
+127
-15
ViewApi.java
...c/main/java/io/dataease/controller/panel/api/ViewApi.java
+7
-0
ViewServer.java
.../java/io/dataease/controller/panel/server/ViewServer.java
+12
-0
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+6
-0
view.js
frontend/src/api/panel/view.js
+9
-0
index.vue
frontend/src/components/canvas/components/Editor/index.vue
+2
-1
UserView.vue
frontend/src/components/canvas/custom-component/UserView.vue
+1
-1
DeSelect.vue
frontend/src/components/widget/DeWidget/DeSelect.vue
+1
-1
filterDialog.vue
frontend/src/views/panel/filter/filterDialog.vue
+89
-12
没有找到文件。
backend/src/main/java/io/dataease/controller/panel/api/ViewApi.java
浏览文件 @
5af4158d
package
io
.
dataease
.
controller
.
panel
.
api
;
import
io.dataease.base.domain.ChartView
;
import
io.dataease.controller.sys.base.BaseGridRequest
;
import
io.dataease.dto.panel.PanelViewDto
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -20,6 +22,11 @@ public interface ViewApi {
List
<
PanelViewDto
>
tree
(
BaseGridRequest
request
);
@ApiOperation
(
"根据仪表板Id查询视图"
)
@PostMapping
(
"/viewsWithIds"
)
List
<
ChartView
>
viewsWithIds
(
List
<
String
>
viewIds
);
...
...
backend/src/main/java/io/dataease/controller/panel/server/ViewServer.java
浏览文件 @
5af4158d
package
io
.
dataease
.
controller
.
panel
.
server
;
import
io.dataease.base.domain.ChartView
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.controller.panel.api.ViewApi
;
import
io.dataease.controller.sys.base.BaseGridRequest
;
import
io.dataease.controller.sys.base.ConditionEntity
;
import
io.dataease.dto.panel.PanelViewDto
;
import
io.dataease.dto.panel.po.PanelViewPo
;
import
io.dataease.service.chart.ChartViewService
;
import
io.dataease.service.panel.PanelViewService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -20,6 +23,9 @@ public class ViewServer implements ViewApi {
@Autowired
private
PanelViewService
panelViewService
;
@Autowired
private
ChartViewService
chartViewService
;
/**
* 为什么查两次?
* 因为left join 会导致全表扫描
...
...
@@ -40,4 +46,10 @@ public class ViewServer implements ViewApi {
List
<
PanelViewDto
>
panelViewDtos
=
panelViewService
.
buildTree
(
groups
,
views
);
return
panelViewDtos
;
}
@Override
public
List
<
ChartView
>
viewsWithIds
(
@RequestBody
List
<
String
>
viewIds
)
{
return
chartViewService
.
viewsByIds
(
viewIds
);
}
}
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
5af4158d
...
...
@@ -320,4 +320,10 @@ public class ChartViewService {
}
return
map
;
}
public
List
<
ChartView
>
viewsByIds
(
List
<
String
>
viewIds
){
ChartViewExample
example
=
new
ChartViewExample
();
example
.
createCriteria
().
andIdIn
(
viewIds
);
return
chartViewMapper
.
selectByExample
(
example
);
}
}
frontend/src/api/panel/view.js
浏览文件 @
5af4158d
...
...
@@ -8,3 +8,12 @@ export function tree(data) {
data
})
}
export
function
viewsWithIds
(
data
)
{
return
request
({
url
:
'/api/panelView/viewsWithIds'
,
method
:
'post'
,
loading
:
true
,
data
})
}
frontend/src/components/canvas/components/Editor/index.vue
浏览文件 @
5af4158d
...
...
@@ -314,7 +314,8 @@ export default {
setConditionValue
(
obj
)
{
const
{
component
,
value
,
operator
}
=
obj
const
fieldId
=
component
.
options
.
attrs
.
fieldId
const
condition
=
new
Condition
(
component
.
id
,
fieldId
,
operator
,
value
,
null
)
const
viewIds
=
component
.
options
.
attrs
.
viewIds
const
condition
=
new
Condition
(
component
.
id
,
fieldId
,
operator
,
value
,
viewIds
)
this
.
addCondition
(
condition
)
},
addCondition
(
condition
)
{
...
...
frontend/src/components/canvas/custom-component/UserView.vue
浏览文件 @
5af4158d
...
...
@@ -31,7 +31,7 @@ export default {
methods
:
{
getData
(
id
)
{
if
(
id
)
{
post
(
'/chart/view/getData/'
+
id
,
null
).
then
(
response
=>
{
post
(
'/chart/view/getData/'
+
id
,
{}
).
then
(
response
=>
{
// 将视图传入echart组件
this
.
chart
=
response
.
data
})
...
...
frontend/src/components/widget/DeWidget/DeSelect.vue
浏览文件 @
5af4158d
<
template
>
<el-select
v-if=
"options!== null && options.attrs!==null"
v-model=
"options.value"
:style=
"element.style"
:placeholder=
"options.attrs.placeholder"
@
change=
"changeValue"
>
<el-select
v-if=
"options!== null && options.attrs!==null"
v-model=
"options.value"
:
multiple=
"options.attrs.multiple"
:
style=
"element.style"
:placeholder=
"options.attrs.placeholder"
@
change=
"changeValue"
>
<el-option
v-for=
"item in options.attrs.datas"
:key=
"item[options.attrs.key]"
...
...
frontend/src/views/panel/filter/filterDialog.vue
浏览文件 @
5af4158d
...
...
@@ -110,12 +110,36 @@
v-model=
"componentInfo.options.attrs.multiple"
active-text=
"多选"
inactive-text=
"单选"
@
change=
"multipleChange"
/>
</div>
</el-col>
<el-col
:span=
"16"
><div
class=
"filter-options-right"
>
<el-checkbox
v-model=
"customRange"
><span>
自定义控制范围
</span>
</el-checkbox>
<i
:class=
"{'i-filter-active': customRange, 'i-filter-inactive': !customRange}"
class=
"el-icon-setting i-filter"
@
click=
"showFilterRange"
/>
<el-popover
v-model=
"popovervisible"
placement=
"bottom-end"
:disabled=
"!customRange"
width=
"200"
>
<div
class=
"view-container-class"
>
<el-checkbox-group
v-model=
"checkedViews"
@
change=
"checkedViewsChange"
>
<el-checkbox
v-for=
"(item ) in viewInfos"
:key=
"item.id"
:label=
"item.id"
border
>
<span>
<svg-icon
:icon-class=
"item.type"
class=
"chart-icon"
/>
<span
style=
"margin-left: 6px"
>
{{ item.name }}
</span>
</span>
</el-checkbox>
</el-checkbox-group>
</div>
<!-- <div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="popovervisible=false">取消</el-button>
<el-button type="primary" size="mini" @click="popovervisible=false">确定</el-button>
</div> -->
<i
slot=
"reference"
:class=
"{'i-filter-active': customRange, 'i-filter-inactive': !customRange}"
class=
"el-icon-setting i-filter"
/>
</el-popover>
<!-- <el-checkbox disabled>备选项</el-checkbox> -->
</div>
...
...
@@ -147,8 +171,10 @@ import DeContainer from '@/components/dataease/DeContainer'
import
DeAsideContainer
from
'@/components/dataease/DeAsideContainer'
import
draggable
from
'vuedraggable'
import
DragItem
from
'@/components/DragItem'
import
{
mapState
}
from
'vuex'
// import { ApplicationContext } from '@/utils/ApplicationContext'
import
{
groupTree
,
loadTable
,
fieldList
,
fieldValues
}
from
'@/api/dataset/dataset'
import
{
viewsWithIds
}
from
'@/api/panel/view'
export
default
{
name
:
'FilterDialog'
,
components
:
{
...
...
@@ -169,6 +195,7 @@ export default {
default
:
null
}
},
data
()
{
return
{
activeName
:
'dataset'
,
...
...
@@ -186,21 +213,35 @@ export default {
selectField
:
[],
widget
:
null
,
fieldValues
:
[],
customRange
:
false
customRange
:
false
,
popovervisible
:
false
,
viewInfos
:
[],
checkedViews
:
[]
}
},
computed
:
{
panelInfo
()
{
return
this
.
$store
.
state
.
panel
.
panelInfo
},
...
mapState
([
'componentData'
,
'curComponent'
,
'isClickComponent'
,
'canvasStyleData'
,
'curComponentIndex'
])
},
watch
:
{
selectField
(
values
)
{
if
(
values
&&
values
.
length
>
0
)
{
const
value
=
values
[
0
]
const
fieldId
=
value
.
id
const
info
=
this
.
componentInfo
this
.
widget
&&
fieldValues
(
fieldId
).
then
(
res
=>
{
i
nfo
.
options
.
attrs
.
datas
=
this
.
widget
.
optionDatas
(
res
.
data
)
i
nfo
.
options
.
attrs
.
fieldId
=
fieldId
i
nfo
.
options
.
attrs
.
dragItems
=
values
this
.
$emit
(
're-fresh-component'
,
i
nfo
)
this
.
componentI
nfo
.
options
.
attrs
.
datas
=
this
.
widget
.
optionDatas
(
res
.
data
)
this
.
componentI
nfo
.
options
.
attrs
.
fieldId
=
fieldId
this
.
componentI
nfo
.
options
.
attrs
.
dragItems
=
values
this
.
$emit
(
're-fresh-component'
,
this
.
componentI
nfo
)
})
}
}
...
...
@@ -213,9 +254,26 @@ export default {
if
(
this
.
componentInfo
&&
this
.
componentInfo
.
options
.
attrs
.
dragItems
)
{
this
.
selectField
=
this
.
componentInfo
.
options
.
attrs
.
dragItems
}
this
.
loadViews
()
},
methods
:
{
loadViews
()
{
const
viewIds
=
this
.
componentData
.
filter
(
item
=>
item
.
type
===
'view'
&&
item
.
propValue
&&
item
.
propValue
.
viewId
)
.
map
(
item
=>
item
.
propValue
.
viewId
)
viewsWithIds
(
viewIds
).
then
(
res
=>
{
const
datas
=
res
.
data
// for (let index = 0; index
<
4
;
index
++
)
{
// datas = datas.concat(datas)
// }
// datas.forEach(item => item.name += 'aaaaaaaaabbbbb')
this
.
viewInfos
=
datas
})
},
handleNodeClick
(
data
)
{
if
(
data
.
type
===
'scene'
)
{
this
.
showSceneTable
(
data
)
...
...
@@ -334,11 +392,16 @@ export default {
const
index
=
tag
.
index
this
.
selectField
.
splice
(
index
,
1
)
},
showFilterRange
()
{
// 如果不是自定义范围 直接返回
if
(
!
this
.
customRange
)
{
return
}
multipleChange
(
value
)
{
// this.componentInfo.options.attrs.multiple = value
this
.
componentInfo
.
options
.
value
=
null
this
.
$emit
(
're-fresh-component'
,
this
.
componentInfo
)
},
checkedViewsChange
(
values
)
{
this
.
componentInfo
.
options
.
attrs
.
viewIds
=
values
this
.
$emit
(
're-fresh-component'
,
this
.
componentInfo
)
}
}
}
...
...
@@ -484,4 +547,18 @@ export default {
cursor
:
pointer
!
important
;
}
.view-container-class
{
min-height
:
150px
;
max-height
:
200px
;
width
:
100%
;
overflow-y
:
auto
;
overflow-x
:
hidden
;
word-break
:break-all
;
position
:
relative
;
>>>
label
{
width
:
100%
;
}
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论