update i18n
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
|
||||
<div class="close-row">
|
||||
<el-radio-group v-model="dataType" class="head-radio-group" size="small" @change="setLegend">
|
||||
<el-radio-button label="百分比" />
|
||||
<el-radio-button label="时间" />
|
||||
<el-radio-button :label="$t('eq.ratio')" />
|
||||
<el-radio-button :label="$t('eq.time')" />
|
||||
</el-radio-group>
|
||||
|
||||
<el-radio-group v-if="1" v-model="searchType" class="head-radio-group" style="margin-left: 8px;" size="small" @change="handleRadioGroupChanged">
|
||||
@@ -34,12 +34,13 @@
|
||||
import * as echarts from 'echarts'
|
||||
import moment from 'moment'
|
||||
import { pick } from 'lodash/object'
|
||||
import i18n from '../../../i18n'
|
||||
|
||||
class EchartConfigs {
|
||||
constructor() {
|
||||
this.color = ['#e91e63', '#4caf50', '#3f51b5', '#ffc107', '#607d8b']
|
||||
this.title = {
|
||||
text: '时间区间走势',
|
||||
text: i18n.t('eq.timetrend'),
|
||||
top: 0,
|
||||
left: 'center',
|
||||
textStyle: {
|
||||
@@ -113,10 +114,10 @@ export default {
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
searchType: '无间隔',
|
||||
searchRadioOptions: ['无间隔', '按月', '按周', '按天'],
|
||||
dataType: '时间',
|
||||
dataRadioOptions: ['时间', '百分比'],
|
||||
searchType: i18n.t('eq.nogap'),
|
||||
searchRadioOptions: [i18n.t('eq.nogap'), i18n.t('eq.monthgap'), i18n.t('eq.weekgap'), i18n.t('eq.daygap')],
|
||||
dataType: i18n.t('eq.time'),
|
||||
dataRadioOptions: [i18n.t('eq.time'), i18n.t('eq.ratio')],
|
||||
config: new EchartConfigs(),
|
||||
chart: null,
|
||||
rateList: [], // 对请求来的数据分流
|
||||
@@ -127,7 +128,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async initChart() {
|
||||
this.config.setTitle(this.injectData.equipmentName + '时间区间走势')
|
||||
this.config.setTitle(this.injectData.equipmentName + i18n.t('eq.timetrend'))
|
||||
await this.getList()
|
||||
this.setLegend()
|
||||
},
|
||||
@@ -146,11 +147,11 @@ export default {
|
||||
|
||||
makeQuerys() {
|
||||
const searchTypeMap = {
|
||||
无间隔: 1,
|
||||
按月: 2,
|
||||
按周: 3,
|
||||
按天: 4,
|
||||
按小时: 5
|
||||
[i18n.t('eq.nogap')]: 1,
|
||||
[i18n.t('eq.monthgap')]: 2,
|
||||
[i18n.t('eq.weekgap')]: 3,
|
||||
[i18n.t('eq.daygap')]: 4,
|
||||
[i18n.t('eq.hourgap')]: 5
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -189,11 +190,11 @@ export default {
|
||||
// 分流
|
||||
datalist.map(item => {
|
||||
const time = moment(item.time)
|
||||
if (this.searchType === '按月') {
|
||||
this.xAxis.push(`${time.year()}年${time.month() + 1}月`)
|
||||
} else if (this.searchType === '按周') {
|
||||
if (this.searchType === i18n.t('eq.monthgap')) {
|
||||
this.xAxis.push(`${time.year()}${i18n.t('eq.year')}${time.month() + 1}${i18n.t('eq.month')}`)
|
||||
} else if (this.searchType === i18n.t('eq.weekgap')) {
|
||||
this.xAxis.push(`${time.format('YYYY-MM-DD')}`)
|
||||
} else if (this.searchType === '按天') {
|
||||
} else if (this.searchType === i18n.t('eq.daygap')) {
|
||||
this.xAxis.push(`${time.format('YY-M-D')}`)
|
||||
} else {
|
||||
this.xAxis.push(`${time.format('YYYY-MM-DD')}`)
|
||||
@@ -218,8 +219,16 @@ export default {
|
||||
setLegend() {
|
||||
// 设置legend
|
||||
const legendMap = {
|
||||
百分比: ['工作时长比率', '停机时长比率', '故障时长比率', '速度开动率', '时间开动率', 'OEE', 'TEEP'],
|
||||
时间: ['工作时长', '停机时长', '故障时长']
|
||||
[i18n.t('eq.ratio')]: [
|
||||
i18n.t('eq.workdurationratio'),
|
||||
i18n.t('eq.stopdurationratio'),
|
||||
i18n.t('eq.downdurationratio'),
|
||||
i18n.t('eq.speedefficiency'),
|
||||
i18n.t('eq.timeefficiency'),
|
||||
'OEE',
|
||||
'TEEP'
|
||||
],
|
||||
[i18n.t('eq.time')]: [i18n.t('eq.worktime'), i18n.t('eq.stoptime'), i18n.t('eq.downtime')]
|
||||
}
|
||||
this.config.setLegend(legendMap[this.dataType])
|
||||
this.setData()
|
||||
@@ -228,7 +237,7 @@ export default {
|
||||
},
|
||||
|
||||
setData() {
|
||||
if (this.dataType === '时间') {
|
||||
if (this.dataType === i18n.t('eq.time')) {
|
||||
const workTimeList = []
|
||||
const stopTimeList = []
|
||||
const downTimeList = []
|
||||
@@ -238,9 +247,9 @@ export default {
|
||||
downTimeList.push(item.downTime)
|
||||
})
|
||||
this.config.setSeries([
|
||||
{ name: '工作时长', type: 'bar', data: workTimeList },
|
||||
{ name: '停机时长', type: 'bar', data: stopTimeList },
|
||||
{ name: '故障时长', type: 'bar', data: downTimeList }
|
||||
{ name: i18n.t('eq.worktime'), type: 'bar', data: workTimeList },
|
||||
{ name: i18n.t('eq.stoptime'), type: 'bar', data: stopTimeList },
|
||||
{ name: i18n.t('eq.downtime'), type: 'bar', data: downTimeList }
|
||||
])
|
||||
} else {
|
||||
// 百分比
|
||||
@@ -261,11 +270,11 @@ export default {
|
||||
teepList.push(item.teep)
|
||||
})
|
||||
this.config.setSeries([
|
||||
{ name: '工作时长比率', type: 'bar', data: workRateList },
|
||||
{ name: '停机时长比率', type: 'bar', data: stopRateList },
|
||||
{ name: '故障时长比率', type: 'bar', data: downRateList },
|
||||
{ name: '速度开动率', type: 'bar', data: peEfficiencyList },
|
||||
{ name: '时间开动率', type: 'bar', data: timeEfficiencyList },
|
||||
{ name: i18n.t('eq.workdurationratio'), type: 'bar', data: workRateList },
|
||||
{ name: i18n.t('eq.stopdurationratio'), type: 'bar', data: stopRateList },
|
||||
{ name: i18n.t('eq.downdurationratio'), type: 'bar', data: downRateList },
|
||||
{ name: i18n.t('eq.speedefficiency'), type: 'bar', data: peEfficiencyList },
|
||||
{ name: i18n.t('eq.timeefficiency'), type: 'bar', data: timeEfficiencyList },
|
||||
{ name: 'OEE', type: 'bar', data: oeeList },
|
||||
{ name: 'TEEP', type: 'bar', data: teepList }
|
||||
])
|
||||
@@ -278,8 +287,8 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
// this.chart.setOption(this.config)
|
||||
this.chart.setOption(this.config, {
|
||||
notMerge: true
|
||||
})
|
||||
notMerge: true
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user