perf: 优化实体详情标题样式

This commit is contained in:
chenjinsong
2022-02-08 18:15:58 +08:00
parent f365d8bb11
commit 088f1980e1
9 changed files with 52 additions and 14 deletions

View File

@@ -1,5 +1,9 @@
.cn-chart__single-value { .cn-chart__single-value {
&.cn-chart__single-value--detail-overview.cn-chart__single-value--icon-left { &.cn-chart__single-value--detail-overview.cn-chart__single-value--icon-left {
width: unset;
flex: 0 0 240px;
flex-wrap: wrap;
.single-value__icon { .single-value__icon {
width: 38px; width: 38px;
height: 38px; height: 38px;

View File

@@ -61,11 +61,27 @@
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
&.chart-header__title--block { &.chart-header__title--block {
color: #1890FF; color: #1890FF;
font-weight: bold; font-weight: bold;
font-size: 16px; font-size: 16px;
} }
.arrow-icon {
display: inline-block;
transform: rotate(0);
transition: all linear .2s;
&.reg-down {
transform: rotate(90deg);
}
i {
font-size: 12px;
color: #999;
}
}
} }
.chart-header__tools { .chart-header__tools {
display: flex; display: flex;

View File

@@ -37,6 +37,7 @@
.overview__row { .overview__row {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap;
padding: 2px 0; padding: 2px 0;
font-size: 14px; font-size: 14px;

View File

@@ -1,13 +1,19 @@
<template> <template>
<div class="chart-header" :class="{'chart-header--title-chart': isTitle, 'is-group-collapse': chartInfo.params&&chartInfo.params.collpase, 'panel-chart-block': isBlock}"> <div class="chart-header" :class="{'chart-header--title-chart': isTitle, 'is-group-collapse': isGroup, 'panel-chart-block': isBlock}">
<div class="chart-header__title" v-if="!isCurrentTable&&(isGroup)" :class="{'chart-header__title--block': isBlock}"> <div class="chart-header__title" v-if="isGroup">
<span @click="groupShow"> <i class="cn-icon" :class="chartInfo.params&&chartInfo.params.collpase ? 'cn-icon-arrow-right': 'cn-icon-arrow-down'"></i></span> <span
@click="groupShow"
v-if="chartInfo.params && chartInfo.params.collapsable"
class="arrow-icon"
:class="{'reg-down': chartInfo.params && !chartInfo.params.collapse}"
>
<i class="cn-icon cn-icon-arrow-right"></i>
</span>
{{chartInfo.name}} {{chartInfo.name}}
</div> </div>
<div class="chart-header__title" v-else-if="!isCurrentTable" :class="{'chart-header__title--block': isBlock}">{{chartInfo.name}}</div> <div class="chart-header__title" v-else-if="!isCurrentTable" :class="{'chart-header__title--block': isBlock}">{{chartInfo.name}}</div>
<template v-if="isCurrentTable"> <template v-if="isCurrentTable">
<div class="chart-header__title"> <div class="chart-header__title">
<!-- -->
<span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span> <span :title="chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name">{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}</span>
<span <span
v-if="chartInfo.params && chartInfo.params.as" v-if="chartInfo.params && chartInfo.params.as"
@@ -101,7 +107,7 @@
<span class="header__operation-btn"><i class="cn-icon el-icon-info"></i></span> <span class="header__operation-btn"><i class="cn-icon el-icon-info"></i></span>
</template> </template>
</el-popover> </el-popover>
<span class="header__operation-btn" @click="refresh"><i class="cn-icon cn-icon-refresh"></i></span> <span class="header__operation-btn" @click="refresh" v-if="showRefreshButton"><i class="cn-icon cn-icon-refresh"></i></span>
</template> </template>
</div> </div>
</div> </div>
@@ -198,6 +204,14 @@ export default {
this.$emit('orderPieTableChange', this.orderPieTable) this.$emit('orderPieTableChange', this.orderPieTable)
} }
}, },
computed: {
showRefreshButton () {
// 自己是group且父元素是block时不显示刷新按钮
// TODO 父元素是block且只有自己一个子元素时不显示刷新按钮
const isGroupAndParentIsBlock = this.chartInfo.parent.type === 95 && this.isGroup
return !isGroupAndParentIsBlock
}
},
setup (props) { setup (props) {
const dateRangeValue = 60 const dateRangeValue = 60
const { startTime, endTime } = getNowTime(dateRangeValue) const { startTime, endTime } = getNowTime(dateRangeValue)

View File

@@ -113,14 +113,14 @@ export default {
this.detailChartList = this.detailTabs[index].children this.detailChartList = this.detailTabs[index].children
}, },
recursionParamsConvert (chart) { recursionParamsConvert (chart) {
chart.params = chart.params ? JSON.parse(chart.params) : null chart.params = chart.params ? JSON.parse(chart.params) : {}
if (chart.type === 94) { if (chart.type === 94) {
chart.oldH = chart.h chart.oldH = chart.h
chart.params = { /* chart.params = {
collpase: false collapse: false
} } */
chart.h = getGroupHeight(chart.children) + 1.5 chart.h = getGroupHeight(chart.children) + 1.5
if (chart.params.collpase) { if (chart.params.collapse) {
chart.h = 1 chart.h = 1
} }
} }

View File

@@ -25,7 +25,7 @@
<!-- 数据查询后传入chart组件chart组件内不查询只根据接传递的数据来渲染 --> <!-- 数据查询后传入chart组件chart组件内不查询只根据接传递的数据来渲染 -->
<chart <chart
ref="chart" ref="chart"
v-if="((!isGroup) || !(chartInfo.params && chartInfo.params.collpase)) && !isTitle" v-if="((!isGroup) || !(chartInfo.params && chartInfo.params.collapse)) && !isTitle"
:chart-data="chartData" :chart-data="chartData"
:result-type="resultType" :result-type="resultType"
:chart-info="chartInfo" :chart-info="chartInfo"

View File

@@ -122,8 +122,8 @@ export default {
groupShow (chart) { groupShow (chart) {
this.copyDataList.forEach((item, index) => { this.copyDataList.forEach((item, index) => {
if (item.id === chart.id) { if (item.id === chart.id) {
item.params.collpase = !item.params.collpase item.params.collapse = !item.params.collapse
if (item.params.collpase) { if (item.params.collapse) {
item.h = 1 item.h = 1
} else { } else {
item.h = getGroupHeight(item.children) + 1.5 item.h = getGroupHeight(item.children) + 1.5
@@ -134,7 +134,7 @@ export default {
this.emitter.emit('groupParentCalcHeight', { chart, childrenList: this.copyDataList }) this.emitter.emit('groupParentCalcHeight', { chart, childrenList: this.copyDataList })
}, },
groupParentCalcHeight (chart, childrenList) { groupParentCalcHeight (chart, childrenList) {
console.log(chart, childrenList) // console.log(chart, childrenList)
setTimeout(() => { setTimeout(() => {
const parent = this.copyDataList.find(chartitem => chartitem.id === chart.parent.id) const parent = this.copyDataList.find(chartitem => chartitem.id === chart.parent.id)
const children = parent.children.find(item => item.id === chart.id) const children = parent.children.find(item => item.id === chart.id)

View File

@@ -18,6 +18,7 @@ export default {
timeFilter: Object timeFilter: Object
}, },
mounted () { mounted () {
console.info(this.chartInfo)
} }
} }
</script> </script>

View File

@@ -79,6 +79,8 @@
v-for="(chartInfo, i) in singleValues.chartInfos" v-for="(chartInfo, i) in singleValues.chartInfos"
:chart-info="chartInfo" :chart-info="chartInfo"
:chart-data="singleValues.chartDatas[i]" :chart-data="singleValues.chartDatas[i]"
:key="i"
class="cn-chart__single-value--detail-overview"
></chart-single-value> ></chart-single-value>
</div> </div>
</div> </div>