CN-35 perf: 动态chart单位高度

This commit is contained in:
chenjinsong
2021-07-01 21:39:10 +08:00
parent 49829ba9fc
commit a3673b3092
7 changed files with 75 additions and 205 deletions

View File

@@ -2,8 +2,12 @@
<div class="cn-chart cn-chart__single-value" :class="singleValueClass(type)">
<div class="single-value__icon"><i class="el-icon-apple"></i></div>
<div class="single-value__content" v-if="type === 51">
<div class="content__data">11112</div>
<div class="content__title">{{$t('common.save')}}</div>
<div class="content__data">
<slot name="data"></slot>
</div>
<div class="content__title">
<slot name="title"></slot>
</div>
</div>
<div class="single-value__content" v-if="type === 53">
<div class="content__title">嘻嘻</div>

View File

@@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
name: 'ChartTabs'
}
</script>
<style>
</style>

View File

@@ -145,17 +145,15 @@ const pieWithTable = {
const typeOptionMappings = [
{ value: 11, option: line }, // 常规折线图
{ value: 13, option: lineStack }, // 常规折线图
{ value: 31, option: pieWithTable }, // 常规折线图
{ value: 91, option: line }, // tab容器
{ value: 92, option: line }, // tab页
{ value: 93, option: line } // 大标题
{ value: 31, option: pieWithTable } // 常规折线图
]
const typeCategory = {
MAP: 'map',
TABLE: 'table',
ECHARTS: 'echarts',
TITLE: 'title',
SINGLE: 'singleValue'
SINGLE: 'singleValue',
TABS: 'tabs'
}
export function getTypeCategory (type) {
if (isMap(type)) {
@@ -168,6 +166,8 @@ export function getTypeCategory (type) {
return typeCategory.SINGLE
} else if (isTitle(type)) {
return typeCategory.TITLE
} else if (isTabs(type)) {
return typeCategory.TABS
}
}
/* 饼图柱状图等 */
@@ -202,9 +202,13 @@ export function isEchartsWithTable (type) {
export function isTable (type) {
return type >= 61 && type <= 70
}
/* title、tab等 */
/* title */
export function isTitle (type) {
return type >= 91
return type === 93
}
/* tabs */
export function isTabs (type) {
return type === 91
}
export function getOption (type) {
const mapping = typeOptionMappings.find(m => m.value === type)

View File

@@ -2,7 +2,7 @@
display: grid;
grid-template-columns: repeat(30, 1fr);
grid-auto-flow: row;
grid-auto-rows: #{$--chart-height-unit}px;
grid-auto-rows: var(--chart-height-unit);
grid-gap: 10px;
height: 100%;
width: 100%;
@@ -17,7 +17,7 @@
display: flex;
}
.cn-chart {
&>.cn-chart {
background-color: #FFFFFF;
border: 1px solid #E7EAED;
box-shadow: 0 2px 4px 0 rgba(51,51,51,0.02);
@@ -25,7 +25,7 @@
height: 100%;
width: 100%;
}
.cn-chart__echarts, .cn-chart__table, .cn-chart__map {
&>.cn-chart__echarts, &>.cn-chart__table, &>.cn-chart__map {
display: flex;
flex-direction: column;
.cn-chart__header {
@@ -53,14 +53,13 @@
}
}
}
.cn-chart__single-value.cn-chart__single-value--icon-left {
&>.cn-chart__single-value.cn-chart__single-value--icon-left {
display: flex;
justify-content: center;
justify-content: space-evenly;
align-items: center;
.single-value__icon {
position: relative;
margin-right: 7.5%;
width: 72px;
height: 72px;
background-color: $--chart-single-value-icon-background-color;
@@ -92,7 +91,7 @@
}
}
}
.cn-chart__single-value.cn-chart__single-value--icon-right {
&>.cn-chart__single-value.cn-chart__single-value--icon-right {
display: flex;
flex-direction: row-reverse;
justify-content: space-around;
@@ -140,7 +139,7 @@
}
}
}
.cn-chart__title {
&>.cn-chart__title {
display: flex;
align-items: center;
font-size: 20px;
@@ -150,7 +149,10 @@
box-shadow: none;
border: none;
}
.cn-chart__table {
&>.cn-chart__tabs {
}
&>.cn-chart__table {
.cn-chart__header {
border-bottom: 1px solid $--content-right-background-color;
.header__operations {