提交 66b75928 authored 作者: junjie's avatar junjie

feat: S2明细表

上级 ea164951
......@@ -14,7 +14,7 @@
},
"dependencies": {
"@antv/g2plot": "^2.3.32",
"@antv/s2": "^1.6.0",
"@antv/s2": "^1.7.0",
"@riophae/vue-treeselect": "0.4.0",
"@tinymce/tinymce-vue": "^3.2.8",
"axios": "^0.21.1",
......
......@@ -37,6 +37,16 @@
@onChartClick="chartClick"
@onJumpClick="jumpClick"
/>
<chart-component-s2
v-if="charViewS2ShowFlag"
:ref="element.propValue.id"
class="chart-class"
:chart="chart"
:track-menu="trackMenu"
:search-count="searchCount"
@onChartClick="chartClick"
@onJumpClick="jumpClick"
/>
<table-normal
v-if="tableShowFlag"
:ref="element.propValue.id"
......@@ -71,10 +81,11 @@ import { areaMapping } from '@/api/map/map'
import ChartComponentG2 from '@/views/chart/components/ChartComponentG2'
import EditBarView from '@/components/canvas/components/Editor/EditBarView'
import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
export default {
name: 'UserView',
components: { EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 },
components: { ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 },
props: {
element: {
type: Object,
......@@ -169,8 +180,11 @@ export default {
charViewG2ShowFlag() {
return this.httpRequest.status && this.chart.type && !this.chart.type.includes('table') && !this.chart.type.includes('text') && this.renderComponent() === 'antv'
},
charViewS2ShowFlag() {
return this.httpRequest.status && this.chart.type && this.chart.type.includes('table') && !this.chart.type.includes('text') && this.renderComponent() === 'antv'
},
tableShowFlag() {
return this.httpRequest.status && this.chart.type && this.chart.type.includes('table')
return this.httpRequest.status && this.chart.type && this.chart.type.includes('table') && this.renderComponent() === 'echarts'
},
labelShowFlag() {
return this.httpRequest.status && this.chart.type && this.chart.type.includes('text')
......
export function getCustomTheme(chart) {
const theme = {}
const background = {
color: '#00000000'
}
theme.background = background
return theme
}
import { TableSheet } from '@antv/s2'
import { getCustomTheme } from '@/views/chart/chart/common/common_table'
export function baseTableInfo(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: {
cellCfg: {
width: 500
}
}
}
// 开始渲染
if (s2) {
s2.destroy()
}
s2 = new TableSheet(containerDom, s2DataConfig, s2Options)
// theme
const customTheme = getCustomTheme(chart)
s2.setThemeCfg({ theme: customTheme })
return s2
}
......@@ -769,8 +769,16 @@
class="chart-class"
@onChartClick="chartClick"
/>
<chart-component-s2
v-if="httpRequest.status && chart.type && chart.type.includes('table') && !chart.type.includes('text') && renderComponent() === 'antv'"
ref="dynamicChart"
:chart-id="chart.id"
:chart="chart"
class="chart-class"
@onChartClick="chartClick"
/>
<table-normal
v-if="httpRequest.status && chart.type && chart.type.includes('table')"
v-if="httpRequest.status && chart.type && chart.type.includes('table') && renderComponent() === 'echarts'"
:show-summary="chart.type === 'table-normal'"
:chart="chart"
class="table-class"
......@@ -973,10 +981,12 @@ import SizeSelectorAntV from '@/views/chart/components/shape-attr/SizeSelectorAn
import SplitSelectorAntV from '@/views/chart/components/component-style/SplitSelectorAntV'
import CompareEdit from '@/views/chart/components/compare/CompareEdit'
import { compareItem } from '@/views/chart/chart/compare'
import ChartComponentS2 from '@/views/chart/components/ChartComponentS2'
export default {
name: 'ChartEdit',
components: {
ChartComponentS2,
CompareEdit,
SplitSelectorAntV,
SizeSelectorAntV,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论