Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
804ff0db
Unverified
提交
804ff0db
authored
12月 20, 2021
作者:
王嘉豪
提交者:
GitHub
12月 20, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1480 from dataease/pr@dev@refactor_panel-scale
refactor: 仪表板支持高清PDF导出
上级
184a2a9d
03cb1f06
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
68 行增加
和
19 行删除
+68
-19
Preview.vue
frontend/src/components/canvas/components/Editor/Preview.vue
+1
-1
index.vue
frontend/src/components/canvas/components/Editor/index.vue
+1
-1
UserView.vue
frontend/src/components/canvas/custom-component/UserView.vue
+1
-0
style.js
frontend/src/components/canvas/utils/style.js
+0
-2
index.js
frontend/src/store/index.js
+5
-5
PDFPreExport.vue
frontend/src/views/panel/export/PDFPreExport.vue
+29
-5
PanelViewShow.vue
frontend/src/views/panel/list/PanelViewShow.vue
+31
-5
没有找到文件。
frontend/src/components/canvas/components/Editor/Preview.vue
浏览文件 @
804ff0db
...
@@ -229,7 +229,7 @@ export default {
...
@@ -229,7 +229,7 @@ export default {
const
canvasWidth
=
document
.
getElementById
(
'canvasInfoMain'
).
offsetWidth
const
canvasWidth
=
document
.
getElementById
(
'canvasInfoMain'
).
offsetWidth
this
.
scaleWidth
=
(
canvasWidth
)
*
100
/
this
.
canvasStyleData
.
width
// 获取宽度比
this
.
scaleWidth
=
(
canvasWidth
)
*
100
/
this
.
canvasStyleData
.
width
// 获取宽度比
this
.
scaleHeight
=
canvasHeight
*
100
/
this
.
canvasStyleData
.
height
// 获取高度比
this
.
scaleHeight
=
canvasHeight
*
100
/
this
.
canvasStyleData
.
height
// 获取高度比
this
.
$store
.
commit
(
'setPreviewCanvasScale'
,
(
this
.
scaleWidth
/
100
),
(
this
.
scaleHeight
/
100
)
)
this
.
$store
.
commit
(
'setPreviewCanvasScale'
,
{
scaleWidth
:
(
this
.
scaleWidth
/
100
),
scaleHeight
:
(
this
.
scaleHeight
/
100
)
}
)
this
.
handleScaleChange
()
this
.
handleScaleChange
()
},
},
resetID
(
data
)
{
resetID
(
data
)
{
...
...
frontend/src/components/canvas/components/Editor/index.vue
浏览文件 @
804ff0db
...
@@ -1195,7 +1195,7 @@ export default {
...
@@ -1195,7 +1195,7 @@ export default {
matrixStyleOriginWidth
:
this
.
matrixStyle
.
originWidth
,
matrixStyleOriginWidth
:
this
.
matrixStyle
.
originWidth
,
matrixStyleOriginHeight
:
this
.
matrixStyle
.
originHeight
matrixStyleOriginHeight
:
this
.
matrixStyle
.
originHeight
})
})
this
.
$store
.
commit
(
'setPreviewCanvasScale'
,
this
.
scalePointWidth
,
this
.
scalePointHeight
)
this
.
$store
.
commit
(
'setPreviewCanvasScale'
,
{
scaleWidth
:
this
.
scalePointWidth
,
scaleHeight
:
this
.
scalePointHeight
}
)
}
}
},
},
getShapeStyleIntDeDrag
(
style
,
prop
)
{
getShapeStyleIntDeDrag
(
style
,
prop
)
{
...
...
frontend/src/components/canvas/custom-component/UserView.vue
浏览文件 @
804ff0db
...
@@ -317,6 +317,7 @@ export default {
...
@@ -317,6 +317,7 @@ export default {
// 根据仪表板的缩放比例,修改视图内部参数
// 根据仪表板的缩放比例,修改视图内部参数
mergeScale
()
{
mergeScale
()
{
const
scale
=
Math
.
min
(
this
.
previewCanvasScale
.
scalePointWidth
,
this
.
previewCanvasScale
.
scalePointHeight
)
*
this
.
scaleCoefficient
const
scale
=
Math
.
min
(
this
.
previewCanvasScale
.
scalePointWidth
,
this
.
previewCanvasScale
.
scalePointHeight
)
*
this
.
scaleCoefficient
console
.
log
(
'scale:'
+
scale
+
';this.previewCanvasScale:'
+
JSON
.
stringify
(
this
.
previewCanvasScale
))
const
customAttrChart
=
JSON
.
parse
(
this
.
sourceCustomAttrStr
)
const
customAttrChart
=
JSON
.
parse
(
this
.
sourceCustomAttrStr
)
const
customStyleChart
=
JSON
.
parse
(
this
.
sourceCustomStyleStr
)
const
customStyleChart
=
JSON
.
parse
(
this
.
sourceCustomStyleStr
)
recursionTransObj
(
customAttrTrans
,
customAttrChart
,
scale
,
this
.
scaleCoefficientType
)
recursionTransObj
(
customAttrTrans
,
customAttrChart
,
scale
,
this
.
scaleCoefficientType
)
...
...
frontend/src/components/canvas/utils/style.js
浏览文件 @
804ff0db
...
@@ -94,8 +94,6 @@ export const customAttrTrans = {
...
@@ -94,8 +94,6 @@ export const customAttrTrans = {
'barWidth'
,
'barWidth'
,
'lineWidth'
,
'lineWidth'
,
'lineSymbolSize'
,
'lineSymbolSize'
,
'pieInnerRadius'
,
'pieOuterRadius'
,
'funnelWidth'
,
// 漏斗图 最大宽度
'funnelWidth'
,
// 漏斗图 最大宽度
'tableTitleFontSize'
,
'tableTitleFontSize'
,
'tableItemFontSize'
,
'tableItemFontSize'
,
...
...
frontend/src/store/index.js
浏览文件 @
804ff0db
...
@@ -140,12 +140,12 @@ const data = {
...
@@ -140,12 +140,12 @@ const data = {
setCurCanvasScale
(
state
,
curCanvasScale
)
{
setCurCanvasScale
(
state
,
curCanvasScale
)
{
state
.
curCanvasScale
=
curCanvasScale
state
.
curCanvasScale
=
curCanvasScale
},
},
setPreviewCanvasScale
(
state
,
scale
Width
,
scaleHeight
)
{
setPreviewCanvasScale
(
state
,
scale
)
{
if
(
scaleWidth
)
{
if
(
scale
.
scale
Width
)
{
state
.
previewCanvasScale
.
scalePointWidth
=
scaleWidth
state
.
previewCanvasScale
.
scalePointWidth
=
scale
.
scale
Width
}
}
if
(
scaleHeight
)
{
if
(
scale
.
scale
Height
)
{
state
.
previewCanvasScale
.
scalePointHeight
=
scaleHeight
state
.
previewCanvasScale
.
scalePointHeight
=
scale
.
scale
Height
}
}
},
},
setShapeStyle
({
curComponent
,
canvasStyleData
,
curCanvasScale
},
{
top
,
left
,
width
,
height
,
rotate
})
{
setShapeStyle
({
curComponent
,
canvasStyleData
,
curCanvasScale
},
{
top
,
left
,
width
,
height
,
rotate
})
{
...
...
frontend/src/views/panel/export/PDFPreExport.vue
浏览文件 @
804ff0db
...
@@ -4,11 +4,11 @@
...
@@ -4,11 +4,11 @@
style=
"height: 100%;width: 100%;"
style=
"height: 100%;width: 100%;"
:element-loading-text=
"$t('panel.export_loading')"
:element-loading-text=
"$t('panel.export_loading')"
element-loading-spinner=
"el-icon-loading"
element-loading-spinner=
"el-icon-loading"
element-loading-background=
"rgba(0, 0, 0,
0.8
)"
element-loading-background=
"rgba(0, 0, 0,
1
)"
>
>
<el-row
class=
"export_body_class"
>
<el-row
class=
"export_body_class"
>
<div
id=
"exportPdf"
ref=
"exportPdf"
>
<div
id=
"exportPdf"
ref=
"exportPdf"
:style=
"mainCanvasStyle"
>
<div
class=
"export_body_inner_class"
v-html=
"templateContentChange"
/>
<div
class=
"export_body_inner_class"
:style=
"templateHtmlStyle"
v-html=
"templateContentChange"
/>
</div>
</div>
</el-row>
</el-row>
<el-row
class=
"root_class"
>
<el-row
class=
"root_class"
>
...
@@ -26,6 +26,7 @@ import { pdfTemplateReplaceAll } from '@/utils/StringUtils.js'
...
@@ -26,6 +26,7 @@ import { pdfTemplateReplaceAll } from '@/utils/StringUtils.js'
export
default
{
export
default
{
name
:
'PDFPreExport'
,
name
:
'PDFPreExport'
,
components
:
{
},
props
:
{
props
:
{
// eslint-disable-next-line vue/require-default-prop
// eslint-disable-next-line vue/require-default-prop
panelName
:
{
panelName
:
{
...
@@ -43,6 +44,7 @@ export default {
...
@@ -43,6 +44,7 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
toExport
:
false
,
exportLoading
:
false
,
exportLoading
:
false
,
activeName
:
''
,
activeName
:
''
,
templateContentChange
:
''
,
templateContentChange
:
''
,
...
@@ -60,7 +62,26 @@ export default {
...
@@ -60,7 +62,26 @@ export default {
}
}
},
},
computed
:
{
computed
:
{
mainCanvasStyle
()
{
if
(
this
.
toExport
)
{
return
{
width
:
'4096px'
}
}
else
{
return
{
width
:
'100%'
}
}
},
templateHtmlStyle
()
{
if
(
this
.
toExport
)
{
return
{
fontSize
:
'48px!important'
}
}
else
{
return
{}
}
}
},
},
watch
:
{
watch
:
{
templateContent
(
newVal
,
oldVla
)
{
templateContent
(
newVal
,
oldVla
)
{
...
@@ -91,6 +112,8 @@ export default {
...
@@ -91,6 +112,8 @@ export default {
save
()
{
save
()
{
const
_this
=
this
const
_this
=
this
_this
.
exportLoading
=
true
_this
.
exportLoading
=
true
setTimeout
(()
=>
{
_this
.
toExport
=
true
setTimeout
(()
=>
{
setTimeout
(()
=>
{
html2canvas
(
document
.
getElementById
(
'exportPdf'
)).
then
(
function
(
canvas
)
{
html2canvas
(
document
.
getElementById
(
'exportPdf'
)).
then
(
function
(
canvas
)
{
_this
.
exportLoading
=
false
_this
.
exportLoading
=
false
...
@@ -104,7 +127,8 @@ export default {
...
@@ -104,7 +127,8 @@ export default {
_this
.
$emit
(
'closePreExport'
)
_this
.
$emit
(
'closePreExport'
)
}
}
)
)
},
50
)
},
1500
)
},
500
)
}
}
}
}
...
...
frontend/src/views/panel/list/PanelViewShow.vue
浏览文件 @
804ff0db
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
style=
"height: 100%;width: 100%;"
style=
"height: 100%;width: 100%;"
:element-loading-text=
"$t('panel.data_loading')"
:element-loading-text=
"$t('panel.data_loading')"
element-loading-spinner=
"el-icon-loading"
element-loading-spinner=
"el-icon-loading"
element-loading-background=
"rgba(0, 0, 0,
0.8
)"
element-loading-background=
"rgba(0, 0, 0,
1
)"
>
>
<el-col
v-if=
"panelInfo.name.length>0"
class=
"panel-design"
>
<el-col
v-if=
"panelInfo.name.length>0"
class=
"panel-design"
>
...
@@ -73,9 +73,10 @@
...
@@ -73,9 +73,10 @@
</el-row>
</el-row>
<!-- 仪表板预览区域-->
<!-- 仪表板预览区域-->
<el-row
class=
"panel-design-preview"
>
<el-row
class=
"panel-design-preview"
>
<div
id=
"imageWrapper"
ref=
"imageWrapper"
style=
"width: 100%;height: 100%"
>
<!--
<div
id=
"imageWrapper"
ref=
"imageWrapper"
style=
"width: 4096px;height: 2160px"
>
-->
<div
id=
"imageWrapper"
ref=
"imageWrapper"
:style=
"imageWrapperStyle"
>
<fullscreen
style=
"height: 100%;background: #f7f8fa;overflow-y: auto"
:fullscreen
.
sync=
"fullscreen"
>
<fullscreen
style=
"height: 100%;background: #f7f8fa;overflow-y: auto"
:fullscreen
.
sync=
"fullscreen"
>
<Preview
v-if=
"showMain"
:in-screen=
"!fullscreen"
:show-type=
"'width'"
:screen-shot=
"dataLoading"
/>
<Preview
v-if=
"showMain
Flag
"
:in-screen=
"!fullscreen"
:show-type=
"'width'"
:screen-shot=
"dataLoading"
/>
</fullscreen>
</fullscreen>
</div>
</div>
</el-row>
</el-row>
...
@@ -129,6 +130,7 @@ import { starStatus, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
...
@@ -129,6 +130,7 @@ import { starStatus, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
import
bus
from
'@/utils/bus'
import
bus
from
'@/utils/bus'
import
{
queryAll
}
from
'@/api/panel/pdfTemplate'
import
{
queryAll
}
from
'@/api/panel/pdfTemplate'
import
ShareHead
from
'@/views/panel/GrantAuth/ShareHead'
import
ShareHead
from
'@/views/panel/GrantAuth/ShareHead'
import
JsPDF
from
'jspdf'
export
default
{
export
default
{
name
:
'PanelViewShow'
,
name
:
'PanelViewShow'
,
...
@@ -154,10 +156,27 @@ export default {
...
@@ -154,10 +156,27 @@ export default {
pdfExportShow
:
false
,
pdfExportShow
:
false
,
snapshotInfo
:
''
,
snapshotInfo
:
''
,
showType
:
0
,
showType
:
0
,
dataLoading
:
false
dataLoading
:
false
,
exporting
:
false
}
}
},
},
computed
:
{
computed
:
{
imageWrapperStyle
()
{
if
(
this
.
exporting
)
{
return
{
width
:
'4096px'
,
height
:
'2160px'
}
}
else
{
return
{
width
:
'100%'
,
height
:
'100%'
}
}
},
showMainFlag
()
{
return
this
.
showMain
},
panelInfo
()
{
panelInfo
()
{
return
this
.
$store
.
state
.
panel
.
panelInfo
return
this
.
$store
.
state
.
panel
.
panelInfo
},
},
...
@@ -252,17 +271,24 @@ export default {
...
@@ -252,17 +271,24 @@ export default {
},
},
downloadAsPDF
()
{
downloadAsPDF
()
{
// this.pdfExportShow = true
//
this
.
dataLoading
=
true
this
.
dataLoading
=
true
setTimeout
(()
=>
{
this
.
exporting
=
true
setTimeout
(()
=>
{
setTimeout
(()
=>
{
html2canvas
(
document
.
getElementById
(
'canvasInfoTemp'
)).
then
(
canvas
=>
{
html2canvas
(
document
.
getElementById
(
'canvasInfoTemp'
)).
then
(
canvas
=>
{
const
snapshot
=
canvas
.
toDataURL
(
'image/jpeg'
,
1
)
// 是图片质量
const
snapshot
=
canvas
.
toDataURL
(
'image/jpeg'
,
1
)
// 是图片质量
this
.
dataLoading
=
false
this
.
dataLoading
=
false
this
.
exporting
=
false
if
(
snapshot
!==
''
)
{
if
(
snapshot
!==
''
)
{
this
.
snapshotInfo
=
snapshot
this
.
snapshotInfo
=
snapshot
this
.
pdfExportShow
=
true
this
.
pdfExportShow
=
true
}
}
})
})
},
50
)
},
1500
)
},
500
)
},
},
refreshTemplateInfo
()
{
refreshTemplateInfo
()
{
this
.
templateInfo
=
{}
this
.
templateInfo
=
{}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论