feat: chart-system 添加legend

This commit is contained in:
zhangyu
2021-12-29 14:29:37 +08:00
parent c8dc99d6c4
commit ff96da9ba5
5 changed files with 99 additions and 70 deletions

View File

@@ -53,6 +53,11 @@
line-height: 32px; line-height: 32px;
} }
} }
.chart-system-top-box {
.el-form-item__content {
line-height: 32px;
}
}
.chart-title-config { .chart-title-config {
border: 1px solid $--border-color-light; border: 1px solid $--border-color-light;
border-radius: 2px; border-radius: 2px;

View File

@@ -110,7 +110,7 @@ export default {
legend = chartInfo.elements[expressionIndex].expression legend = chartInfo.elements[expressionIndex].expression
} }
// 处理legend别名 // 处理legend别名
alias = chartInfo.datasource === 'system' ? '' : (alias + this.handleLegendAlias(legend, chartInfo.elements[expressionIndex].legend)) alias = alias + this.handleLegendAlias(legend, chartInfo.elements[expressionIndex].legend)
if (!alias) { if (!alias) {
alias = legend alias = legend
} }

View File

@@ -244,6 +244,7 @@ export default {
break break
} }
case 'system': { case 'system': {
this.chartInfo.elements = this.chartInfo.param.datasource
if (this.chartInfo.type === 'assetInfo') { if (this.chartInfo.type === 'assetInfo') {
this.$get('asset/asset/' + this.chartDetailInfo.id).then(res => { this.$get('asset/asset/' + this.chartDetailInfo.id).then(res => {
this.chartData = res.data this.chartData = res.data

View File

@@ -354,7 +354,8 @@ export default {
group: '', group: '',
select: '', select: '',
limit: 100, limit: 100,
sort: 'desc' sort: 'desc',
legend: ''
} }
], ],
valueMapping: [] valueMapping: []
@@ -439,6 +440,9 @@ export default {
if (this.editChart.param.enable.legend && !this.editChart.param.legend) { if (this.editChart.param.enable.legend && !this.editChart.param.legend) {
this.editChart.param.legend = { placement: 'bottom', values: [], show: true } this.editChart.param.legend = { placement: 'bottom', values: [], show: true }
} }
if (this.editChart.param.datasource && !this.editChart.param.datasource[0].legend) {
this.editChart.param.datasource[0].legend = ''
}
} }
} }
}, },

View File

@@ -7,6 +7,8 @@
label-position= "top" label-position= "top"
label-width="120px" label-width="120px"
> >
<div v-loading="loading" v-for="(item, index) in chartConfig.param.datasource " :key="index" class="chart-system-top-box">
<div class="chart-title chart-title-config"> <div class="chart-title chart-title-config">
<span class="chart-title-content el-form-item" :class="{ <span class="chart-title-content el-form-item" :class="{
'is-error' : systemNameShow[0].error, 'is-error' : systemNameShow[0].error,
@@ -26,7 +28,8 @@
</span> </span>
</div> </div>
<transition name="el-zoom-in-top"> <transition name="el-zoom-in-top">
<div class="system-chart-config" v-loading="loading" v-for="(item, index) in chartConfig.param.datasource " :key="index" v-show="systemNameShow[0].show"> <div v-show="systemNameShow[0].show">
<div class="system-chart-config">
<div class="system-chart-config-left"> <div class="system-chart-config-left">
<ul> <ul>
<li <li
@@ -91,7 +94,23 @@
</div> </div>
</div> </div>
</div> </div>
<el-row style="display: flex">
<el-col class="legend-title">
<span class="legend-title__span">{{$t('dashboard.panel.chartForm.legend')}}&nbsp;</span>
<el-popover placement="top" trigger="hover" width="211" popper-class="prevent-clickoutside">
<div :style="{'word-break':language!=='cn'?'keep-all':'break-all'}">{{$t('dashboard.panel.chartForm.legendTip')}}</div>
<i @mouseover="rz" class="nz-icon nz-icon-info-normal" slot="reference" style="font-size: 14px; -webkit-transform:scale(0.75);display:inline-block;"></i>
</el-popover>
</el-col>
<el-col style="flex: 1">
<el-form-item style="margin: 0 0 10px 0">
<el-input size="small" v-model="item.legend" @change="change" style="line-height: 32px"></el-input>
</el-form-item>
</el-col>
</el-row>
</div>
</transition> </transition>
</div>
<!--title--> <!--title-->
<div class="form__sub-title"> <div class="form__sub-title">
<span>{{$t('dashboard.panel.chartForm.displayConfig')}}</span> <span>{{$t('dashboard.panel.chartForm.displayConfig')}}</span>