CN-1456 feat: 折线图参考线等国际化

This commit is contained in:
chenjinsong
2023-11-21 14:33:16 +08:00
parent 6c1f1ed71b
commit e26d2b40ab
6 changed files with 34 additions and 14 deletions

View File

@@ -80,15 +80,15 @@ export const dataForNetworkOverviewLine = {
options2: [
{
value: 'Average',
label: 'Average'
label: 'overall.average'
},
{
value: '95th Percentile',
label: '95th Percentile'
label: ['overall.percentileNumber', { number: 95 }]
},
{
value: 'Maximum',
label: 'Maximum'
label: 'overall.maximum'
}
],
tabsTemplate: [
@@ -200,15 +200,15 @@ export const dataForDnsTrafficLine = {
options2: [
{
value: 'Average',
label: 'Average'
label: 'overall.average'
},
{
value: '95th Percentile',
label: '95th Percentile'
label: ['overall.percentileNumber', { number: 95 }]
},
{
value: 'Maximum',
label: 'Maximum'
label: 'overall.maximum'
}
],
tabs: [

View File

@@ -31,7 +31,7 @@
@change="metricChange"
>
<template #prefix>
<span class="select-prefix">Metric:</span>
<span class="select-prefix">{{$t('detections.metric')}}:</span>
</template>
<el-option v-for="item in metricOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>

View File

@@ -43,7 +43,7 @@
</div>
</div>-->
<div class="line-select-reference-line">
<span>{{$t('network.referenceLine')}}:</span>
<span>{{$t('network.referenceLine')}}&nbsp;:&nbsp;</span>
<div class="line-select__operation">
<el-select
size="mini"
@@ -54,7 +54,9 @@
:popper-append-to-body="false"
@change="referenceSelectChange"
>
<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"></el-option>
<el-option :key="options2[0].value" :label="$t(options2[0].label)" :value="options2[0].value"></el-option>
<el-option :key="options2[1].value" :label="$t(options2[1].label[0], options2[1].label[1])" :value="options2[1].value"></el-option>
<el-option :key="options2[2].value" :label="$t(options2[2].label)" :value="options2[2].value"></el-option>
</el-select>
</div>
</div>
@@ -255,6 +257,14 @@ export default {
label: {
formatter (params) {
const arr = unitConvert(params.value, unitTypes.number).join('')
const referIndex = _this.options2.findIndex(o => o.value === _this.lineRefer)
if (referIndex > -1) {
if (referIndex === 1) {
return _this.$t(_this.options2[1].label[0], _this.options2[1].label[1]) + '(' + arr + echartsData[0].unitType + ')'
} else {
return _this.$t(_this.options2[referIndex].label) + '(' + arr + echartsData[0].unitType + ')'
}
}
return _this.lineRefer + '(' + arr + echartsData[0].unitType + ')'
},
position: 'insideStartTop',

View File

@@ -37,7 +37,7 @@
</div>
<div class="line-select line-header-right">
<div class="line-select-metric">
<span>{{$t('network.metric')}}:</span>
<span>{{$t('detections.metric')}}:</span>
<div class="line-select__operation">
<el-select
size="mini"

View File

@@ -32,7 +32,7 @@
</div>
<div class="line-select line-header-right">
<div class="line-select-reference-line">
<span>{{ $t('network.referenceLine') }}:</span>
<span>{{ $t('network.referenceLine') }}&nbsp;:&nbsp;</span>
<div class="line-select__operation">
<el-select
size="mini"
@@ -43,7 +43,9 @@
:popper-append-to-body="false"
@change="referenceSelectChange"
>
<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"></el-option>
<el-option :key="options2[0].value" :label="$t(options2[0].label)" :value="options2[0].value"></el-option>
<el-option :key="options2[1].value" :label="$t(options2[1].label[0], options2[1].label[1])" :value="options2[1].value"></el-option>
<el-option :key="options2[2].value" :label="$t(options2[2].label)" :value="options2[2].value"></el-option>
</el-select>
</div>
</div>
@@ -274,6 +276,14 @@ export default {
label: {
formatter (params) {
const arr = valueToRangeValue(params.value, unitTypes.number).join('')
const referIndex = _this.options2.findIndex(o => o.value === _this.lineRefer)
if (referIndex > -1) {
if (referIndex === 1) {
return _this.$t(_this.options2[1].label[0], _this.options2[1].label[1]) + '(' + arr + echartsData[0].unitType + ')'
} else {
return _this.$t(_this.options2[referIndex].label) + '(' + arr + echartsData[0].unitType + ')'
}
}
return _this.lineRefer + '(' + arr + echartsData[0].unitType + ')'
},
position: 'insideStartTop',

View File

@@ -3,7 +3,7 @@
<div class="npm-traffic-line-header">
<div class="npm-traffic-line-title"></div>
<div class="line-select-metric">
<span>{{$t('network.metric')}}:</span>
<span>{{$t('detections.metric')}}:</span>
<div class="line-select__operation">
<el-select
size="mini"