Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
cc9a9619
Unverified
提交
cc9a9619
authored
2月 28, 2022
作者:
Junjun
提交者:
GitHub
2月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1839 from dataease/pr@v1.8@refactor_permission
refactor: 视图权限
上级
a0893ae0
64d9471c
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
56 行增加
和
42 行删除
+56
-42
ChartViewController.java
...ava/io/dataease/controller/chart/ChartViewController.java
+32
-19
chart.js
frontend/src/api/chart/chart.js
+2
-12
panel.js
frontend/src/api/panel/panel.js
+2
-2
UserView.vue
frontend/src/components/canvas/custom-component/UserView.vue
+1
-1
Group.vue
frontend/src/views/chart/group/Group.vue
+6
-3
ChartEdit.vue
frontend/src/views/chart/view/ChartEdit.vue
+7
-4
DatasetChartDetail.vue
frontend/src/views/dataset/common/DatasetChartDetail.vue
+6
-1
没有找到文件。
backend/src/main/java/io/dataease/controller/chart/ChartViewController.java
浏览文件 @
cc9a9619
package
io
.
dataease
.
controller
.
chart
;
package
io
.
dataease
.
controller
.
chart
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
io.dataease.auth.annotation.DePermission
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.commons.constants.DePermissionType
;
import
io.dataease.commons.constants.ResourceAuthLevel
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.controller.request.chart.ChartCalRequest
;
import
io.dataease.controller.request.chart.ChartCalRequest
;
import
io.dataease.controller.request.chart.ChartExtRequest
;
import
io.dataease.controller.request.chart.ChartExtRequest
;
...
@@ -11,10 +14,12 @@ import io.dataease.dto.chart.ChartViewDTO;
...
@@ -11,10 +14,12 @@ import io.dataease.dto.chart.ChartViewDTO;
import
io.dataease.service.chart.ChartViewService
;
import
io.dataease.service.chart.ChartViewService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.ws.rs.Path
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -29,52 +34,65 @@ public class ChartViewController {
...
@@ -29,52 +34,65 @@ public class ChartViewController {
@Resource
@Resource
private
ChartViewService
chartViewService
;
private
ChartViewService
chartViewService
;
@RequiresPermissions
(
"data:read"
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_MANAGE
)
@ApiOperation
(
"保存"
)
@ApiOperation
(
"保存"
)
@PostMapping
(
"/save"
)
@PostMapping
(
"/save
/{panelId}
"
)
public
ChartViewWithBLOBs
save
(
@RequestBody
ChartViewWithBLOBs
chartViewWithBLOBs
)
{
public
ChartViewWithBLOBs
save
(
@
PathVariable
String
panelId
,
@
RequestBody
ChartViewWithBLOBs
chartViewWithBLOBs
)
{
return
chartViewService
.
save
(
chartViewWithBLOBs
);
return
chartViewService
.
save
(
chartViewWithBLOBs
);
}
}
@ApiIgnore
@ApiOperation
(
"查询"
)
@ApiOperation
(
"查询"
)
@PostMapping
(
"/list"
)
@PostMapping
(
"/list"
)
public
List
<
ChartViewDTO
>
list
(
@RequestBody
ChartViewRequest
chartViewRequest
)
{
public
List
<
ChartViewDTO
>
list
(
@RequestBody
ChartViewRequest
chartViewRequest
)
{
return
chartViewService
.
list
(
chartViewRequest
);
return
chartViewService
.
list
(
chartViewRequest
);
}
}
@ApiIgnore
@ApiOperation
(
"查询组"
)
@ApiOperation
(
"查询组"
)
@PostMapping
(
"/listAndGroup"
)
@PostMapping
(
"/listAndGroup"
)
public
List
<
ChartViewDTO
>
listAndGroup
(
@RequestBody
ChartViewRequest
chartViewRequest
)
{
public
List
<
ChartViewDTO
>
listAndGroup
(
@RequestBody
ChartViewRequest
chartViewRequest
)
{
return
chartViewService
.
listAndGroup
(
chartViewRequest
);
return
chartViewService
.
listAndGroup
(
chartViewRequest
);
}
}
@RequiresPermissions
(
"data:read"
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_VIEW
,
paramIndex
=
1
)
@ApiOperation
(
"详细信息"
)
@ApiOperation
(
"详细信息"
)
@PostMapping
(
"/get/{id}"
)
@PostMapping
(
"/get/{id}
/{panelId}
"
)
public
ChartViewWithBLOBs
get
(
@PathVariable
String
id
)
{
public
ChartViewWithBLOBs
get
(
@PathVariable
String
id
,
@PathVariable
String
panelId
)
{
return
chartViewService
.
get
(
id
);
return
chartViewService
.
get
(
id
);
}
}
@ApiIgnore
@ApiOperation
(
"删除"
)
@ApiOperation
(
"删除"
)
@PostMapping
(
"/delete/{id}"
)
@PostMapping
(
"/delete/{id}"
)
public
void
delete
(
@PathVariable
String
id
)
{
public
void
delete
(
@PathVariable
String
id
)
{
chartViewService
.
delete
(
id
);
chartViewService
.
delete
(
id
);
}
}
@RequiresPermissions
(
"data:read"
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_VIEW
,
paramIndex
=
1
)
@ApiOperation
(
"数据"
)
@ApiOperation
(
"数据"
)
@PostMapping
(
"/getData/{id}"
)
@PostMapping
(
"/getData/{id}
/{panelId}
"
)
public
ChartViewDTO
getData
(
@PathVariable
String
id
,
@RequestBody
ChartExtRequest
requestList
)
throws
Exception
{
public
ChartViewDTO
getData
(
@PathVariable
String
id
,
@
PathVariable
String
panelId
,
@
RequestBody
ChartExtRequest
requestList
)
throws
Exception
{
return
chartViewService
.
getData
(
id
,
requestList
);
return
chartViewService
.
getData
(
id
,
requestList
);
}
}
@RequiresPermissions
(
"data:read"
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_VIEW
,
paramIndex
=
1
)
@ApiOperation
(
"视图详情"
)
@ApiOperation
(
"视图详情"
)
@PostMapping
(
"chartDetail/{id}"
)
@PostMapping
(
"chartDetail/{id}
/{panelId}
"
)
public
ChartDetail
chartDetail
(
@PathVariable
String
id
)
{
public
ChartDetail
chartDetail
(
@PathVariable
String
id
,
@PathVariable
String
panelId
)
{
return
chartViewService
.
getChartDetail
(
id
);
return
chartViewService
.
getChartDetail
(
id
);
}
}
@RequiresPermissions
(
"data:read"
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_MANAGE
,
paramIndex
=
1
)
@ApiOperation
(
"复制"
)
@ApiOperation
(
"复制"
)
@PostMapping
(
"chartCopy/{id}/{panelId}"
)
@PostMapping
(
"chartCopy/{id}/{panelId}"
)
public
String
chartCopy
(
@PathVariable
String
id
,
@PathVariable
String
panelId
)
{
public
String
chartCopy
(
@PathVariable
String
id
,
@PathVariable
String
panelId
)
{
return
chartViewService
.
chartCopy
(
id
,
panelId
);
return
chartViewService
.
chartCopy
(
id
,
panelId
);
}
}
@ApiIgnore
@ApiIgnore
...
@@ -83,26 +101,21 @@ public class ChartViewController {
...
@@ -83,26 +101,21 @@ public class ChartViewController {
return
chartViewService
.
searchAdviceSceneId
(
panelId
);
return
chartViewService
.
searchAdviceSceneId
(
panelId
);
}
}
@ApiOperation
(
"根据权限查详情"
)
@PostMapping
(
"/getOneWithPermission/{id}"
)
public
ChartViewDTO
getOneWithPermission
(
@PathVariable
String
id
,
@RequestBody
ChartExtRequest
requestList
)
throws
Exception
{
//如果能获取用户 则添加对应的权限
ChartViewDTO
dto
=
chartViewService
.
getData
(
id
,
requestList
);
return
dto
;
}
@ApiOperation
(
"搜索"
)
@ApiOperation
(
"搜索"
)
@PostMapping
(
"search"
)
@PostMapping
(
"search"
)
public
List
<
ChartViewDTO
>
search
(
@RequestBody
ChartViewRequest
chartViewRequest
)
{
public
List
<
ChartViewDTO
>
search
(
@RequestBody
ChartViewRequest
chartViewRequest
)
{
return
chartViewService
.
search
(
chartViewRequest
);
return
chartViewService
.
search
(
chartViewRequest
);
}
}
@RequiresPermissions
(
"data:read"
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_VIEW
)
@ApiOperation
(
"计算结果"
)
@ApiOperation
(
"计算结果"
)
@PostMapping
(
"/calcData"
)
@PostMapping
(
"/calcData
/{panelId}
"
)
public
ChartViewDTO
calcData
(
@RequestBody
ChartCalRequest
request
)
throws
Exception
{
public
ChartViewDTO
calcData
(
@
PathVariable
String
panelId
,
@
RequestBody
ChartCalRequest
request
)
throws
Exception
{
return
chartViewService
.
calcData
(
request
.
getView
(),
request
.
getRequestList
(),
false
);
return
chartViewService
.
calcData
(
request
.
getView
(),
request
.
getRequestList
(),
false
);
}
}
@ApiIgnore
@ApiOperation
(
"验证视图是否使用相同数据集"
)
@ApiOperation
(
"验证视图是否使用相同数据集"
)
@GetMapping
(
"/checkSameDataSet/{viewIdSource}/{viewIdTarget}"
)
@GetMapping
(
"/checkSameDataSet/{viewIdSource}/{viewIdTarget}"
)
public
String
checkSameDataSet
(
@PathVariable
String
viewIdSource
,
@PathVariable
String
viewIdTarget
)
throws
Exception
{
public
String
checkSameDataSet
(
@PathVariable
String
viewIdSource
,
@PathVariable
String
viewIdTarget
)
throws
Exception
{
...
...
frontend/src/api/chart/chart.js
浏览文件 @
cc9a9619
...
@@ -9,16 +9,6 @@ export function post(url, data) {
...
@@ -9,16 +9,6 @@ export function post(url, data) {
})
})
}
}
export
function
ajaxGetData
(
id
,
data
)
{
return
request
({
url
:
'/chart/view/getOneWithPermission/'
+
id
,
method
:
'post'
,
loading
:
true
,
hideMsg
:
true
,
data
})
}
export
function
getChartTree
(
data
)
{
export
function
getChartTree
(
data
)
{
return
request
({
return
request
({
url
:
'api'
,
url
:
'api'
,
...
@@ -60,9 +50,9 @@ export function checkSameDataSet(viewIdSource, viewIdTarget) {
...
@@ -60,9 +50,9 @@ export function checkSameDataSet(viewIdSource, viewIdTarget) {
})
})
}
}
export
function
ajaxGetDataOnly
(
id
,
data
)
{
export
function
ajaxGetDataOnly
(
id
,
panelId
,
data
)
{
return
request
({
return
request
({
url
:
'/chart/view/getData/'
+
id
,
url
:
'/chart/view/getData/'
+
id
+
'/'
+
panelId
,
method
:
'post'
,
method
:
'post'
,
loading
:
true
,
loading
:
true
,
hideMsg
:
true
,
hideMsg
:
true
,
...
...
frontend/src/api/panel/panel.js
浏览文件 @
cc9a9619
...
@@ -56,9 +56,9 @@ export function groupTree(data, loading = true, timeout = 60000) {
...
@@ -56,9 +56,9 @@ export function groupTree(data, loading = true, timeout = 60000) {
})
})
}
}
export
function
viewData
(
id
,
data
)
{
export
function
viewData
(
id
,
panelId
,
data
)
{
return
request
({
return
request
({
url
:
'/chart/view/getData/'
+
id
,
url
:
'/chart/view/getData/'
+
id
+
'/'
+
panelId
,
method
:
'post'
,
method
:
'post'
,
hideMsg
:
true
,
hideMsg
:
true
,
data
data
...
...
frontend/src/components/canvas/custom-component/UserView.vue
浏览文件 @
cc9a9619
...
@@ -433,7 +433,7 @@ export default {
...
@@ -433,7 +433,7 @@ export default {
...
this
.
filter
,
...
this
.
filter
,
cache
:
cache
cache
:
cache
}
}
method
(
id
,
requestInfo
).
then
(
response
=>
{
method
(
id
,
this
.
panelInfo
.
id
,
requestInfo
).
then
(
response
=>
{
// 将视图传入echart组件
// 将视图传入echart组件
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
chart
=
response
.
data
this
.
chart
=
response
.
data
...
...
frontend/src/views/chart/group/Group.vue
浏览文件 @
cc9a9619
...
@@ -423,6 +423,9 @@ export default {
...
@@ -423,6 +423,9 @@ export default {
computed
:
{
computed
:
{
chartType
()
{
chartType
()
{
return
this
.
view
.
type
return
this
.
view
.
type
},
panelInfo
()
{
return
this
.
$store
.
state
.
panel
.
panelInfo
}
}
},
},
watch
:
{
watch
:
{
...
@@ -545,7 +548,7 @@ export default {
...
@@ -545,7 +548,7 @@ export default {
if
(
valid
)
{
if
(
valid
)
{
view
.
title
=
view
.
name
view
.
title
=
view
.
name
view
.
sceneId
=
view
.
pid
view
.
sceneId
=
view
.
pid
post
(
'/chart/view/save
'
,
view
).
then
(
response
=>
{
post
(
'/chart/view/save
/'
+
this
.
panelInfo
.
id
,
view
).
then
(
response
=>
{
this
.
closeTable
()
this
.
closeTable
()
this
.
$message
({
this
.
$message
({
message
:
this
.
$t
(
'dataset.save_success'
),
message
:
this
.
$t
(
'dataset.save_success'
),
...
@@ -772,7 +775,7 @@ export default {
...
@@ -772,7 +775,7 @@ export default {
view
.
extBubble
=
JSON
.
stringify
([])
view
.
extBubble
=
JSON
.
stringify
([])
this
.
setChartDefaultOptions
(
view
)
this
.
setChartDefaultOptions
(
view
)
const
_this
=
this
const
_this
=
this
post
(
'/chart/view/save
'
,
view
).
then
(
response
=>
{
post
(
'/chart/view/save
/'
+
this
.
panelInfo
.
id
,
view
).
then
(
response
=>
{
this
.
closeCreateChart
()
this
.
closeCreateChart
()
this
.
$store
.
dispatch
(
'chart/setTableId'
,
null
)
this
.
$store
.
dispatch
(
'chart/setTableId'
,
null
)
this
.
$store
.
dispatch
(
'chart/setTableId'
,
this
.
table
.
id
)
this
.
$store
.
dispatch
(
'chart/setTableId'
,
this
.
table
.
id
)
...
@@ -905,7 +908,7 @@ export default {
...
@@ -905,7 +908,7 @@ export default {
saveMoveDs
()
{
saveMoveDs
()
{
const
newSceneId
=
this
.
tDs
.
id
const
newSceneId
=
this
.
tDs
.
id
this
.
dsForm
.
sceneId
=
newSceneId
this
.
dsForm
.
sceneId
=
newSceneId
post
(
'/chart/view/save
'
,
this
.
dsForm
).
then
(
res
=>
{
post
(
'/chart/view/save
/'
+
this
.
panelInfo
.
id
,
this
.
dsForm
).
then
(
res
=>
{
this
.
closeMoveDs
()
this
.
closeMoveDs
()
this
.
expandedArray
.
push
(
newSceneId
)
this
.
expandedArray
.
push
(
newSceneId
)
this
.
treeNode
()
this
.
treeNode
()
...
...
frontend/src/views/chart/view/ChartEdit.vue
浏览文件 @
cc9a9619
...
@@ -1191,6 +1191,9 @@ export default {
...
@@ -1191,6 +1191,9 @@ export default {
computed
:
{
computed
:
{
chartType
()
{
chartType
()
{
return
this
.
chart
.
type
return
this
.
chart
.
type
},
panelInfo
()
{
return
this
.
$store
.
state
.
panel
.
panelInfo
}
}
},
},
watch
:
{
watch
:
{
...
@@ -1446,7 +1449,7 @@ export default {
...
@@ -1446,7 +1449,7 @@ export default {
this
.
hasEdit
=
true
this
.
hasEdit
=
true
const
view
=
this
.
buildParam
(
getData
,
trigger
,
needRefreshGroup
,
switchType
)
const
view
=
this
.
buildParam
(
getData
,
trigger
,
needRefreshGroup
,
switchType
)
if
(
!
view
)
return
if
(
!
view
)
return
post
(
'/chart/view/calcData
'
,
{
post
(
'/chart/view/calcData
/'
+
this
.
panelInfo
.
id
,
{
view
:
view
,
view
:
view
,
requestList
:
{
requestList
:
{
filter
:
[],
filter
:
[],
...
@@ -1509,7 +1512,7 @@ export default {
...
@@ -1509,7 +1512,7 @@ export default {
}
}
const
view
=
this
.
buildParam
(
true
,
'chart'
,
false
,
false
)
const
view
=
this
.
buildParam
(
true
,
'chart'
,
false
,
false
)
if
(
!
view
)
return
if
(
!
view
)
return
post
(
'/chart/view/save
'
,
view
).
then
(
response
=>
{
post
(
'/chart/view/save
/'
+
this
.
panelInfo
.
id
,
view
).
then
(
response
=>
{
this
.
getChart
(
response
.
data
.
id
)
this
.
getChart
(
response
.
data
.
id
)
this
.
hasEdit
=
false
this
.
hasEdit
=
false
this
.
refreshGroup
(
view
)
this
.
refreshGroup
(
view
)
...
@@ -1524,7 +1527,7 @@ export default {
...
@@ -1524,7 +1527,7 @@ export default {
getData
(
id
)
{
getData
(
id
)
{
this
.
hasEdit
=
false
this
.
hasEdit
=
false
if
(
id
)
{
if
(
id
)
{
ajaxGetDataOnly
(
id
,
{
ajaxGetDataOnly
(
id
,
this
.
panelInfo
.
id
,
{
filter
:
[],
filter
:
[],
drill
:
this
.
drillClickDimensionList
drill
:
this
.
drillClickDimensionList
}).
then
(
response
=>
{
}).
then
(
response
=>
{
...
@@ -1571,7 +1574,7 @@ export default {
...
@@ -1571,7 +1574,7 @@ export default {
},
},
getChart
(
id
)
{
getChart
(
id
)
{
if
(
id
)
{
if
(
id
)
{
post
(
'/chart/view/get/'
+
id
,
{}).
then
(
response
=>
{
post
(
'/chart/view/get/'
+
id
+
'/'
+
this
.
panelInfo
.
id
,
{}).
then
(
response
=>
{
this
.
initTableData
(
response
.
data
.
tableId
)
this
.
initTableData
(
response
.
data
.
tableId
)
this
.
view
=
JSON
.
parse
(
JSON
.
stringify
(
response
.
data
))
this
.
view
=
JSON
.
parse
(
JSON
.
stringify
(
response
.
data
))
this
.
view
.
xaxis
=
this
.
view
.
xaxis
?
JSON
.
parse
(
this
.
view
.
xaxis
)
:
[]
this
.
view
.
xaxis
=
this
.
view
.
xaxis
?
JSON
.
parse
(
this
.
view
.
xaxis
)
:
[]
...
...
frontend/src/views/dataset/common/DatasetChartDetail.vue
浏览文件 @
cc9a9619
...
@@ -122,6 +122,11 @@ export default {
...
@@ -122,6 +122,11 @@ export default {
info
:
{}
info
:
{}
}
}
},
},
computed
:
{
panelInfo
()
{
return
this
.
$store
.
state
.
panel
.
panelInfo
}
},
watch
:
{
watch
:
{
'data'
:
function
()
{
'data'
:
function
()
{
this
.
init
()
this
.
init
()
...
@@ -145,7 +150,7 @@ export default {
...
@@ -145,7 +150,7 @@ export default {
this
.
info
=
JSON
.
parse
(
res
.
data
.
table
.
info
)
this
.
info
=
JSON
.
parse
(
res
.
data
.
table
.
info
)
})
})
}
else
if
(
this
.
type
===
'chart'
)
{
}
else
if
(
this
.
type
===
'chart'
)
{
post
(
'/chart/view/chartDetail/'
+
this
.
data
.
id
,
null
).
then
(
res
=>
{
post
(
'/chart/view/chartDetail/'
+
this
.
data
.
id
+
'/'
+
this
.
panelInfo
.
id
,
null
).
then
(
res
=>
{
this
.
detail
=
res
.
data
this
.
detail
=
res
.
data
this
.
info
=
JSON
.
parse
(
res
.
data
.
table
.
info
)
this
.
info
=
JSON
.
parse
(
res
.
data
.
table
.
info
)
})
})
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论