CN-141 feat: group类型图表开发(未实现折叠)

This commit is contained in:
chenjinsong
2021-09-16 21:19:48 +08:00
parent 6548df58db
commit 047fc4a1a7
4 changed files with 48 additions and 3 deletions

View File

@@ -396,6 +396,10 @@ export function isIpOpenPort (type) {
export function isIpHostedDomain (type) { export function isIpHostedDomain (type) {
return type === 33 return type === 33
} }
/* 组 */
export function isGroup (type) {
return type === 94
}
export function getOption (type) { export function getOption (type) {
const mapping = typeOptionMappings.find(m => m.value === type) const mapping = typeOptionMappings.find(m => m.value === type)
return mapping && mapping.option ? _.cloneDeep(mapping.option) : null return mapping && mapping.option ? _.cloneDeep(mapping.option) : null

View File

@@ -86,7 +86,7 @@
font-weight:normal; font-weight:normal;
} }
.cn-panel, .cn-panel>.cn-chart__tabs>.el-tabs__content>.el-tab-pane { .cn-panel, .cn-panel>.cn-chart__tabs>.el-tabs__content>.el-tab-pane, .cn-chart__group .cn-chart__body {
display: grid; display: grid;
grid-template-columns: repeat(30, 1fr); grid-template-columns: repeat(30, 1fr);
grid-auto-flow: row; grid-auto-flow: row;
@@ -121,7 +121,7 @@
} }
} }
&>.cn-chart__echarts, &>.cn-chart__table, &>.cn-chart__map { &>.cn-chart__echarts, &>.cn-chart__table, &>.cn-chart__map, &>.cn-chart__group {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.cn-chart__header { .cn-chart__header {
@@ -145,6 +145,17 @@
flex: auto; flex: auto;
} }
} }
&>.cn-chart__group {
.cn-chart__header {
border-bottom: 1px solid $--content-right-background-color;
}
.cn-chart__body {
padding: 0 20px;
.cn-chart {
border: none;
}
}
}
&>.cn-chart__single-value.cn-chart__single-value--icon-left { &>.cn-chart__single-value.cn-chart__single-value--icon-left {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -607,6 +618,14 @@
.cn-panel { .cn-panel {
padding: 20px; padding: 20px;
grid-gap: 20px; grid-gap: 20px;
&>.cn-chart>.cn-chart__header {
border-bottom: 1px solid $--content-right-background-color;
.header__title {
color: #333;
font-size: 16px;
}
}
} }
} }
} }

View File

@@ -194,6 +194,21 @@
></chart-table-pagination> ></chart-table-pagination>
</template> </template>
</chart-table> </chart-table>
<!-- group -->
<div
v-else-if="isGroup"
class="cn-chart cn-chart__group"
:style="computePosition"
>
<div class="cn-chart__header">
<div class="header__title">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</div>
</div>
<div class="cn-chart__body">
<template v-for="chart in chartInfo.children" :key="chart.id">
<chart :chart="chart" :time-filter="timeFilter" :ref="`chart-${chart.id}`" :entity="entity"></chart>
</template>
</div>
</div>
</template> </template>
<script> <script>
@@ -219,6 +234,7 @@ import {
isSingleValueWithEcharts, isSingleValueWithEcharts,
isRelationShip, isRelationShip,
isTabs, isTabs,
isGroup,
getChartColor getChartColor
} from '@/components/charts/chart-options' } from '@/components/charts/chart-options'
import ChartError from '@/components/charts/ChartError' import ChartError from '@/components/charts/ChartError'
@@ -308,6 +324,8 @@ export default {
this.initEchartsWithStatistics(chartParams) this.initEchartsWithStatistics(chartParams)
} else if (this.isRelationShip) { } else if (this.isRelationShip) {
this.initRelationShip(chartParams) this.initRelationShip(chartParams)
} else if (this.isGroup) {
} else { } else {
this.initECharts(chartParams) this.initECharts(chartParams)
} }
@@ -1039,6 +1057,7 @@ export default {
}, },
setup (props) { setup (props) {
const chartInfo = JSON.parse(JSON.stringify(props.chart)) const chartInfo = JSON.parse(JSON.stringify(props.chart))
console.info(chartInfo)
chartInfo.category = getTypeCategory(props.chart.type) chartInfo.category = getTypeCategory(props.chart.type)
return { return {
chartInfo, chartInfo,
@@ -1057,6 +1076,7 @@ export default {
isMapLine: isMapLine(props.chart.type), isMapLine: isMapLine(props.chart.type),
isMapBlock: isMapBlock(props.chart.type), isMapBlock: isMapBlock(props.chart.type),
isTabs: isTabs(props.chart.type), isTabs: isTabs(props.chart.type),
isGroup: isGroup(props.chart.type),
layout: getLayout(props.chart.type), layout: getLayout(props.chart.type),
myChart: shallowRef(null) myChart: shallowRef(null)
} }

View File

@@ -93,7 +93,9 @@ export default {
}, },
async mounted () { async mounted () {
await this.init() await this.init()
if (!this.$_.isEmpty(this.detailTabs)) {
this.currentTab = this.detailTabs[0].id + '' this.currentTab = this.detailTabs[0].id + ''
}
}, },
setup (props, ctx) { setup (props, ctx) {
// data // data