Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
2feb5138
提交
2feb5138
authored
3月 15, 2022
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 从模板新建的仪表板支持查看模板缓存数据
上级
558dfa7d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
28 行增加
和
7 行删除
+28
-7
ChartViewController.java
...ava/io/dataease/controller/chart/ChartViewController.java
+5
-1
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+17
-4
PanelGroupService.java
...ain/java/io/dataease/service/panel/PanelGroupService.java
+4
-1
ChartEdit.vue
frontend/src/views/chart/view/ChartEdit.vue
+2
-1
没有找到文件。
backend/src/main/java/io/dataease/controller/chart/ChartViewController.java
浏览文件 @
2feb5138
...
@@ -14,6 +14,7 @@ import io.dataease.controller.request.chart.ChartViewRequest;
...
@@ -14,6 +14,7 @@ import io.dataease.controller.request.chart.ChartViewRequest;
import
io.dataease.controller.response.ChartDetail
;
import
io.dataease.controller.response.ChartDetail
;
import
io.dataease.dto.chart.ChartViewDTO
;
import
io.dataease.dto.chart.ChartViewDTO
;
import
io.dataease.service.chart.ChartViewService
;
import
io.dataease.service.chart.ChartViewService
;
import
io.dataease.service.panel.PanelViewService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -33,6 +34,8 @@ import java.util.List;
...
@@ -33,6 +34,8 @@ import java.util.List;
public
class
ChartViewController
{
public
class
ChartViewController
{
@Resource
@Resource
private
ChartViewService
chartViewService
;
private
ChartViewService
chartViewService
;
@Resource
private
PanelViewService
panelViewService
;
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_MANAGE
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_MANAGE
)
@ApiOperation
(
"保存"
)
@ApiOperation
(
"保存"
)
...
@@ -73,7 +76,8 @@ public class ChartViewController {
...
@@ -73,7 +76,8 @@ public class ChartViewController {
@ApiOperation
(
"详细信息"
)
@ApiOperation
(
"详细信息"
)
@PostMapping
(
"/get/{id}/{panelId}"
)
@PostMapping
(
"/get/{id}/{panelId}"
)
public
ChartViewDTO
get
(
@PathVariable
String
id
,
@PathVariable
String
panelId
,
@RequestBody
ChartViewRequest
viewRequest
)
{
public
ChartViewDTO
get
(
@PathVariable
String
id
,
@PathVariable
String
panelId
,
@RequestBody
ChartViewRequest
viewRequest
)
{
return
chartViewService
.
getOne
(
id
,
viewRequest
.
getQueryFrom
());
String
dataFrom
=
panelViewService
.
findViewDataFrom
(
id
);
return
chartViewService
.
getOne
(
id
,
viewRequest
.
getQueryFrom
(),
dataFrom
);
}
}
@ApiIgnore
@ApiIgnore
...
...
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
2feb5138
...
@@ -233,18 +233,32 @@ public class ChartViewService {
...
@@ -233,18 +233,32 @@ public class ChartViewService {
return
extChartViewMapper
.
searchOneWithPrivileges
(
userId
,
id
);
return
extChartViewMapper
.
searchOneWithPrivileges
(
userId
,
id
);
}
}
@Transactional
public
ChartViewDTO
getOne
(
String
id
,
String
queryFrom
)
{
public
ChartViewDTO
getOne
(
String
id
,
String
queryFrom
)
{
return
getOne
(
id
,
queryFrom
,
CommonConstants
.
VIEW_DATA_FROM
.
CHART
);
}
@Transactional
public
ChartViewDTO
getOne
(
String
id
,
String
queryFrom
,
String
dataFrom
)
{
ChartViewDTO
result
;
ChartViewDTO
result
;
//仪表板编辑页面 从缓存表中取数据 缓存表中没有数据则进行插入
//从模板中去数据
if
(
CommonConstants
.
VIEW_QUERY_FROM
.
PANEL_EDIT
.
equals
(
queryFrom
))
{
if
(
CommonConstants
.
VIEW_DATA_FROM
.
TEMPLATE
.
equals
(
dataFrom
)){
result
=
extendDataService
.
getChartInfo
(
id
);
if
(
result
!=
null
){
result
.
setData
(
null
);
}
}
else
if
(
CommonConstants
.
VIEW_QUERY_FROM
.
PANEL_EDIT
.
equals
(
queryFrom
))
{
//仪表板编辑页面 从缓存表中取数据 缓存表中没有数据则进行插入
result
=
extChartViewMapper
.
searchOneFromCache
(
id
);
result
=
extChartViewMapper
.
searchOneFromCache
(
id
);
if
(
result
==
null
)
{
if
(
result
==
null
)
{
extChartViewMapper
.
copyToCache
(
id
);
extChartViewMapper
.
copyToCache
(
id
);
result
=
extChartViewMapper
.
searchOneFromCache
(
id
);
result
=
extChartViewMapper
.
searchOneFromCache
(
id
);
}
}
result
.
setDataFrom
(
CommonConstants
.
VIEW_DATA_FROM
.
CHART
);
}
else
{
}
else
{
result
=
extChartViewMapper
.
searchOne
(
id
);
result
=
extChartViewMapper
.
searchOne
(
id
);
result
.
setDataFrom
(
CommonConstants
.
VIEW_DATA_FROM
.
CHART
);
}
}
return
result
;
return
result
;
}
}
...
@@ -266,7 +280,6 @@ public class ChartViewService {
...
@@ -266,7 +280,6 @@ public class ChartViewService {
if
(
CommonConstants
.
VIEW_DATA_FROM
.
TEMPLATE
.
equals
(
dataFrom
)){
if
(
CommonConstants
.
VIEW_DATA_FROM
.
TEMPLATE
.
equals
(
dataFrom
)){
return
extendDataService
.
getChartInfo
(
id
);
return
extendDataService
.
getChartInfo
(
id
);
}
else
{
// 从视图读取数据
}
else
{
// 从视图读取数据
ChartViewDTO
view
=
this
.
getOne
(
id
,
request
.
getQueryFrom
());
ChartViewDTO
view
=
this
.
getOne
(
id
,
request
.
getQueryFrom
());
view
.
setDataFrom
(
dataFrom
);
view
.
setDataFrom
(
dataFrom
);
// 如果是从仪表板获取视图数据,则仪表板的查询模式,查询结果的数量,覆盖视图对应的属性
// 如果是从仪表板获取视图数据,则仪表板的查询模式,查询结果的数量,覆盖视图对应的属性
...
...
backend/src/main/java/io/dataease/service/panel/PanelGroupService.java
浏览文件 @
2feb5138
package
io
.
dataease
.
service
.
panel
;
package
io
.
dataease
.
service
.
panel
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
io.dataease.auth.annotation.DeCleaner
;
import
io.dataease.auth.annotation.DeCleaner
;
import
io.dataease.base.domain.*
;
import
io.dataease.base.domain.*
;
import
io.dataease.base.mapper.*
;
import
io.dataease.base.mapper.*
;
...
@@ -323,10 +324,12 @@ public class PanelGroupService {
...
@@ -323,10 +324,12 @@ public class PanelGroupService {
Map
<
String
,
String
>
dynamicDataMap
=
JSON
.
parseObject
(
dynamicData
,
Map
.
class
);
Map
<
String
,
String
>
dynamicDataMap
=
JSON
.
parseObject
(
dynamicData
,
Map
.
class
);
List
<
PanelViewInsertDTO
>
panelViews
=
new
ArrayList
<>();
List
<
PanelViewInsertDTO
>
panelViews
=
new
ArrayList
<>();
List
<
PanelGroupExtendDataDTO
>
viewsData
=
new
ArrayList
<>();
List
<
PanelGroupExtendDataDTO
>
viewsData
=
new
ArrayList
<>();
List
<
ChartViewWithBLOBs
>
chartViews
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
String
>
entry
:
dynamicDataMap
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
String
>
entry
:
dynamicDataMap
.
entrySet
()){
String
originViewId
=
entry
.
getKey
();
String
originViewId
=
entry
.
getKey
();
String
originViewData
=
entry
.
getValue
();
String
originViewData
=
entry
.
getValue
();
String
position
=
JSON
.
parseObject
(
originViewData
).
getString
(
"position"
);
JSONObject
chartViewJson
=
JSON
.
parseObject
(
originViewData
);
String
position
=
chartViewJson
.
getString
(
"position"
);
String
newViewId
=
UUIDUtil
.
getUUIDAsString
();
String
newViewId
=
UUIDUtil
.
getUUIDAsString
();
//TODO 数据处理 1.替换viewId 2.加入panelView 数据(数据来源为template) 3.加入模板view data数据
//TODO 数据处理 1.替换viewId 2.加入panelView 数据(数据来源为template) 3.加入模板view data数据
templateData
=
templateData
.
replaceAll
(
originViewId
,
newViewId
);
templateData
=
templateData
.
replaceAll
(
originViewId
,
newViewId
);
...
...
frontend/src/views/chart/view/ChartEdit.vue
浏览文件 @
2feb5138
...
@@ -1788,7 +1788,7 @@ export default {
...
@@ -1788,7 +1788,7 @@ export default {
getChart
(
id
,
queryFrom
=
'panel_edit'
)
{
getChart
(
id
,
queryFrom
=
'panel_edit'
)
{
if
(
id
)
{
if
(
id
)
{
getChartDetails
(
id
,
this
.
panelInfo
.
id
,
{
queryFrom
:
queryFrom
}).
then
(
response
=>
{
getChartDetails
(
id
,
this
.
panelInfo
.
id
,
{
queryFrom
:
queryFrom
}).
then
(
response
=>
{
this
.
initTableData
(
response
.
data
.
tableId
)
response
.
data
.
dataFrom
!==
'template'
&&
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
)
:
[]
this
.
view
.
xaxisExt
=
this
.
view
.
xaxisExt
?
JSON
.
parse
(
this
.
view
.
xaxisExt
)
:
[]
this
.
view
.
xaxisExt
=
this
.
view
.
xaxisExt
?
JSON
.
parse
(
this
.
view
.
xaxisExt
)
:
[]
...
@@ -2150,6 +2150,7 @@ export default {
...
@@ -2150,6 +2150,7 @@ export default {
// this.save(true, 'chart', false)
// this.save(true, 'chart', false)
this
.
calcData
(
true
,
'chart'
,
false
)
this
.
calcData
(
true
,
'chart'
,
false
)
this
.
initTableData
(
this
.
view
.
tableId
)
this
.
initTableData
(
this
.
view
.
tableId
)
this
.
closeChangeChart
()
},
},
fieldFilter
(
val
)
{
fieldFilter
(
val
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论