diff --git a/src/api/device-boot/communicate.ts b/src/api/device-boot/communicate.ts new file mode 100644 index 00000000..6d20ef14 --- /dev/null +++ b/src/api/device-boot/communicate.ts @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// 事件分析 获取数据 +export function getRunOnlineRateData(data) { + return request({ + url: "/device-boot/communicate/getRunOnlineRateData", + method: "post", + data + }); +} +// 事件分析 运行状态 获取数据 +export function getComFlagInfoData(data) { + return request({ + url: "/device-boot/communicate/getComFlagInfoData", + method: "post", + data + }); +} \ No newline at end of file diff --git a/src/components/echarts/MyEchart.vue b/src/components/echarts/MyEchart.vue index fcb634a0..466cfc79 100644 --- a/src/components/echarts/MyEchart.vue +++ b/src/components/echarts/MyEchart.vue @@ -8,6 +8,7 @@ import { onBeforeUnmount, onMounted, ref, defineExpose, watch } from 'vue' import * as echarts from 'echarts' // 全引入 import 'echarts-gl' import 'echarts/lib/component/dataZoom' +import { color, gradeColor } from './color' const chartRef = ref() @@ -24,7 +25,7 @@ const initChart = () => { chart?.dispose() chart = echarts.init(chartRef.value as HTMLDivElement) - chart.setOption({ + const options = { title: { left: 'center', textStyle: { @@ -35,7 +36,6 @@ const initChart = () => { }, tooltip: { trigger: 'axis', - axisPointer: { type: 'shadow', label: { @@ -75,47 +75,56 @@ const initChart = () => { }, xAxis: props.options.xAxis ? handlerXAxis() : null, yAxis: props.options.yAxis ? handlerYAxis() : null, - dataZoom: [ + dataZoom: props.options.dataZoom || [ { type: 'inside', height: 13, start: 0, bottom: '20px', - end: 100, - ...(props.options.dataZoom || null) + end: 100 }, { start: 0, height: 13, bottom: '20px', - end: 100, - ...(props.options.dataZoom || null) + end: 100 } ], - color: [ - ...(props.options.color || ''), - '#07CCCA', - '#00BFF5', - '#FFBF00', - '#77DA63', - '#D5FF6B', - '#Ff6600', - '#FF9100', - '#5B6E96', - '#66FFCC', - '#B3B3B3' - ], + color: props.options.color || color, series: props.options.series, ...props.options.options - }) + } + handlerBar(options) + // 处理柱状图 + chart.setOption(options) setTimeout(() => { chart.resize() }, 0) } +const handlerBar = (options: any) => { + if (Array.isArray(options.series)) { + options.series.forEach((item: any) => { + if (item.type === 'bar') { + item.barMinHeight = 10 + item.itemStyle = Object.assign( + { + color: (params: any) => { + console.log(params) + if (params.value == 0 || params.value == 3.14159) { + return '#ccc' + } else { + return color[params.seriesIndex] + } + } + } + ) + } + }) + } +} const handlerYAxis = () => { let temp = { type: 'value', - nameTextStyle: { color: '#000' }, diff --git a/src/components/echarts/color.ts b/src/components/echarts/color.ts new file mode 100644 index 00000000..ca9626ed --- /dev/null +++ b/src/components/echarts/color.ts @@ -0,0 +1,13 @@ +export const color = [ + '#07CCCA', + '#00BFF5', + '#FFBF00', + '#77DA63', + '#D5FF6B', + '#Ff6600', + '#FF9100', + '#5B6E96', + '#66FFCC', + '#B3B3B3' +] +export const gradeColor = ['#339966', '#FFCC33', '#CC0000'] diff --git a/src/views/pms/voltageSags/monitoringPoint/online/eventStatistics/ITICquxianfenxi/index.vue b/src/views/pms/voltageSags/monitoringPoint/online/eventStatistics/ITICquxianfenxi/index.vue index f6efc006..d2eee35a 100644 --- a/src/views/pms/voltageSags/monitoringPoint/online/eventStatistics/ITICquxianfenxi/index.vue +++ b/src/views/pms/voltageSags/monitoringPoint/online/eventStatistics/ITICquxianfenxi/index.vue @@ -1,7 +1,7 @@