Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
d1490753
Unverified
提交
d1490753
authored
4月 02, 2022
作者:
王嘉豪
提交者:
GitHub
4月 02, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2041 from dataease/pr@dev@refactor_check-view-title
refactor: 视图编辑时检验title是否重复
上级
77a5ba4b
71b3422e
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
113 行增加
和
60 行删除
+113
-60
ExtChartViewMapper.java
.../java/io/dataease/base/mapper/ext/ExtChartViewMapper.java
+3
-1
ExtChartViewMapper.xml
...n/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
+64
-51
ChartViewController.java
...ava/io/dataease/controller/chart/ChartViewController.java
+6
-0
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+12
-2
PanelViewService.java
...main/java/io/dataease/service/panel/PanelViewService.java
+2
-1
chart.js
frontend/src/api/chart/chart.js
+9
-0
en.js
frontend/src/lang/en.js
+1
-0
tw.js
frontend/src/lang/tw.js
+1
-0
zh.js
frontend/src/lang/zh.js
+1
-0
TitleSelector.vue
.../views/chart/components/component-style/TitleSelector.vue
+13
-4
ChartEdit.vue
frontend/src/views/chart/view/ChartEdit.vue
+1
-1
没有找到文件。
backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java
浏览文件 @
d1490753
...
...
@@ -39,7 +39,7 @@ public interface ExtChartViewMapper {
void
copyToCache
(
@Param
(
"id"
)
String
id
);
void
deleteCacheWithPanel
(
@Param
(
"panelId"
)
String
panelId
);
void
deleteCacheWithPanel
(
@Param
(
"
viewIds"
)
List
<
String
>
viewIds
,
@Param
(
"
panelId"
)
String
panelId
);
void
deleteViewCache
(
@Param
(
"viewId"
)
String
viewId
);
...
...
@@ -48,4 +48,6 @@ public interface ExtChartViewMapper {
int
updateToCache
(
@Param
(
"viewId"
)
String
viewId
);
void
copyCache
(
@Param
(
"sourceViewId"
)
String
sourceViewId
,
@Param
(
"newViewId"
)
String
newViewId
);
void
deleteNoUseView
(
@Param
(
"viewIds"
)
List
<
String
>
viewIds
,
@Param
(
"panelId"
)
String
panelId
);
}
backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
浏览文件 @
d1490753
...
...
@@ -152,23 +152,23 @@
chart_view_cache.id = #{sourceViewId}
</insert>
<!-- <select id="searchOne" resultMap="BaseResultMapDTO">-->
<!-- select-->
<!-- id, `name`, scene_id, table_id, `type`, title, create_by, create_time, update_time,-->
<!-- style_priority,x_axis, y_axis, custom_attr, custom_style, custom_filter, snapshot-->
<!-- from chart_view-->
<!-- <where>-->
<!-- <if test="sceneId != null">-->
<!-- and scene_id = #{sceneId,jdbcType=VARCHAR}-->
<!-- </if>-->
<!-- <if test="id != null">-->
<!-- and id = #{id,jdbcType=VARCHAR}-->
<!-- </if>-->
<!-- </where>-->
<!-- <if test="sort != null">-->
<!-- order by ${sort}-->
<!-- </if>-->
<!-- </select>-->
<!-- <select id="searchOne" resultMap="BaseResultMapDTO">-->
<!-- select-->
<!-- id, `name`, scene_id, table_id, `type`, title, create_by, create_time, update_time,-->
<!-- style_priority,x_axis, y_axis, custom_attr, custom_style, custom_filter, snapshot-->
<!-- from chart_view-->
<!-- <where>-->
<!-- <if test="sceneId != null">-->
<!-- and scene_id = #{sceneId,jdbcType=VARCHAR}-->
<!-- </if>-->
<!-- <if test="id != null">-->
<!-- and id = #{id,jdbcType=VARCHAR}-->
<!-- </if>-->
<!-- </where>-->
<!-- <if test="sort != null">-->
<!-- order by ${sort}-->
<!-- </if>-->
<!-- </select>-->
<select
id=
"search"
resultMap=
"BaseResultMapDTO"
>
select
...
...
@@ -407,7 +407,7 @@
</delete>
<select
id=
"searchViewsWithPanelId"
resultMap=
"BaseResultMapDTO"
>
<select
id=
"searchViewsWithPanelId"
resultMap=
"BaseResultMapDTO"
>
SELECT * FROM chart_view
WHERE
id IN (
...
...
@@ -421,12 +421,14 @@
</select>
<delete
id=
"deleteCacheWithPanel"
>
DELETE cvc
FROM
chart_view_cache cvc
INNER JOIN panel_view pv ON cvc.id = pv.chart_view_id
WHERE
pv.panel_id = #{panelId}
delete from chart_view_cache
where scene_id = #{panelId}
<if
test=
"viewIds != null and viewIds.size() > 0"
>
and id not in
<foreach
collection=
"viewIds"
item=
"viewId"
open=
'('
separator=
','
close=
')'
>
#{viewId}
</foreach>
</if>
</delete>
<delete
id=
"deleteViewCache"
>
delete from chart_view_cache where id = #{viewId}
...
...
@@ -434,35 +436,35 @@
<update
id=
"copyCacheToView"
>
UPDATE chart_view cv,
chart_view_cache cve
SET cv.`name` = cve.`name`,
cv.title = cve.title,
cv.scene_id = cve.scene_id,
cv.table_id = cve.table_id,
cv.`type` = cve.`type`,
cv.render = cve.render,
cv.result_count = cve.result_count,
cv.result_mode = cve.result_mode,
cv.create_by = cve.create_by,
cv.create_time = cve.create_time,
cv.update_time = cve.update_time,
cv.style_priority = cve.style_priority,
cv.chart_type = cve.chart_type,
cv.is_plugin = cve.is_plugin,
cv.x_axis = cve.x_axis,
cv.x_axis_ext = cve.x_axis_ext,
cv.y_axis = cve.y_axis,
cv.y_axis_ext = cve.y_axis_ext,
cv.ext_stack = cve.ext_stack,
cv.ext_bubble = cve.ext_bubble,
cv.custom_attr = cve.custom_attr,
cv.custom_style = cve.custom_style,
cv.custom_filter = cve.custom_filter,
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
chart_view_cache cve
SET cv.`name` = cve.`name`,
cv.title = cve.title,
cv.scene_id = cve.scene_id,
cv.table_id = cve.table_id,
cv.`type` = cve.`type`,
cv.render = cve.render,
cv.result_count = cve.result_count,
cv.result_mode = cve.result_mode,
cv.create_by = cve.create_by,
cv.create_time = cve.create_time,
cv.update_time = cve.update_time,
cv.style_priority = cve.style_priority,
cv.chart_type = cve.chart_type,
cv.is_plugin = cve.is_plugin,
cv.x_axis = cve.x_axis,
cv.x_axis_ext = cve.x_axis_ext,
cv.y_axis = cve.y_axis,
cv.y_axis_ext = cve.y_axis_ext,
cv.ext_stack = cve.ext_stack,
cv.ext_bubble = cve.ext_bubble,
cv.custom_attr = cve.custom_attr,
cv.custom_style = cve.custom_style,
cv.custom_filter = cve.custom_filter,
cv.drill_fields = cve.drill_fields,
cv.senior = cve.senior,
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from
where cve.id = cv.id
and cv.id in
where cve.id = cv.id and cv.id in
<foreach
collection=
"viewIds"
item=
"viewId"
open=
'('
separator=
','
close=
')'
>
#{viewId}
</foreach>
...
...
@@ -500,4 +502,15 @@
cv.data_from = cve.data_from
where cve.id = cv.id and cv.id =#{viewId}
</update>
<delete
id=
"deleteNoUseView"
>
delete from chart_view
where scene_id = #{panelId}
<if
test=
"viewIds != null and viewIds.size() > 0"
>
and id not in
<foreach
collection=
"viewIds"
item=
"viewId"
open=
'('
separator=
','
close=
')'
>
#{viewId}
</foreach>
</if>
</delete>
</mapper>
backend/src/main/java/io/dataease/controller/chart/ChartViewController.java
浏览文件 @
d1490753
...
...
@@ -155,4 +155,10 @@ public class ChartViewController {
chartViewCacheService
.
refreshCache
(
id
);
}
@ApiOperation
(
"校验视图Title"
)
@PostMapping
(
"/checkTitle"
)
public
String
checkTitle
(
@RequestBody
ChartViewCacheRequest
request
)
{
return
chartViewService
.
checkTitle
(
request
);
}
}
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
d1490753
...
...
@@ -115,6 +115,16 @@ public class ChartViewService {
return
getOne
(
chartView
.
getId
(),
"panel_edit"
);
}
public
String
checkTitle
(
ChartViewCacheRequest
chartView
){
ChartViewCacheExample
example
=
new
ChartViewCacheExample
();
example
.
createCriteria
().
andTitleEqualTo
(
chartView
.
getTitle
()).
andSceneIdEqualTo
(
chartView
.
getSceneId
()).
andIdNotEqualTo
(
chartView
.
getId
());
List
<
ChartViewCache
>
result
=
chartViewCacheMapper
.
selectByExample
(
example
);
if
(
CollectionUtils
.
isNotEmpty
(
result
)){
return
"fail"
;
}
else
{
return
"success"
;
}
}
public
ChartViewWithBLOBs
newOne
(
ChartViewWithBLOBs
chartView
)
{
long
timestamp
=
System
.
currentTimeMillis
();
...
...
@@ -1030,7 +1040,7 @@ public class ChartViewService {
extChartViewMapper
.
chartCopy
(
newChartId
,
id
,
panelId
);
extChartViewMapper
.
copyCache
(
id
,
newChartId
);
extPanelGroupExtendDataMapper
.
copyExtendData
(
id
,
newChartId
,
panelId
);
chartViewCacheService
.
refreshCache
(
i
d
);
chartViewCacheService
.
refreshCache
(
newChartI
d
);
return
newChartId
;
}
...
...
@@ -1061,7 +1071,7 @@ public class ChartViewService {
}
public
void
initViewCache
(
String
panelId
)
{
extChartViewMapper
.
deleteCacheWithPanel
(
panelId
);
extChartViewMapper
.
deleteCacheWithPanel
(
null
,
panelId
);
}
}
backend/src/main/java/io/dataease/service/panel/PanelViewService.java
浏览文件 @
d1490753
...
...
@@ -127,9 +127,10 @@ public class PanelViewService {
//将视图从cache表中更新到正式表中
viewIds
=
panelViewInsertDTOList
.
stream
().
map
(
panelView
->
panelView
.
getChartViewId
()).
collect
(
Collectors
.
toList
());
extChartViewMapper
.
copyCacheToView
(
viewIds
);
extChartViewMapper
.
deleteCacheWithPanel
(
panelId
);
}
}
extChartViewMapper
.
deleteCacheWithPanel
(
viewIds
,
panelId
);
extChartViewMapper
.
deleteNoUseView
(
viewIds
,
panelId
);
panelGroup
.
setMobileLayout
(
mobileLayout
);
return
viewIds
;
}
...
...
frontend/src/api/chart/chart.js
浏览文件 @
d1490753
...
...
@@ -108,3 +108,12 @@ export function resetViewCache(viewId, panelId) {
loading
:
false
})
}
export
function
checkTitle
(
data
)
{
return
request
({
url
:
'/chart/view/checkTitle'
,
method
:
'post'
,
data
:
data
,
loading
:
false
})
}
frontend/src/lang/en.js
浏览文件 @
d1490753
...
...
@@ -653,6 +653,7 @@ export default {
kettle_setting
:
'Kettle Setting'
},
chart
:
{
title_repeat
:
'The Title Already Exist'
,
save_snapshot
:
'Save Snapshot'
,
datalist
:
'Chart'
,
add_group
:
'Add Group'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
d1490753
...
...
@@ -655,6 +655,7 @@ export default {
kettle_setting
:
'Kettle 設置'
},
chart
:
{
title_repeat
:
'当前标题已存在'
,
save_snapshot
:
'保存縮略圖'
,
datalist
:
'視圖'
,
add_group
:
'添加分組'
,
...
...
frontend/src/lang/zh.js
浏览文件 @
d1490753
...
...
@@ -656,6 +656,7 @@ export default {
kettle_setting
:
'Kettle 设置'
},
chart
:
{
title_repeat
:
'当前标题已存在'
,
save_snapshot
:
'保存缩略图'
,
datalist
:
'视图'
,
add_group
:
'添加分组'
,
...
...
frontend/src/views/chart/components/component-style/TitleSelector.vue
浏览文件 @
d1490753
...
...
@@ -50,6 +50,7 @@
<
script
>
import
{
COLOR_PANEL
,
DEFAULT_TITLE_STYLE
}
from
'../../chart/chart'
import
{
checkTitle
}
from
'@/api/chart/chart'
export
default
{
name
:
'TitleSelector'
,
...
...
@@ -114,10 +115,18 @@ export default {
this
.
titleForm
.
title
=
this
.
chart
.
title
return
}
if
(
!
this
.
titleForm
.
show
)
{
this
.
isSetting
=
false
}
this
.
$emit
(
'onTextChange'
,
this
.
titleForm
)
checkTitle
({
id
:
this
.
chart
.
id
,
title
:
this
.
titleForm
.
title
,
sceneId
:
this
.
chart
.
sceneId
}).
then
((
rsp
)
=>
{
if
(
rsp
.
data
===
'success'
)
{
if
(
!
this
.
titleForm
.
show
)
{
this
.
isSetting
=
false
}
this
.
$emit
(
'onTextChange'
,
this
.
titleForm
)
}
else
{
this
.
$error
(
this
.
$t
(
'chart.title_repeat'
))
this
.
titleForm
.
title
=
this
.
chart
.
title
return
}
})
},
inputOnInput
:
function
(
e
)
{
this
.
$forceUpdate
()
...
...
frontend/src/views/chart/view/ChartEdit.vue
浏览文件 @
d1490753
...
...
@@ -877,7 +877,7 @@
@
onLegendChange=
"onLegendChange"
/>
</el-collapse-item>
<el-collapse-item
v-if=
"chart.customStyle &&
chart
.customStyle.background"
name=
"background"
:title=
"$t('chart.background')"
>
<el-collapse-item
v-if=
"chart.customStyle &&
view
.customStyle.background"
name=
"background"
:title=
"$t('chart.background')"
>
<background-color-selector
:param=
"param"
class=
"attr-selector"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论