From c92282ff76f3ff986b4798d0f95e9c3e61020ca7 Mon Sep 17 00:00:00 2001
From: chenyabin <Chenab123!>
Date: 星期一, 12 四月 2021 17:03:41 +0800
Subject: [PATCH] 日期选择组件,elelct 组件样式修改。
---
src/components/BaseNav/PublicBounced/GasComponents/Echarts.vue | 400 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 231 insertions(+), 169 deletions(-)
diff --git a/src/components/BaseNav/PublicBounced/GasComponents/Echarts.vue b/src/components/BaseNav/PublicBounced/GasComponents/Echarts.vue
index 3ac2e52..a803441 100644
--- a/src/components/BaseNav/PublicBounced/GasComponents/Echarts.vue
+++ b/src/components/BaseNav/PublicBounced/GasComponents/Echarts.vue
@@ -1,5 +1,5 @@
<template>
- <div style="width:100%;height:2rem;" ref="echarts"></div>
+ <div style="width:5rem;height:2rem;margin-top: 0.3rem" ref="echarts"></div>
</template>
<script>
@@ -12,185 +12,247 @@
name: 'ECharts',
data () {
return {
+ days: dayjs(new Date()).format('YYYYMMDDHHmmss'),
myChart: [],
- dataDate: [],
- value: '',
+ // x杞存暟鎹�
+ xAxis: [],
seriesData: [],
- aseries: '',
- result: [],
- days: dayjs(new Date()).format('YYYYMMDDHHmmss')
- }
- },
- methods: {
- drawChart (result) {
- // const result = this.result
- this.myChart = this.$echarts.init(this.$refs.echarts)
-
- // setInterval(function () {
- // }, 3000)
- const option = {
- title: {
- text: '鎶樼嚎鍥惧爢鍙�'
- },
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: ['閭欢钀ラ攢', '鑱旂洘骞垮憡', '瑙嗛骞垮憡', '鐩存帴璁块棶', '鎼滅储寮曟搸']
- },
- grid: {
- containLabel: true
- },
- toolbox: {
- feature: {
- saveAsImage: {
- show: false
- }
- }
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- // data: seriesData,
- data: ['鍛ㄤ竴', '鍛ㄤ簩', '鍛ㄤ笁', '鍛ㄥ洓', '鍛ㄤ簲', '鍛ㄥ叚', '鍛ㄦ棩'],
- axisLine: {
- lineStyle: {
- color: '#FFFFFF',
- width: 1
- }
- }
- },
- yAxis: {
- type: 'value',
- axisLine: {
- lineStyle: {
- color: '#FFFFFF',
- width: 1
- }
- }
- },
- series: [
- {
- name: '閭欢钀ラ攢',
- type: 'line',
- stack: '鎬婚噺',
- data: [120, 132, 101, 134, 90, 230, 210]
- },
- {
- name: '鑱旂洘骞垮憡',
- type: 'line',
- stack: '鎬婚噺',
- data: [220, 182, 191, 234, 290, 330, 310]
- },
- {
- name: '瑙嗛骞垮憡',
- type: 'line',
- stack: '鎬婚噺',
- data: [150, 232, 201, 154, 190, 330, 410]
- },
- {
- name: '鐩存帴璁块棶',
- type: 'line',
- stack: '鎬婚噺',
- data: [320, 332, 301, 334, 390, 330, 320]
- },
- {
- name: '鎼滅储寮曟搸',
- type: 'line',
- stack: '鎬婚噺',
- data: [820, 932, 901, 934, 1290, 1330, 1320]
- }
- ]
- }
- this.myChart.setOption(option)
- },
- async echartsData () {
- const addDays = dayjs().add(300, 'day')
- const data = {
- $tagCodeList: 'TJIP45.yyqAI90305,TJIP45.yyqAI90303,TJIP45.yyqFI_90310N,TJIP45.yyqAI90304,TJIP45.yyqAIR001',
- $startTime: this.dayjs,
- $endTime: addDays,
- $step: 15
- }
- const result = await mapApi.DataItems(data)
- this.result = result.data
- },
- // 鏁版嵁鐨勮姹�
- requestEcharts () {
- setInterval(async () => {
- const addDays = dayjs().add(300, 'day')
- const data = {
- $tagCodeList: 'TJIP45.yyqAI90305,TJIP45.yyqAI90303,TJIP45.yyqFI_90310N,TJIP45.yyqAI90304,TJIP45.yyqAIR001',
- $startTime: this.dayjs,
- $endTime: addDays,
- $step: 15
- }
- const result = await mapApi.DataItems(data)
- this.result = result.data
- for (let i = 0; i < result.length; i++) {
- // // console.log(result[i])
-
- const seriesData = []
- const aseries = []
- // let nameData = ''
-
- seriesData.push(result[i].ReadTime)
- aseries.push(result[i].TagValue)
- // nameData = result[i].UnionTagCode
- this.aseries = result[i].UnionTagCode
- }
- this.myChart.setOption({
- series: [{
- data: data
- }]
- })
- }, 3000)
+ seriesName: []
}
},
mounted () {
this.$nextTick(() => {
- this.requestEcharts()
- this.drawChart()
+ this.initEchartsData()
+ this.upDateEchartsData()
})
+ },
+ methods: {
+ // 鍒濆鍖栨暟鎹�
+ async initEchartsData () {
+ const endTime = dayjs().add(1, 's')
+ const data = {
+ $tagCodeList: 'TJIP45.yyqAI90305,TJIP45.yyqAI90303,TJIP45.yyqFI_90310N,TJIP45.yyqAI90304,TJIP45.yyqAIR001',
+ $startTime: this.dayjs,
+ $endTime: endTime,
+ $step: 15
+ }
+ const result = (await mapApi.DataItems(data)).data
+ for (var i = 0; i < result.length; i++) {
+ // console.log(result[i])
+ this.xAxis.push(result[i].ReadTime)
+ this.seriesData.push(result[i].TagValue)
+ this.seriesName = result[i].UnionTagCode
+ }
+ this.upDateEchartsinit()
+ },
+ // 瀹炴椂鏁版嵁鍒锋柊
+ upDateEchartsData () {
+ // const interValHander =
+ setInterval(async () => {
+ const endTime = dayjs().add(1, 's')
+ const data = {
+ $tagCodeList: 'TJIP45.yyqAI90305,TJIP45.yyqAI90303,TJIP45.yyqFI_90310N,TJIP45.yyqAI90304,TJIP45.yyqAIR001',
+ $startTime: this.dayjs,
+ $endTime: endTime,
+ $step: 15
+ }
+ const result = (await mapApi.DataItems(data)).data
+ for (var i = 0; i < result.length; i++) {
+ // console.log(result[i])
+ // this.xAxis.shift()
+ this.xAxis.push(result[i].ReadTime)
+ this.seriesData.push(result[i].TagValue)
+ this.seriesName = result[i].UnionTagCode
+ }
+ this.upDateEchartsinit()
+ }, 1500)
+ },
+ // 鍒濆鍖杄charts
+ upDateEchartsinit () {
+ this.myChart = this.$echarts.init(this.$refs.echarts)
+ // 鍥捐〃鐨勯厤缃」鏁版嵁
+ const xAxisData = this.xAxis
+ const legendData = [this.seriesName, 'TJIP45.lscl2tb552AISA11201B', 'TJIP45.lscl2tb552AISA11202A', 'TJIP45.lscl2tbAIA-10505-1', 'TJIP45.lscl2tbAIA-10505-2']
+ const seriesData = [
+ {
+ name: this.seriesName,
+ type: 'line',
+ stack: '鎬婚噺',
+ data: this.seriesData
+ },
+ {
+ name: 'TJIP45.lscl2tb552AISA11201B',
+ type: 'line',
+ stack: '鎬婚噺',
+ data: [2.20, 1.82, 1.91, 2.34, 2.90, 3.30, 3.10]
+ }
+ ]
+ const option = {
+ title: {
+ // text: '瀹炴椂鏁版嵁',
+ target: 'blank',
+ left: '5%',
+ textStyle: {
+ color: '#fff',
+ fontSize: 15,
+ bottom: 20
+ }
+ },
+ tooltip: {
+ trigger: 'axis',
+ axisPointer: {
+ type: 'cross',
+ label: {
+ color: '#1a4245'
+ }
+ }
+ // formatter: function (params) {
+ // // console.log(params)
+ // var UnionTagCode = params[0].seriesName + '<br />'
+ // for (var i = 0; i < params.length; i++) {
+ // var seriesName = params[i].seriesName
+ // // 鍊�
+ // var value = params[i].value[1]
+ //
+ // // var valueFliter = formatter(value)
+ // var valueFliter = value
+ //
+ // var maker = params[i].marker
+ // var colo = ''
+ // switch (seriesName) {
+ // case 'TJIP45.lscl2tb552AI10710':
+ // colo = '#fff21c'
+ // break
+ // default:
+ // colo = 'red'
+ // break
+ // }
+ // maker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:' + colo + ';"></span>'
+ // UnionTagCode += maker + seriesName + ':' + valueFliter + '<br />'
+ // }
+ // return UnionTagCode
+ // }
+ },
+ grid: {
+ top: '20%'
+ },
+ toolbox: {
+ show: false,
+ feature: {
+ saveAsImage: {}
+ }
+ },
+ dataZoom: [{
+ type: 'inside',
+ start: 0,
+ end: 100
+ }, {
+ start: 0,
+ end: 100,
+ show: false,
+ handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
+ handleSize: '80%',
+ handleStyle: {
+ color: '#fff',
+ shadowBlur: 3,
+ shadowColor: 'rgba(0, 0, 0, 0.6)',
+ shadowOffsetX: 2,
+ shadowOffsetY: 2
+ }
+ }],
+ legend: {
+ data: legendData,
+ textStyle: {
+ color: '#ffffff',
+ fontSize: 12
+ }
+ },
+ xAxis: {
+ type: 'category',
+ // type: 'time',
+ boundaryGap: false,
+ axisLabel: {
+ margin: 6,
+ interval: 0,
+ textStyle: {
+ color: '#fff'
+ }
+ },
+ splitLine: {
+ show: true,
+ lineStyle: {
+ type: 'dashed'
+ }
+ },
+ axisTick: {
+ show: false
+ },
+ axisLine: {
+ lineStyle: {
+ color: '#FFFFFF',
+ width: 1
+ }
+ },
+ data: xAxisData
+ },
+ yAxis: [{
+ type: 'value',
+ name: 'yname',
+ // max: function (value) {
+ // var max_val_list = []; //鎵�鏈夋樉绀烘姌绾跨殑鏍囧噯鍊�
+ // if (bzzList && bzzList.length > 0) {
+ // $.each(bzzList, function (index, item) {
+ // max_val_list.push(item.bzhui);
+ // });
+ // }
+ // max_val_list = max_val_list.sort(function (a, b) {
+ // return a - b
+ // }); //鎺掑簭
+ // var ma = value.max > max_val_list[max_val_list.length - 1] ? value.max + 5 : max_val_list[max_val_list.length - 1];
+ // return parseInt(ma);
+ // },
+ axisLabel: {
+ formatter: '{value}',
+ textStyle: {
+ color: '#fff'
+ }
+ },
+ splitLine: {
+ show: false
+ }, // y杞� 缃戞牸绾夸笉鏄剧ず,
+ axisLine: {
+ lineStyle: {
+ color: '#FFFFFF',
+ width: 1
+ }
+ }
+ }, {
+ type: 'value',
+ name: 'dataUnit',
+ axisLabel: {
+ formatter: '{value}',
+ textStyle: {
+ color: '#fff'
+ }
+ },
+ splitLine: {
+ show: false
+ },
+ axisLine: {
+ lineStyle: {
+ color: '#FFFFFF',
+ width: 1
+ }
+ }
+ }],
+ series: seriesData
+ }
+ this.myChart.setOption(option)
+ }
}
}
</script>
<style scoped lang="less">
-.Infomation {
- margin-left: 10px;
- height: 0.2rem;
-}
-.el-tag {
- height: 25px;
- width: 140px;
- line-height: 25px;
- margin-right: 10px;
- font-size: 10px;
- background-color: rgba(0, 255, 246, 0.14);
- color: #00d0f9;
- border: none;
- padding: 0 15px;
-}
-
-.form-echrts {
- width: 100%;
- height: 1rem;
- border-top: 1px solid #396d83;
- //margin: 10px 10px 10px 10px;
- .el-dialog-div {
- //height: 50vh!important;
- overflow: auto;
- //overflow: hidden;
- }
-
- #echarts {
- margin: 0;
- padding: 0;
- //height: 3rem;
- //border: 1px solid #396d83;
- //margin: 10px 10px 10px 10px;
- }
-}
</style>
--
Gitblit v1.8.0