Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
4ea6c83f
提交
4ea6c83f
authored
4月 20, 2022
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 优化视图标题校验
上级
162b51ee
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
58 行增加
和
21 行删除
+58
-21
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+0
-7
UserView.vue
frontend/src/components/canvas/custom-component/UserView.vue
+7
-1
utils.js
frontend/src/components/canvas/utils/utils.js
+23
-0
index.js
frontend/src/store/index.js
+6
-0
TitleSelector.vue
.../views/chart/components/component-style/TitleSelector.vue
+10
-13
Group.vue
frontend/src/views/chart/group/Group.vue
+10
-0
index.vue
frontend/src/views/panel/edit/index.vue
+2
-0
没有找到文件。
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
4ea6c83f
...
@@ -128,13 +128,6 @@ public class ChartViewService {
...
@@ -128,13 +128,6 @@ public class ChartViewService {
public
ChartViewWithBLOBs
newOne
(
ChartViewWithBLOBs
chartView
)
{
public
ChartViewWithBLOBs
newOne
(
ChartViewWithBLOBs
chartView
)
{
long
timestamp
=
System
.
currentTimeMillis
();
long
timestamp
=
System
.
currentTimeMillis
();
// 校验名称
ChartViewExample
queryExample
=
new
ChartViewExample
();
queryExample
.
createCriteria
().
andSceneIdEqualTo
(
chartView
.
getSceneId
()).
andNameEqualTo
(
chartView
.
getName
());
List
<
ChartView
>
result
=
chartViewMapper
.
selectByExample
(
queryExample
);
if
(
CollectionUtils
.
isNotEmpty
(
result
))
{
DEException
.
throwException
(
Translator
.
get
(
"theme_name_repeat"
));
}
chartView
.
setUpdateTime
(
timestamp
);
chartView
.
setUpdateTime
(
timestamp
);
chartView
.
setId
(
UUID
.
randomUUID
().
toString
());
chartView
.
setId
(
UUID
.
randomUUID
().
toString
());
chartView
.
setCreateBy
(
AuthUtils
.
getUser
().
getUsername
());
chartView
.
setCreateBy
(
AuthUtils
.
getUser
().
getUsername
());
...
...
frontend/src/components/canvas/custom-component/UserView.vue
浏览文件 @
4ea6c83f
...
@@ -291,7 +291,8 @@ export default {
...
@@ -291,7 +291,8 @@ export default {
'previewCanvasScale'
,
'previewCanvasScale'
,
'mobileLayoutStatus'
,
'mobileLayoutStatus'
,
'componentData'
,
'componentData'
,
'panelViewDetailsInfo'
'panelViewDetailsInfo'
,
'componentViewsData'
])
])
},
},
...
@@ -478,6 +479,11 @@ export default {
...
@@ -478,6 +479,11 @@ export default {
// 将视图传入echart组件
// 将视图传入echart组件
if
(
response
.
success
)
{
if
(
response
.
success
)
{
this
.
chart
=
response
.
data
this
.
chart
=
response
.
data
if
(
this
.
isEdit
)
{
this
.
componentViewsData
[
this
.
chart
.
id
]
=
{
'title'
:
this
.
chart
.
title
}
}
this
.
chart
[
'position'
]
=
this
.
inTab
?
'tab'
:
'panel'
this
.
chart
[
'position'
]
=
this
.
inTab
?
'tab'
:
'panel'
// 记录当前数据
// 记录当前数据
this
.
panelViewDetailsInfo
[
id
]
=
JSON
.
stringify
(
this
.
chart
)
this
.
panelViewDetailsInfo
[
id
]
=
JSON
.
stringify
(
this
.
chart
)
...
...
frontend/src/components/canvas/utils/utils.js
浏览文件 @
4ea6c83f
...
@@ -133,3 +133,26 @@ export function matrixBaseChange(component) {
...
@@ -133,3 +133,26 @@ export function matrixBaseChange(component) {
return
component
return
component
}
}
export
function
checkViewTitle
(
opt
,
id
,
tile
)
{
try
{
const
curPanelViewsData
=
store
.
state
.
componentViewsData
const
curComponentViewNames
=
[]
store
.
state
.
componentData
.
forEach
(
item
=>
{
if
(
item
.
type
===
'view'
&&
item
.
propValue
&&
item
.
propValue
.
viewId
)
{
// 更新时自己的title不加入比较
if
((
opt
===
'update'
&&
id
!==
item
.
propValue
.
viewId
)
||
opt
===
'new'
)
{
curComponentViewNames
.
push
(
curPanelViewsData
[
item
.
propValue
.
viewId
].
title
)
}
}
})
if
(
curComponentViewNames
.
includes
(
tile
))
{
return
true
}
else
{
return
false
}
}
catch
(
e
)
{
console
.
log
(
'checkViewTitle error'
,
e
)
return
false
}
}
frontend/src/store/index.js
浏览文件 @
4ea6c83f
...
@@ -50,6 +50,8 @@ const data = {
...
@@ -50,6 +50,8 @@ const data = {
componentDataCache
:
null
,
componentDataCache
:
null
,
// 当前展示画布组件数据
// 当前展示画布组件数据
componentData
:
[],
componentData
:
[],
// 当前展示画布视图信息
componentViewsData
:
{},
// PC布局画布组件数据
// PC布局画布组件数据
pcComponentData
:
[],
pcComponentData
:
[],
// 移动端布局画布组件数据
// 移动端布局画布组件数据
...
@@ -180,6 +182,10 @@ const data = {
...
@@ -180,6 +182,10 @@ const data = {
Vue
.
set
(
state
,
'componentData'
,
componentData
)
Vue
.
set
(
state
,
'componentData'
,
componentData
)
},
},
setComponentViewsData
(
state
,
componentViewsData
=
{})
{
Vue
.
set
(
state
,
'componentViewsData'
,
componentViewsData
)
},
setPcComponentData
(
state
,
pcComponentData
=
[])
{
setPcComponentData
(
state
,
pcComponentData
=
[])
{
Vue
.
set
(
state
,
'pcComponentData'
,
pcComponentData
)
Vue
.
set
(
state
,
'pcComponentData'
,
pcComponentData
)
},
},
...
...
frontend/src/views/chart/components/component-style/TitleSelector.vue
浏览文件 @
4ea6c83f
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
<
script
>
<
script
>
import
{
COLOR_PANEL
,
DEFAULT_TITLE_STYLE
}
from
'../../chart/chart'
import
{
COLOR_PANEL
,
DEFAULT_TITLE_STYLE
}
from
'../../chart/chart'
import
{
check
Title
}
from
'@/api/chart/chart
'
import
{
check
ViewTitle
}
from
'@/components/canvas/utils/utils
'
export
default
{
export
default
{
name
:
'TitleSelector'
,
name
:
'TitleSelector'
,
...
@@ -115,18 +115,15 @@ export default {
...
@@ -115,18 +115,15 @@ export default {
this
.
titleForm
.
title
=
this
.
chart
.
title
this
.
titleForm
.
title
=
this
.
chart
.
title
return
return
}
}
checkTitle
({
id
:
this
.
chart
.
id
,
title
:
this
.
titleForm
.
title
,
sceneId
:
this
.
chart
.
sceneId
}).
then
((
rsp
)
=>
{
if
(
checkViewTitle
(
'update'
,
this
.
chart
.
id
,
this
.
titleForm
.
title
))
{
if
(
rsp
.
data
===
'success'
)
{
this
.
$error
(
this
.
$t
(
'chart.title_repeat'
))
if
(
!
this
.
titleForm
.
show
)
{
this
.
titleForm
.
title
=
this
.
chart
.
title
this
.
isSetting
=
false
return
}
}
this
.
$emit
(
'onTextChange'
,
this
.
titleForm
)
if
(
!
this
.
titleForm
.
show
)
{
}
else
{
this
.
isSetting
=
false
this
.
$error
(
this
.
$t
(
'chart.title_repeat'
))
}
this
.
titleForm
.
title
=
this
.
chart
.
title
this
.
$emit
(
'onTextChange'
,
this
.
titleForm
)
return
}
})
},
},
inputOnInput
:
function
(
e
)
{
inputOnInput
:
function
(
e
)
{
this
.
$forceUpdate
()
this
.
$forceUpdate
()
...
...
frontend/src/views/chart/group/Group.vue
浏览文件 @
4ea6c83f
...
@@ -314,6 +314,7 @@ import {
...
@@ -314,6 +314,7 @@ import {
DEFAULT_THRESHOLD
,
DEFAULT_THRESHOLD
,
DEFAULT_TOTAL
DEFAULT_TOTAL
}
from
'../chart/chart'
}
from
'../chart/chart'
import
{
checkViewTitle
}
from
'@/components/canvas/utils/utils'
export
default
{
export
default
{
name
:
'Group'
,
name
:
'Group'
,
...
@@ -772,6 +773,15 @@ export default {
...
@@ -772,6 +773,15 @@ export default {
})
})
return
return
}
}
if
(
checkViewTitle
(
'new'
,
null
,
this
.
chartName
))
{
this
.
$message
({
showClose
:
true
,
message
:
this
.
$t
(
'chart.title_repeat'
),
type
:
'error'
})
return
}
const
view
=
{}
const
view
=
{}
view
.
name
=
this
.
chartName
view
.
name
=
this
.
chartName
view
.
title
=
this
.
chartName
view
.
title
=
this
.
chartName
...
...
frontend/src/views/panel/edit/index.vue
浏览文件 @
4ea6c83f
...
@@ -661,6 +661,8 @@ export default {
...
@@ -661,6 +661,8 @@ export default {
initPanelData
(
panelId
,
function
()
{
initPanelData
(
panelId
,
function
()
{
// 初始化视图缓存
// 初始化视图缓存
initViewCache
(
panelId
)
initViewCache
(
panelId
)
// 初始化记录的视图信息
_this
.
$store
.
commit
(
'setComponentViewsData'
)
// 初始化保存状态
// 初始化保存状态
setTimeout
(()
=>
{
setTimeout
(()
=>
{
_this
.
$store
.
commit
(
'refreshSaveStatus'
)
_this
.
$store
.
commit
(
'refreshSaveStatus'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论