Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
52a976c8
提交
52a976c8
authored
2月 01, 2022
作者:
junjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: S2
上级
6c7d65fc
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
90 行增加
和
8 行删除
+90
-8
common_table.js
frontend/src/views/chart/chart/common/common_table.js
+27
-0
table-info.js
frontend/src/views/chart/chart/table/table-info.js
+54
-5
ChartComponentS2.vue
frontend/src/views/chart/components/ChartComponentS2.vue
+9
-3
没有找到文件。
frontend/src/views/chart/chart/common/common_table.js
浏览文件 @
52a976c8
...
@@ -8,3 +8,30 @@ export function getCustomTheme(chart) {
...
@@ -8,3 +8,30 @@ export function getCustomTheme(chart) {
theme
.
background
=
background
theme
.
background
=
background
return
theme
return
theme
}
}
export
function
getSize
(
chart
)
{
const
size
=
{}
let
customAttr
=
{}
if
(
chart
.
customAttr
)
{
customAttr
=
JSON
.
parse
(
chart
.
customAttr
)
// size
if
(
customAttr
.
size
)
{
const
s
=
JSON
.
parse
(
JSON
.
stringify
(
customAttr
.
size
))
size
.
colCfg
=
{
height
:
s
.
tableTitleHeight
}
size
.
cellCfg
=
{
height
:
s
.
tableItemHeight
}
if
(
!
s
.
tableColumnMode
||
s
.
tableColumnMode
===
'adapt'
)
{
delete
size
.
cellCfg
.
width
size
.
layoutWidthType
=
'compact'
}
else
{
delete
size
.
layoutWidthType
size
.
cellCfg
.
width
=
s
.
tableColumnWidth
}
}
}
return
size
}
frontend/src/views/chart/chart/table/table-info.js
浏览文件 @
52a976c8
import
{
TableSheet
}
from
'@antv/s2'
import
{
TableSheet
}
from
'@antv/s2'
import
{
getCustomTheme
}
from
'@/views/chart/chart/common/common_table'
import
{
getCustomTheme
,
getSize
}
from
'@/views/chart/chart/common/common_table'
export
function
baseTableInfo
(
s2
,
container
,
chart
,
action
,
tableData
)
{
export
function
baseTableInfo
(
s2
,
container
,
chart
,
action
,
tableData
)
{
const
containerDom
=
document
.
getElementById
(
container
)
const
containerDom
=
document
.
getElementById
(
container
)
...
@@ -38,11 +38,60 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
...
@@ -38,11 +38,60 @@ export function baseTableInfo(s2, container, chart, action, tableData) {
width
:
containerDom
.
offsetWidth
,
width
:
containerDom
.
offsetWidth
,
height
:
containerDom
.
offsetHeight
,
height
:
containerDom
.
offsetHeight
,
// showSeriesNumber: true
// showSeriesNumber: true
style
:
{
style
:
getSize
(
chart
)
cellCfg
:
{
}
width
:
500
}
// 开始渲染
if
(
s2
)
{
s2
.
destroy
()
}
s2
=
new
TableSheet
(
containerDom
,
s2DataConfig
,
s2Options
)
// theme
const
customTheme
=
getCustomTheme
(
chart
)
s2
.
setThemeCfg
({
theme
:
customTheme
})
return
s2
}
export
function
baseTableNormal
(
s2
,
container
,
chart
,
action
,
tableData
)
{
const
containerDom
=
document
.
getElementById
(
container
)
// data
const
fields
=
chart
.
data
.
fields
if
(
!
fields
||
fields
.
length
===
0
)
{
if
(
s2
)
{
s2
.
destroy
()
}
}
return
}
const
columns
=
[]
const
meta
=
[]
fields
.
forEach
(
ele
=>
{
columns
.
push
(
ele
.
dataeaseName
)
meta
.
push
({
field
:
ele
.
dataeaseName
,
name
:
ele
.
name
})
})
// data config
const
s2DataConfig
=
{
fields
:
{
columns
:
columns
},
meta
:
meta
,
data
:
tableData
}
// options
const
s2Options
=
{
width
:
containerDom
.
offsetWidth
,
height
:
containerDom
.
offsetHeight
,
// showSeriesNumber: true
style
:
getSize
(
chart
)
}
}
// 开始渲染
// 开始渲染
...
...
frontend/src/views/chart/components/ChartComponentS2.vue
浏览文件 @
52a976c8
...
@@ -5,7 +5,8 @@
...
@@ -5,7 +5,8 @@
<p
style=
"padding:6px 10px 0 10px;margin: 0;overflow: hidden;white-space: pre;text-overflow: ellipsis;"
>
{{
chart
.
title
}}
</p>
<p
style=
"padding:6px 10px 0 10px;margin: 0;overflow: hidden;white-space: pre;text-overflow: ellipsis;"
>
{{
chart
.
title
}}
</p>
</span>
</span>
<div
style=
"width: 100%;overflow: hidden;padding: 8px;"
:style=
"
{height:chartHeight,background:container_bg_class.background}">
<div
style=
"width: 100%;overflow: hidden;padding: 8px;"
:style=
"
{height:chartHeight,background:container_bg_class.background}">
<div
v-if=
"chart.type === 'table-info'"
:id=
"chartId"
style=
"width: 100%;overflow: hidden;"
class=
"table-dom"
/>
<div
v-if=
"chart.type === 'table-normal'"
:id=
"chartId"
style=
"width: 100%;overflow: hidden;"
class=
"table-dom-normal"
/>
<div
v-if=
"chart.type === 'table-info'"
:id=
"chartId"
style=
"width: 100%;overflow: hidden;"
class=
"table-dom-info"
/>
<el-row
v-show=
"chart.type === 'table-info'"
class=
"table-page"
>
<el-row
v-show=
"chart.type === 'table-info'"
class=
"table-page"
>
<span
class=
"total-style"
>
<span
class=
"total-style"
>
{{
$t
(
'chart.total'
)
}}
{{
$t
(
'chart.total'
)
}}
...
@@ -33,7 +34,7 @@
...
@@ -33,7 +34,7 @@
import
{
uuid
}
from
'vue-uuid'
import
{
uuid
}
from
'vue-uuid'
import
ViewTrackBar
from
'@/components/canvas/components/Editor/ViewTrackBar'
import
ViewTrackBar
from
'@/components/canvas/components/Editor/ViewTrackBar'
import
{
hexColorToRGBA
}
from
'@/views/chart/chart/util'
import
{
hexColorToRGBA
}
from
'@/views/chart/chart/util'
import
{
baseTableInfo
}
from
'@/views/chart/chart/table/table-info'
import
{
baseTableInfo
,
baseTableNormal
}
from
'@/views/chart/chart/table/table-info'
export
default
{
export
default
{
name
:
'ChartComponentS2'
,
name
:
'ChartComponentS2'
,
...
@@ -186,6 +187,8 @@ export default {
...
@@ -186,6 +187,8 @@ export default {
}
}
if
(
chart
.
type
===
'table-info'
)
{
if
(
chart
.
type
===
'table-info'
)
{
this
.
myChart
=
baseTableInfo
(
this
.
myChart
,
this
.
chartId
,
chart
,
this
.
antVAction
,
this
.
tableData
)
this
.
myChart
=
baseTableInfo
(
this
.
myChart
,
this
.
chartId
,
chart
,
this
.
antVAction
,
this
.
tableData
)
}
else
if
(
chart
.
type
===
'table-normal'
)
{
this
.
myChart
=
baseTableNormal
(
this
.
myChart
,
this
.
chartId
,
chart
,
this
.
antVAction
,
this
.
tableData
)
}
else
{
}
else
{
if
(
this
.
myChart
)
{
if
(
this
.
myChart
)
{
this
.
antVRenderStatus
=
false
this
.
antVRenderStatus
=
false
...
@@ -336,9 +339,12 @@ export default {
...
@@ -336,9 +339,12 @@ export default {
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.table-dom
{
.table-dom
-info
{
height
:calc
(
100
%
-
36px
)
;
height
:calc
(
100
%
-
36px
)
;
}
}
.table-dom-normal
{
height
:
100%
;
}
.table-page
{
.table-page
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论