Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
2fc2bb1f
提交
2fc2bb1f
authored
6月 29, 2021
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 仪表板编辑时可以进行视图的复制,复制后的视图样式等改变不影响原有视图
上级
b00d779f
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
101 行增加
和
2 行删除
+101
-2
ExtChartViewMapper.java
.../java/io/dataease/base/mapper/ext/ExtChartViewMapper.java
+2
-0
ExtChartViewMapper.xml
...n/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
+41
-0
ChartViewController.java
...ava/io/dataease/controller/chart/ChartViewController.java
+5
-0
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+6
-0
V9__chart_view_copy.sql
...d/src/main/resources/db/migration/V9__chart_view_copy.sql
+25
-0
chart.js
frontend/src/api/chart/chart.js
+8
-0
ContextMenu.vue
...d/src/components/canvas/components/Editor/ContextMenu.vue
+1
-1
copy.js
frontend/src/components/canvas/store/copy.js
+13
-1
没有找到文件。
backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java
浏览文件 @
2fc2bb1f
...
@@ -12,6 +12,8 @@ import java.util.List;
...
@@ -12,6 +12,8 @@ import java.util.List;
public
interface
ExtChartViewMapper
{
public
interface
ExtChartViewMapper
{
List
<
ChartViewDTO
>
search
(
ChartViewRequest
request
);
List
<
ChartViewDTO
>
search
(
ChartViewRequest
request
);
void
chartCopy
(
@Param
(
"newChartId"
)
String
newChartId
,
@Param
(
"oldChartId"
)
String
oldChartId
);
@Select
(
"select id from chart_view where table_id = #{tableId}"
)
@Select
(
"select id from chart_view where table_id = #{tableId}"
)
List
<
String
>
allViewIds
(
@Param
(
"tableId"
)
String
tableId
);
List
<
String
>
allViewIds
(
@Param
(
"tableId"
)
String
tableId
);
}
}
backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml
浏览文件 @
2fc2bb1f
...
@@ -27,4 +27,45 @@
...
@@ -27,4 +27,45 @@
</select>
</select>
<insert
id=
"chartCopy"
>
INSERT INTO chart_view (
`id`,
`name`,
`scene_id`,
`table_id`,
`type`,
`title`,
`x_axis`,
`y_axis`,
`custom_attr`,
`custom_style`,
`custom_filter`,
`create_by`,
`create_time`,
`update_time`,
`snapshot`,
`style_priority`
) SELECT
#{newChartId},
GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ),
`scene_id`,
`table_id`,
`type`,
`title`,
`x_axis`,
`y_axis`,
`custom_attr`,
`custom_style`,
`custom_filter`,
`create_by`,
`create_time`,
`update_time`,
`snapshot`,
`style_priority`
FROM
chart_view
WHERE
id = #{oldChartId}
</insert>
</mapper>
</mapper>
backend/src/main/java/io/dataease/controller/chart/ChartViewController.java
浏览文件 @
2fc2bb1f
...
@@ -55,4 +55,9 @@ public class ChartViewController {
...
@@ -55,4 +55,9 @@ public class ChartViewController {
public
Map
<
String
,
Object
>
chartDetail
(
@PathVariable
String
id
)
{
public
Map
<
String
,
Object
>
chartDetail
(
@PathVariable
String
id
)
{
return
chartViewService
.
getChartDetail
(
id
);
return
chartViewService
.
getChartDetail
(
id
);
}
}
@PostMapping
(
"chartCopy/{id}"
)
public
String
chartCopy
(
@PathVariable
String
id
)
{
return
chartViewService
.
chartCopy
(
id
);
}
}
}
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
2fc2bb1f
...
@@ -342,4 +342,10 @@ public class ChartViewService {
...
@@ -342,4 +342,10 @@ public class ChartViewService {
public
ChartViewWithBLOBs
findOne
(
String
id
)
{
public
ChartViewWithBLOBs
findOne
(
String
id
)
{
return
chartViewMapper
.
selectByPrimaryKey
(
id
);
return
chartViewMapper
.
selectByPrimaryKey
(
id
);
}
}
public
String
chartCopy
(
String
id
)
{
String
newChartId
=
UUID
.
randomUUID
().
toString
();
extChartViewMapper
.
chartCopy
(
newChartId
,
id
);
return
newChartId
;
}
}
}
backend/src/main/resources/db/migration/V9__chart_view_copy.sql
0 → 100644
浏览文件 @
2fc2bb1f
DROP
FUNCTION
IF
EXISTS
`GET_CHART_VIEW_COPY_NAME`
;
delimiter
;;
CREATE
DEFINER
=
`root`
@
`%`
FUNCTION
`GET_CHART_VIEW_COPY_NAME`
(
chartId
varchar
(
255
))
RETURNS
varchar
(
255
)
CHARSET
utf8
READS
SQL
DATA
BEGIN
DECLARE
chartName
varchar
(
255
);
DECLARE
pid
varchar
(
255
);
DECLARE
regexpInfo
varchar
(
255
);
DECLARE
chartNameCount
INTEGER
;
select
`name`
,
`scene_id`
into
chartName
,
pid
from
chart_view
where
id
=
chartId
;
set
regexpInfo
=
concat
(
'^'
,
chartName
,
'-copy'
,
'
\\
(([0-9])+
\\
)$'
);
select
(
count
(
1
)
+
1
)
into
chartNameCount
from
chart_view
where
name
REGEXP
regexpInfo
;
RETURN
concat
(
chartName
,
'-copy('
,
chartNameCount
,
')'
);
END
;;
delimiter
;
frontend/src/api/chart/chart.js
浏览文件 @
2fc2bb1f
...
@@ -27,3 +27,11 @@ export function getChartTree(data) {
...
@@ -27,3 +27,11 @@ export function getChartTree(data) {
data
data
})
})
}
}
export
function
chartCopy
(
id
)
{
return
request
({
url
:
'/chart/view/chartCopy/'
+
id
,
method
:
'post'
,
loading
:
true
})
}
frontend/src/components/canvas/components/Editor/ContextMenu.vue
浏览文件 @
2fc2bb1f
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<template
v-if=
"curComponent"
>
<template
v-if=
"curComponent"
>
<template
v-if=
"!curComponent.isLock"
>
<template
v-if=
"!curComponent.isLock"
>
<li
v-if=
"editFilter.includes(curComponent.type)"
@
click=
"edit"
>
{{
$t
(
'panel.edit'
)
}}
</li>
<li
v-if=
"editFilter.includes(curComponent.type)"
@
click=
"edit"
>
{{
$t
(
'panel.edit'
)
}}
</li>
<
!--
<li
@
click=
"copy"
>
{{
$t
(
'panel.copy'
)
}}
</li>
--
>
<
li
@
click=
"copy"
>
{{
$t
(
'panel.copy'
)
}}
</li
>
<li
@
click=
"paste"
>
{{
$t
(
'panel.paste'
)
}}
</li>
<li
@
click=
"paste"
>
{{
$t
(
'panel.paste'
)
}}
</li>
<li
@
click=
"cut"
>
{{
$t
(
'panel.cut'
)
}}
</li>
<li
@
click=
"cut"
>
{{
$t
(
'panel.cut'
)
}}
</li>
<li
@
click=
"deleteComponent"
>
{{
$t
(
'panel.delete'
)
}}
</li>
<li
@
click=
"deleteComponent"
>
{{
$t
(
'panel.delete'
)
}}
</li>
...
...
frontend/src/components/canvas/store/copy.js
浏览文件 @
2fc2bb1f
...
@@ -2,6 +2,7 @@ import store from '@/store/index'
...
@@ -2,6 +2,7 @@ import store from '@/store/index'
import
toast
from
'@/components/canvas/utils/toast'
import
toast
from
'@/components/canvas/utils/toast'
import
generateID
from
'@/components/canvas/utils/generateID'
import
generateID
from
'@/components/canvas/utils/generateID'
import
{
deepCopy
}
from
'@/components/canvas/utils/utils'
import
{
deepCopy
}
from
'@/components/canvas/utils/utils'
import
{
chartCopy
}
from
'@/api/chart/chart'
export
default
{
export
default
{
state
:
{
state
:
{
...
@@ -36,7 +37,18 @@ export default {
...
@@ -36,7 +37,18 @@ export default {
}
}
data
.
id
=
generateID
()
data
.
id
=
generateID
()
store
.
commit
(
'addComponent'
,
{
component
:
deepCopy
(
data
)
})
// 如果是用户视图 测先进行底层复制
debugger
if
(
data
.
type
===
'view'
)
{
chartCopy
(
data
.
propValue
.
viewId
).
then
(
res
=>
{
const
newView
=
deepCopy
(
data
)
newView
.
propValue
.
viewId
=
res
.
data
store
.
commit
(
'addComponent'
,
{
component
:
newView
})
})
}
else
{
store
.
commit
(
'addComponent'
,
{
component
:
deepCopy
(
data
)
})
}
if
(
state
.
isCut
)
{
if
(
state
.
isCut
)
{
state
.
copyData
=
null
state
.
copyData
=
null
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论