Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
dfde1da4
提交
dfde1da4
authored
4月 08, 2021
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:仪表盘样式适配
上级
09b772bc
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
155 行增加
和
302 行删除
+155
-302
package.json
frontend/package.json
+1
-0
Preview.vue
frontend/src/components/canvas/components/Editor/Preview.vue
+86
-26
PreviewEject.vue
.../src/components/canvas/components/Editor/PreviewEject.vue
+17
-5
variables.scss
frontend/src/styles/variables.scss
+1
-1
index-back.vue
frontend/src/views/panel/index-back.vue
+0
-85
index.vue
frontend/src/views/panel/index.vue
+2
-2
ChartViewEdit.vue
frontend/src/views/panel/list/ChartViewEdit.vue
+0
-156
PanelList.vue
frontend/src/views/panel/list/PanelList.vue
+4
-2
PanelMain.vue
frontend/src/views/panel/list/PanelMain.vue
+2
-1
PanelViewShow.vue
frontend/src/views/panel/list/PanelViewShow.vue
+42
-24
没有找到文件。
frontend/package.json
浏览文件 @
dfde1da4
...
...
@@ -18,6 +18,7 @@
"@riophae/vue-treeselect"
:
"0.4.0"
,
"axios"
:
"^0.21.1"
,
"echarts"
:
"^5.0.2"
,
"element-resize-detector"
:
"^1.2.2"
,
"element-ui"
:
"2.13.0"
,
"fit2cloud-ui"
:
"^0.1.12"
,
"js-cookie"
:
"2.2.0"
,
...
...
frontend/src/components/canvas/components/Editor/Preview.vue
浏览文件 @
dfde1da4
<
template
>
<div
class=
"bg"
>
<div
id=
"preview-parent"
class=
"canvas-container"
>
<div
class=
"canvas"
:style=
"
{
width: changeStyleWithScale(canvasStyleData.width) + 'px',
height: changeStyleWithScale(canvasStyleData.height) + 'px',
}"
>
<ComponentWrapper
v-for=
"(item, index) in componentData"
:key=
"index"
:config=
"item"
/>
</div>
</div>
<div
id=
"canvasInfo"
class=
"bg"
>
<ComponentWrapper
v-for=
"(item, index) in componentDataInfo"
:key=
"index"
:config=
"item"
/>
</div>
</
template
>
...
...
@@ -23,6 +13,10 @@ import { getStyle } from '@/components/canvas/utils/style'
import
{
mapState
}
from
'vuex'
import
ComponentWrapper
from
'./ComponentWrapper'
import
{
changeStyleWithScale
}
from
'@/components/canvas/utils/translate'
import
{
uuid
}
from
'vue-uuid'
import
{
deepCopy
}
from
'@/components/canvas/utils/utils'
import
eventBus
from
'@/components/canvas/utils/eventBus'
import
elementResizeDetectorMaker
from
'element-resize-detector'
export
default
{
components
:
{
ComponentWrapper
},
...
...
@@ -36,20 +30,84 @@ export default {
default
:
false
}
},
computed
:
mapState
([
'componentData'
,
'canvasStyleData'
]),
data
()
{
return
{
isShowPreview
:
false
,
panelId
:
''
,
needToChangeHeight
:
[
'top'
,
'height'
,
'fontSize'
,
'borderWidth'
],
needToChangeWidth
:
[
'left'
,
'width'
],
scaleWidth
:
'100'
,
scaleHeight
:
'100'
,
timer
:
null
,
componentDataShow
:
[]
}
},
computed
:
{
// 此处单独计算componentData的值 不放入全局mapState中
componentDataInfo
()
{
return
this
.
componentDataShow
},
...
mapState
([
'componentData'
,
'canvasStyleData'
])
},
mounted
()
{
// 计算组件当前合适宽度
debugger
const
_this
=
this
const
erd
=
elementResizeDetectorMaker
()
// 监听div变动事件
erd
.
listenTo
(
document
.
getElementById
(
'canvasInfo'
),
element
=>
{
_this
.
$nextTick
(()
=>
{
_this
.
restore
()
})
})
// 监听数据变动事件
eventBus
.
$on
(
'componentDataChange'
,
()
=>
{
_this
.
restore
()
})
},
methods
:
{
changeStyleWithScale
,
getStyle
,
close
()
{
this
.
$emit
(
'change'
,
false
)
restore
()
{
const
canvasHeight
=
document
.
getElementById
(
'canvasInfo'
).
offsetHeight
const
canvasWidth
=
document
.
getElementById
(
'canvasInfo'
).
offsetWidth
this
.
scaleWidth
=
canvasWidth
*
100
/
parseInt
(
this
.
canvasStyleData
.
width
)
// 获取宽度比
this
.
scaleHeight
=
canvasHeight
*
100
/
parseInt
(
this
.
canvasStyleData
.
height
)
// 获取高度比
this
.
handleScaleChange
()
},
resetID
(
data
)
{
data
.
forEach
(
item
=>
{
item
.
id
=
uuid
.
v1
()
})
return
data
},
format
(
value
,
scale
)
{
return
value
*
parseInt
(
scale
)
/
100
},
handleScaleChange
()
{
const
componentData
=
deepCopy
(
this
.
componentData
)
componentData
.
forEach
(
component
=>
{
Object
.
keys
(
component
.
style
).
forEach
(
key
=>
{
if
(
this
.
needToChangeHeight
.
includes
(
key
))
{
component
.
style
[
key
]
=
this
.
format
(
component
.
style
[
key
],
this
.
scaleHeight
)
}
if
(
this
.
needToChangeWidth
.
includes
(
key
))
{
component
.
style
[
key
]
=
this
.
format
(
component
.
style
[
key
],
this
.
scaleWidth
)
}
})
})
this
.
componentDataShow
=
componentData
eventBus
.
$emit
(
'resizing'
,
''
)
}
}
}
...
...
@@ -57,12 +115,14 @@ export default {
<
style
lang=
"scss"
scoped
>
.bg
{
min-width
:
600px
;
min-height
:
300px
;
width
:
100%
;
height
:
100%
;
border
:
1px
solid
#E6E6E6
;
.canvas-container
{
width
:
100%
;
height
:
100%
;
overflow
:
auto
;
.canvas
{
position
:
relative
;
margin
:
auto
;
...
...
frontend/src/components/canvas/components/Editor/PreviewEject.vue
浏览文件 @
dfde1da4
<
template
>
<div
ref=
"element
"
class=
"bg"
>
<div
id=
"canvasInfo
"
class=
"bg"
>
<ComponentWrapper
v-for=
"(item, index) in componentDataInfo"
:key=
"index"
...
...
@@ -10,12 +10,12 @@
<
script
>
import
{
getStyle
}
from
'@/components/canvas/utils/style'
import
{
mapState
}
from
'vuex'
import
ComponentWrapper
from
'./ComponentWrapper'
import
{
changeStyleWithScale
}
from
'@/components/canvas/utils/translate'
import
{
uuid
}
from
'vue-uuid'
import
{
deepCopy
}
from
'@/components/canvas/utils/utils'
import
eventBus
from
'@/components/canvas/utils/eventBus'
import
elementResizeDetectorMaker
from
'element-resize-detector'
import
{
get
}
from
'@/api/panel/panel'
export
default
{
...
...
@@ -47,6 +47,7 @@ export default {
scaleWidth
:
'100'
,
scaleHeight
:
'100'
,
timer
:
null
,
componentDataSource
:
{},
componentData
:
{},
canvasStyleData
:
{}
...
...
@@ -58,8 +59,17 @@ export default {
}
},
mounted
()
{
const
_this
=
this
// 加载数据
this
.
restore
()
_this
.
restore
()
const
erd
=
elementResizeDetectorMaker
()
// 监听div变动事件
erd
.
listenTo
(
document
.
getElementById
(
'canvasInfo'
),
element
=>
{
_this
.
$nextTick
(()
=>
{
_this
.
resize
()
})
})
window
.
onresize
=
()
=>
{
debugger
this
.
resize
()
...
...
@@ -82,7 +92,7 @@ export default {
this
.
panelId
=
this
.
$route
.
path
.
split
(
'/'
)[
2
]
// 加载视图数据
get
(
'panel/group/findOne/'
+
this
.
panelId
).
then
(
response
=>
{
this
.
componentData
=
this
.
resetID
(
JSON
.
parse
(
response
.
data
.
panelData
))
this
.
componentData
Source
=
this
.
resetID
(
JSON
.
parse
(
response
.
data
.
panelData
))
this
.
canvasStyleData
=
JSON
.
parse
(
response
.
data
.
panelStyle
)
this
.
resize
()
})
...
...
@@ -98,7 +108,7 @@ export default {
return
value
*
parseInt
(
scale
)
/
100
},
handleScaleChange
()
{
const
componentData
=
deepCopy
(
this
.
componentData
)
const
componentData
=
deepCopy
(
this
.
componentData
Source
)
componentData
.
forEach
(
component
=>
{
Object
.
keys
(
component
.
style
).
forEach
(
key
=>
{
if
(
this
.
needToChangeHeight
.
includes
(
key
))
{
...
...
@@ -118,6 +128,8 @@ export default {
<
style
lang=
"scss"
scoped
>
.bg
{
min-width
:
800px
;
min-height
:
600px
;
width
:
100%
;
height
:
100%
;
overflow
:
auto
;
...
...
frontend/src/styles/variables.scss
浏览文件 @
dfde1da4
...
...
@@ -42,7 +42,7 @@ $subMenuHover:#1682e6;
$sideBarWidth
:
210px
;
$topBarHeight
:
56px
;
$contentHeight
:
calc
(
100vh
-
56px
)
;
$contentHeight
:
100vh
;
// the :export directive is the magic sauce for webpack
// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
...
...
frontend/src/views/panel/index-back.vue
deleted
100644 → 0
浏览文件 @
09b772bc
<
template
>
<de-container>
<de-aside-container>
<el-tabs
v-model=
"activeName"
@
tab-click=
"handleClick"
>
<el-tab-pane
name=
"PanelList"
>
<span
slot=
"label"
><i
class=
"el-icon-document"
/>
列表
</span>
<panel-list
/>
</el-tab-pane>
<el-tab-pane
name=
"panels_star"
>
<span
slot=
"label"
><i
class=
"el-icon-star-off"
/>
收藏
</span>
开发中...
</el-tab-pane>
<el-tab-pane
name=
"panels_share"
:lazy=
"true"
>
<span
slot=
"label"
><i
class=
"el-icon-share"
/>
分享
</span>
<share-tree
v-if=
"showShare"
/>
</el-tab-pane>
</el-tabs>
</de-aside-container>
<de-main-container>
<component
:is=
"component"
:param=
"param"
/>
</de-main-container>
</de-container>
</
template
>
<
script
>
import
DeMainContainer
from
'@/components/dataease/DeMainContainer'
import
DeContainer
from
'@/components/dataease/DeContainer'
import
DeAsideContainer
from
'@/components/dataease/DeAsideContainer'
// import Group from './group/Group'
import
PanelList
from
'./list/PanelList'
import
PanelViewShow
from
'./list/PanelViewShow'
import
ShareTree
from
'./GrantAuth/shareTree'
export
default
{
name
:
'Panel'
,
components
:
{
DeMainContainer
,
DeContainer
,
DeAsideContainer
,
PanelList
,
PanelViewShow
,
ShareTree
},
data
()
{
return
{
component
:
PanelViewShow
,
param
:
{},
activeName
:
'PanelList'
,
showShare
:
false
}
},
methods
:
{
handleClick
(
tab
,
event
)
{
// 点击分析面板需要刷新分享内容
if
(
tab
.
name
===
'panels_share'
)
{
this
.
refreshShare
()
}
},
// switchComponent(c) {
// console.log(c)
// this.param = c.param
// switch (c.name) {
// case 'PanelViewShow':
// this.component = PanelViewShow
// break
// }
// },
refreshShare
()
{
this
.
showShare
=
false
this
.
$nextTick
(()
=>
(
this
.
showShare
=
true
))
}
}
}
</
script
>
<
style
scoped
>
.ms-aside-container
{
height
:
calc
(
100vh
-
56px
);
padding
:
15px
;
min-width
:
260px
;
max-width
:
460px
;
}
.ms-main-container
{
height
:
calc
(
100vh
-
56px
);
}
</
style
>
frontend/src/views/panel/index.vue
浏览文件 @
dfde1da4
<
template
>
<de-container
v-loading=
"$store.getters.loadingMap[$store.getters.currentPath]"
>
<de-container
v-loading=
"$store.getters.loadingMap[$store.getters.currentPath]"
style=
"background-color: #f7f8fa"
>
<de-main-container>
<component
:is=
"component"
:param=
"param"
/>
</de-main-container>
...
...
@@ -49,7 +49,7 @@ export default {
<
style
scoped
>
.ms-aside-container
{
height
:
calc
(
100vh
-
56px
);
padding
:
15
px
;
padding
:
0
px
;
min-width
:
260px
;
max-width
:
460px
;
}
...
...
frontend/src/views/panel/list/ChartViewEdit.vue
deleted
100644 → 0
浏览文件 @
09b772bc
<
template
>
<el-row
style=
"height: 100%;overflow-y: hidden;width: 100%;"
>
<el-row
style=
"display: flex;height: 100%"
>
<el-col
class=
"panel-design"
>
<!--TODO 仪表盘设计公共设置区域-->
<el-row
class=
"panel-design-head"
>
<span
style=
"float: left;line-height: 40px; color: gray"
>
<span>
名称:
{{
panelInfo
.
name
||
'测试仪表板'
}}
</span>
</span>
<span
style=
"float: right;line-height: 40px;"
>
<el-tooltip
content=
"预览"
>
<el-button
class=
"el-icon-view"
size=
"mini"
circle
/>
</el-tooltip>
</span>
</el-row>
<!--TODO 仪表盘预览区域-->
<section>
<Preview
/>
</section>
</el-col>
</el-row>
</el-row>
</
template
>
<
script
>
import
ChartEdit
from
'@/views/chart/view/ChartEdit'
export
default
{
name
:
'ChartViewEdit'
,
components
:
{
ChartEdit
},
data
()
{
return
{
}
},
computed
:
{
panelInfo
()
{
return
this
.
$store
.
state
.
panel
.
panelInfo
}
},
mounted
()
{
},
methods
:
{
}
}
</
script
>
<
style
scoped
>
.view-list
{
height
:
100%
;
width
:
20%
;
min-width
:
180px
;
max-width
:
220px
;
border
:
1px
solid
#E6E6E6
;
border-left
:
0
solid
;
overflow-y
:
auto
;
}
.view-list-thumbnails-outline
{
height
:
100%
;
overflow-y
:
auto
;
}
.view-list-thumbnails
{
width
:
100%
;
padding
:
0px
15px
15px
0px
;
}
.panel-design
{
height
:
100%
;
min-width
:
500px
;
border-top
:
1px
solid
#E6E6E6
;
}
.panel-design-head
{
height
:
40px
;
}
.panel-design-show
{
height
:
100%
;
width
:
100%
;
border-top
:
1px
solid
#E6E6E6
;
}
.padding-lr
{
padding
:
0
6px
;
}
.itxst
{
margin
:
10px
;
text-align
:
left
;
}
.col
{
width
:
40%
;
flex
:
1
;
padding
:
10px
;
border
:
solid
1px
#eee
;
border-radius
:
5px
;
float
:
left
;
}
.col
+
.col
{
margin-left
:
10px
;
}
.item
{
padding
:
2px
12px
;
margin
:
3px
3px
0
3px
;
border
:
solid
1px
#eee
;
background-color
:
#f1f1f1
;
text-align
:
left
;
display
:
block
;
}
.item
+
.item
{
border-top
:
none
;
margin-top
:
3px
;
}
.item
:hover
{
background-color
:
#fdfdfd
;
cursor
:
pointer
;
}
.item-axis
{
padding
:
2px
12px
;
margin
:
3px
3px
0
3px
;
border
:
solid
1px
#eee
;
background-color
:
#f1f1f1
;
text-align
:
left
;
}
.item-axis
:hover
{
background-color
:
#fdfdfd
;
cursor
:
pointer
;
}
.el-form-item
{
margin-bottom
:
0
;
}
.container
{
width
:
100%
;
height
:
600px
;
border
:
1px
solid
#000
;
position
:
relative
;
box-sizing
:
border-box
;
}
span
{
font-size
:
12px
;
}
</
style
>
frontend/src/views/panel/list/PanelList.vue
浏览文件 @
dfde1da4
...
...
@@ -145,6 +145,7 @@ import GrantAuth from '../GrantAuth'
import
LinkGenerate
from
'@/views/link/generate'
import
{
uuid
}
from
'vue-uuid'
import
bus
from
'@/utils/bus'
import
eventBus
from
'@/components/canvas/utils/eventBus'
import
{
loadTable
,
getScene
,
addGroup
,
delGroup
,
addTable
,
delTable
,
groupTree
,
defaultTree
,
get
}
from
'@/api/panel/panel'
export
default
{
...
...
@@ -417,8 +418,6 @@ export default {
nodeClick
(
data
,
node
)
{
if
(
data
.
nodeType
===
'panel'
)
{
this
.
$store
.
dispatch
(
'panel/setPanelInfo'
,
data
)
this
.
currGroup
=
data
// 加载视图数据
this
.
$nextTick
(()
=>
{
localStorage
.
setItem
(
'canvasData'
,
null
)
...
...
@@ -426,6 +425,9 @@ export default {
get
(
'panel/group/findOne/'
+
data
.
id
).
then
(
response
=>
{
this
.
$store
.
commit
(
'setComponentData'
,
this
.
resetID
(
JSON
.
parse
(
response
.
data
.
panelData
)))
this
.
$store
.
commit
(
'setCanvasStyle'
,
JSON
.
parse
(
response
.
data
.
panelStyle
))
this
.
$store
.
dispatch
(
'panel/setPanelInfo'
,
data
)
this
.
currGroup
=
data
eventBus
.
$emit
(
'componentDataChange'
,
''
)
})
})
}
...
...
frontend/src/views/panel/list/PanelMain.vue
浏览文件 @
dfde1da4
...
...
@@ -57,12 +57,13 @@ export default {
<
style
scoped
>
.ms-aside-container
{
height
:
calc
(
100vh
-
56px
);
padding
:
15
px
;
padding
:
0
px
;
min-width
:
260px
;
max-width
:
460px
;
}
.ms-main-container
{
height
:
calc
(
100vh
-
56px
);
padding
:
0px
;
}
</
style
>
frontend/src/views/panel/list/PanelViewShow.vue
浏览文件 @
dfde1da4
<
template
>
<el-row
style=
"height: 100%;
overflow-y: hidden;
width: 100%;"
>
<el-
row
style=
"display: flex;height: 100%
"
>
<el-col
class=
"panel-design"
>
<
!--TODO 仪表盘设计公共设置区域--
>
<
el-row
class=
"panel-design-head
"
>
<
span
style=
"float: left;line-height: 40px; color: gray
"
>
<
span>
名称:
{{
panelInfo
.
name
||
'测试仪表板'
}}
</span
>
</
span
>
<span
style=
"float: right;line-height: 40px;"
>
<el-tooltip
content=
"预览"
>
<el-button
class=
"el-icon-view"
size=
"mini"
circle
@
click=
"clickPreview"
/
>
</el-tooltip
>
</span
>
</el-row>
<!--TODO 仪表盘预览区域--
>
<section
>
<Preview
/
>
</section>
</el-
col
>
</el-
row
>
<el-row
style=
"height: 100%;width: 100%;"
>
<el-
col
v-if=
"panelInfo.name.length>0"
class=
"panel-design
"
>
<el-row
class=
"panel-design-head"
>
<!--TODO 仪表盘头部区域--
>
<
span>
{{
panelInfo
.
name
||
'测试仪表板'
}}
</span
>
<
span
style=
"float: right;
"
>
<
el-tooltip
content=
"预览
"
>
<
el-button
class=
"el-icon-view"
size=
"mini"
circle
@
click=
"clickPreview"
/
>
</
el-tooltip
>
</span
>
</el-row
>
<!--TODO 仪表盘预览区域--
>
<el-row
class=
"panel-design-preview"
>
<Preview
/
>
</el-row>
</el-col
>
<el-col
v-if=
"panelInfo.name.length===0"
style=
"height: 100%;"
>
<el-row
style=
"height: 100%;"
class=
"custom-position"
>
请从左侧选择仪表盘
</el-
row
>
</el-
col
>
</el-row>
</
template
>
<
script
>
...
...
@@ -59,7 +59,7 @@ export default {
}
</
script
>
<
style
scoped
>
<
style
>
.view-list
{
height
:
100%
;
width
:
20%
;
...
...
@@ -81,18 +81,26 @@ export default {
}
.panel-design
{
min-height
:
400px
;
height
:
100%
;
min-width
:
500px
;
overflow-y
:
auto
;
border-top
:
1px
solid
#E6E6E6
;
}
.panel-design-head
{
height
:
40px
;
background-color
:
white
;
padding
:
0
6px
;
line-height
:
40px
;
}
.panel-design-show
{
height
:
100%
;
.panel-design-preview
{
width
:
100%
;
height
:
calc
(
100%
-
40px
);
overflow-x
:
hidden
;
overflow-y
:
auto
;
padding
:
5px
;
border-top
:
1px
solid
#E6E6E6
;
}
...
...
@@ -165,4 +173,14 @@ export default {
span
{
font-size
:
12px
;
}
.custom-position
{
flex
:
1
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
font-size
:
14px
;
flex-flow
:
row
nowrap
;
color
:
#9ea6b2
;
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论