|
@@ -1,167 +1,142 @@
|
|
<template>
|
|
<template>
|
|
<div shadow="never" class="homeBoxCard" v-loading="loading">
|
|
<div shadow="never" class="homeBoxCard" v-loading="loading">
|
|
- <div
|
|
|
|
- style="height: 400px; width: 700px"
|
|
|
|
- ref="lineChartBanlance"
|
|
|
|
- v-show="flag"
|
|
|
|
- />
|
|
|
|
|
|
+ <div class="height400" ref="lineChartBanlance" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import { defineComponent, onMounted, ref, watch } from 'vue'
|
|
|
|
-import * as echarts from 'echarts'
|
|
|
|
-
|
|
|
|
|
|
+import { defineComponent, onMounted, ref, watch } from 'vue'
|
|
|
|
+// import * as echarts from 'echarts'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
- name: 'innerLineChart',
|
|
|
|
|
|
+ name: 'lineChartValue',
|
|
props: {
|
|
props: {
|
|
yinSuChart: Object,
|
|
yinSuChart: Object,
|
|
- aa: Number,
|
|
|
|
|
|
+ // electricChartData:Object
|
|
},
|
|
},
|
|
setup(props) {
|
|
setup(props) {
|
|
- const flag = ref(true)
|
|
|
|
let lineChartBanlance = ref(null)
|
|
let lineChartBanlance = ref(null)
|
|
|
|
+ // const electricChart=ref({})
|
|
|
|
|
|
// 读取数据 func
|
|
// 读取数据 func
|
|
const loading = ref(true)
|
|
const loading = ref(true)
|
|
|
|
+ const getData = async () => {
|
|
|
|
|
|
-
|
|
|
|
- const getData = async () => {
|
|
|
|
- console.log('子组件中的props.yinSuChart.cos')
|
|
|
|
- // console.log(props.yinSuChart)
|
|
|
|
|
|
+ console.log('子字组件中的props.yinSuChart')
|
|
console.log(props.yinSuChart)
|
|
console.log(props.yinSuChart)
|
|
- console.log(props.yinSuChart.dataTime)
|
|
|
|
|
|
+
|
|
|
|
|
|
loading.value = false
|
|
loading.value = false
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- function echarts2() {
|
|
|
|
- let myChart = echarts.init(lineChartBanlance.value)
|
|
|
|
- // 绘制图表
|
|
|
|
- myChart.setOption({
|
|
|
|
- color: ['#1187FF'],
|
|
|
|
- legend: {
|
|
|
|
- top: '0',
|
|
|
|
- data: ['功率因素'],
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- tooltip: {
|
|
|
|
- trigger: 'axis',
|
|
|
|
- axisPointer: { type: 'cross' },
|
|
|
|
- },
|
|
|
|
- grid: {
|
|
|
|
- left: '20',
|
|
|
|
- right: '40',
|
|
|
|
- top: '50',
|
|
|
|
- bottom: '30',
|
|
|
|
- containLabel: true,
|
|
|
|
- },
|
|
|
|
- xAxis: {
|
|
|
|
- axisLabel: {
|
|
|
|
- color: '#444',
|
|
|
|
- fontSize: 14,
|
|
|
|
- },
|
|
|
|
- /*改变xy轴颜色*/
|
|
|
|
- axisLine: {
|
|
|
|
- lineStyle: {
|
|
|
|
- color: '#444',
|
|
|
|
- width: 1, //这里是为了突出显示加上的
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- boundaryGap: false,
|
|
|
|
- // data: props.value.dataTime,
|
|
|
|
- // data: [1, 2, 3, 4, 5, 6, 7, 8],
|
|
|
|
- },
|
|
|
|
- yAxis: {
|
|
|
|
- name: '%',
|
|
|
|
- nameTextStyle: {
|
|
|
|
- color: 'black',
|
|
|
|
- fontSize: 10,
|
|
|
|
- },
|
|
|
|
- type: 'value',
|
|
|
|
- axisTick: {
|
|
|
|
- show: true, //去除刻度线
|
|
|
|
- },
|
|
|
|
- axisLabel: {
|
|
|
|
- color: 'black', // 文本颜色
|
|
|
|
- },
|
|
|
|
- axisLine: {
|
|
|
|
- show: true, // 去除轴线
|
|
|
|
- lineStyle: {
|
|
|
|
- color: 'black',
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- splitNumber: 5,
|
|
|
|
- splitLine: {
|
|
|
|
- show: true,
|
|
|
|
- lineStyle: {
|
|
|
|
- color: '#9d9d9d',
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- series: [
|
|
|
|
- {
|
|
|
|
- name: '电流不平衡度',
|
|
|
|
- type: 'line',
|
|
|
|
- symbolSize: 7,
|
|
|
|
- smooth: false,
|
|
|
|
- // data: props.yinSuChart.value.cos,
|
|
|
|
- data: [1, 2, 3, 4, 5, 6, 7, 8],
|
|
|
|
- markLine: {
|
|
|
|
- //最大值和最小值
|
|
|
|
- data: [
|
|
|
|
- {
|
|
|
|
- yAxis: 30,
|
|
|
|
- label: {
|
|
|
|
- position: 'middle',
|
|
|
|
- formatter: '严重三项不平衡',
|
|
|
|
- },
|
|
|
|
- lineStyle: {
|
|
|
|
- width: 2,
|
|
|
|
- color: '#FF5D1D',
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- yAxis: 14,
|
|
|
|
- label: {
|
|
|
|
- position: 'middle',
|
|
|
|
- formatter: '不平衡度',
|
|
|
|
- },
|
|
|
|
- lineStyle: {
|
|
|
|
- width: 2,
|
|
|
|
- color: '#f2e251',
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- })
|
|
|
|
- window.addEventListener('resize', () => {
|
|
|
|
- myChart.resize()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const writeValue = (val) => {
|
|
|
|
|
|
+ // function echarts2(){
|
|
|
|
+ // let myChart = echarts.init(lineChartBanlance.value)
|
|
|
|
+ // // 绘制图表
|
|
|
|
+ // myChart.setOption({
|
|
|
|
+ // // backgroundColor: "pink",
|
|
|
|
+ // color: ['#f2e251', '#48C964', '#fe8161'],
|
|
|
|
+
|
|
|
|
+ // legend: {
|
|
|
|
+ // bottom: '0',
|
|
|
|
+ // data: ['A相电流', 'B相电流', 'C相电流'],
|
|
|
|
+ // },
|
|
|
|
+ // // toolbox: {
|
|
|
|
+ // // show: false,
|
|
|
|
+ // // },
|
|
|
|
+ // tooltip: {
|
|
|
|
+ // // show: true
|
|
|
|
+ // trigger: 'axis',
|
|
|
|
+ // axisPointer: { type: 'cross' },
|
|
|
|
+ // },
|
|
|
|
+ // grid: {
|
|
|
|
+ // left: '20',
|
|
|
|
+ // right: '40',
|
|
|
|
+ // top: '40',
|
|
|
|
+ // bottom: '30',
|
|
|
|
+ // containLabel: true,
|
|
|
|
+ // },
|
|
|
|
+ // xAxis: {
|
|
|
|
+ // axisLabel: {
|
|
|
|
+ // color: '#444',
|
|
|
|
+ // fontSize: 14,
|
|
|
|
+ // },
|
|
|
|
+ // /*改变xy轴颜色*/
|
|
|
|
+ // axisLine: {
|
|
|
|
+ // lineStyle: {
|
|
|
|
+ // color: '#444',
|
|
|
|
+ // width: 1, //这里是为了突出显示加上的
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+ // boundaryGap: false,
|
|
|
|
+ // data: electricChart.value.dataTime,
|
|
|
|
+ // },
|
|
|
|
+ // yAxis: {
|
|
|
|
+ // name: 'A',
|
|
|
|
+ // nameTextStyle: {
|
|
|
|
+ // color: 'black',
|
|
|
|
+ // fontSize: 10,
|
|
|
|
+ // },
|
|
|
|
+ // type: 'value',
|
|
|
|
+ // axisTick: {
|
|
|
|
+ // show: true, //去除刻度线
|
|
|
|
+ // },
|
|
|
|
+ // axisLabel: {
|
|
|
|
+ // color: 'black', // 文本颜色
|
|
|
|
+ // },
|
|
|
|
+ // axisLine: {
|
|
|
|
+ // show: true, // 去除轴线
|
|
|
|
+ // lineStyle: {
|
|
|
|
+ // color: 'black',
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+ // splitNumber: 5,
|
|
|
|
+ // splitLine: {
|
|
|
|
+ // show: true,
|
|
|
|
+ // lineStyle: {
|
|
|
|
+ // color: '#9d9d9d',
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // series: [
|
|
|
|
+ // {
|
|
|
|
+ // name: 'A相电流',
|
|
|
|
+ // type: 'line',
|
|
|
|
+ // symbolSize: 7,
|
|
|
|
+ // smooth: false,
|
|
|
|
+ // data:electricChart.value.la,
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // name: 'B相电流',
|
|
|
|
+ // type: 'line',
|
|
|
|
+ // symbolSize: 7,
|
|
|
|
+ // smooth: false,
|
|
|
|
+ // data: electricChart.value.lb,
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // name: 'C相电流',
|
|
|
|
+ // type: 'line',
|
|
|
|
+ // symbolSize: 7,
|
|
|
|
+ // smooth: false,
|
|
|
|
+ // data:electricChart.value.lc,
|
|
|
|
+ // },
|
|
|
|
+ // ],
|
|
|
|
+ // })
|
|
|
|
+ // window.addEventListener('resize', () => {
|
|
|
|
+ // myChart.resize()
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ const writeValue = (val) => {
|
|
val
|
|
val
|
|
getData()
|
|
getData()
|
|
- echarts2()
|
|
|
|
|
|
+ // echarts2()
|
|
}
|
|
}
|
|
|
|
|
|
//监听变化
|
|
//监听变化
|
|
watch(
|
|
watch(
|
|
() => props.yinSuChart,
|
|
() => props.yinSuChart,
|
|
(newVal, oldVal, clear) => {
|
|
(newVal, oldVal, clear) => {
|
|
-
|
|
|
|
- alert(2)
|
|
|
|
|
|
+ alert('aaa')
|
|
// 执行异步任务,并得到关闭异步任务的 id
|
|
// 执行异步任务,并得到关闭异步任务的 id
|
|
// console.log(newVal)
|
|
// console.log(newVal)
|
|
let id = writeValue(newVal, oldVal)
|
|
let id = writeValue(newVal, oldVal)
|
|
@@ -170,16 +145,19 @@ export default defineComponent({
|
|
},
|
|
},
|
|
{ lazy: true }
|
|
{ lazy: true }
|
|
)
|
|
)
|
|
|
|
+
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getData()
|
|
getData()
|
|
- echarts2()
|
|
|
|
|
|
+ // echarts2()
|
|
|
|
+
|
|
})
|
|
})
|
|
|
|
|
|
return {
|
|
return {
|
|
lineChartBanlance,
|
|
lineChartBanlance,
|
|
loading,
|
|
loading,
|
|
- flag,
|
|
|
|
- echarts2,
|
|
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
},
|
|
},
|
|
})
|
|
})
|