Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
73ab0989
提交
73ab0989
authored
4月 13, 2021
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:仪表盘模板导出功能
上级
5b60ea57
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
29 行增加
和
2 行删除
+29
-2
package.json
frontend/package.json
+2
-0
PanelViewShow.vue
frontend/src/views/panel/list/PanelViewShow.vue
+27
-2
没有找到文件。
frontend/package.json
浏览文件 @
73ab0989
...
@@ -21,7 +21,9 @@
...
@@ -21,7 +21,9 @@
"echarts"
:
"^5.0.2"
,
"echarts"
:
"^5.0.2"
,
"element-resize-detector"
:
"^1.2.2"
,
"element-resize-detector"
:
"^1.2.2"
,
"element-ui"
:
"2.13.0"
,
"element-ui"
:
"2.13.0"
,
"file-saver"
:
"^2.0.5"
,
"fit2cloud-ui"
:
"^0.1.12"
,
"fit2cloud-ui"
:
"^0.1.12"
,
"html2canvas"
:
"^1.0.0-rc.7"
,
"js-cookie"
:
"2.2.0"
,
"js-cookie"
:
"2.2.0"
,
"jsencrypt"
:
"^3.0.0-rc.1"
,
"jsencrypt"
:
"^3.0.0-rc.1"
,
"lodash"
:
"4.17.21"
,
"lodash"
:
"4.17.21"
,
...
...
frontend/src/views/panel/list/PanelViewShow.vue
浏览文件 @
73ab0989
...
@@ -4,7 +4,12 @@
...
@@ -4,7 +4,12 @@
<el-row
class=
"panel-design-head"
>
<el-row
class=
"panel-design-head"
>
<!--TODO 仪表盘头部区域-->
<!--TODO 仪表盘头部区域-->
<span>
{{
panelInfo
.
name
||
'测试仪表板'
}}
</span>
<span>
{{
panelInfo
.
name
||
'测试仪表板'
}}
</span>
<span
style=
"float: right;"
>
<span
style=
"float: right;margin-right: 10px"
>
<el-tooltip
content=
"导出为模板"
>
<el-button
class=
"el-icon-download"
size=
"mini"
circle
@
click=
"saveToTemplate"
/>
</el-tooltip>
</span>
<span
style=
"float: right;margin-right: 10px"
>
<el-tooltip
content=
"预览"
>
<el-tooltip
content=
"预览"
>
<el-button
class=
"el-icon-view"
size=
"mini"
circle
@
click=
"clickPreview"
/>
<el-button
class=
"el-icon-view"
size=
"mini"
circle
@
click=
"clickPreview"
/>
</el-tooltip>
</el-tooltip>
...
@@ -12,7 +17,9 @@
...
@@ -12,7 +17,9 @@
</el-row>
</el-row>
<!--TODO 仪表盘预览区域-->
<!--TODO 仪表盘预览区域-->
<el-row
class=
"panel-design-preview"
>
<el-row
class=
"panel-design-preview"
>
<Preview
v-if=
"showMain"
/>
<div
ref=
"imageWrapper"
style=
"width: 100%;height: 100%"
>
<Preview
v-if=
"showMain"
/>
</div>
</el-row>
</el-row>
</el-col>
</el-col>
<el-col
v-if=
"panelInfo.name.length===0"
style=
"height: 100%;"
>
<el-col
v-if=
"panelInfo.name.length===0"
style=
"height: 100%;"
>
...
@@ -25,6 +32,8 @@
...
@@ -25,6 +32,8 @@
<
script
>
<
script
>
import
Preview
from
'@/components/canvas/components/Editor/Preview'
import
Preview
from
'@/components/canvas/components/Editor/Preview'
import
{
mapState
}
from
'vuex'
import
{
mapState
}
from
'vuex'
import
html2canvas
from
'html2canvas'
import
FileSaver
from
'file-saver'
export
default
{
export
default
{
name
:
'PanelViewShow'
,
name
:
'PanelViewShow'
,
...
@@ -57,6 +66,22 @@ export default {
...
@@ -57,6 +66,22 @@ export default {
clickPreview
()
{
clickPreview
()
{
const
url
=
'#/preview/'
+
this
.
$store
.
state
.
panel
.
panelInfo
.
id
const
url
=
'#/preview/'
+
this
.
$store
.
state
.
panel
.
panelInfo
.
id
window
.
open
(
url
,
'_blank'
)
window
.
open
(
url
,
'_blank'
)
},
saveToTemplate
()
{
html2canvas
(
this
.
$refs
.
imageWrapper
).
then
(
canvas
=>
{
debugger
const
snapShot
=
canvas
.
toDataURL
(
'image/jpeg'
,
0.5
)
// 0.5是图片质量
if
(
snapShot
!==
''
)
{
const
templateInfo
=
{
snapShot
:
snapShot
,
panelStyle
:
JSON
.
stringify
(
this
.
canvasStyleData
),
panelData
:
JSON
.
stringify
(
this
.
componentData
),
dynamicData
:
''
}
const
blob
=
new
Blob
([
JSON
.
stringify
(
templateInfo
)],
{
type
:
''
})
FileSaver
.
saveAs
(
blob
,
this
.
$store
.
state
.
panel
.
panelInfo
.
name
+
'-TEMPLATE.DE'
)
}
})
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论