放大图片
parent
6d00825f1c
commit
d57577ddc2
File diff suppressed because it is too large
Load Diff
@ -1,168 +1,240 @@
|
|||||||
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div style="padding: 20px">
|
<div class="echartsPage">
|
||||||
<el-card
|
<div class="echart-top">
|
||||||
><el-tabs type="border-card" v-model="tabName" @tab-click="handleClick"
|
<el-card class="box-card">
|
||||||
><el-tab-pane label="用户管理" name="用户管理"
|
<div id="echart1" style="width: 100%; height: 100%"></div>
|
||||||
><div class="echart-top">
|
</el-card>
|
||||||
<div id="echart1" style="width: 100%; height: 100%"></div>
|
<el-card class="box-card">
|
||||||
<div id="echart2" style="width: 100%; height: 100%"></div></div></el-tab-pane
|
<div id="echart2" style="width: 100%; height: 100%"></div>
|
||||||
><el-tab-pane label="配置管理" name="配置管理"
|
</el-card>
|
||||||
><div class="echart-top">
|
</div>
|
||||||
<div id="echart3" style="width: 100%; height: 100%"></div>
|
<div class="echart-top">
|
||||||
<div id="echart4" style="width: 100%; height: 100%"></div></div></el-tab-pane></el-tabs
|
<el-card class="box-card">
|
||||||
></el-card>
|
<div id="echart3" style="width: 100%; height: 100%"></div>
|
||||||
|
</el-card>
|
||||||
|
<el-card class="box-card">
|
||||||
|
<div id="echart4" style="width: 100%; height: 100%"></div>
|
||||||
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <el-card>
|
||||||
|
<el-tabs type="border-card" v-model="tabName" @tab-click="handleClick"
|
||||||
|
><el-tab-pane label="用户管理" name="用户管理"></el-tab-pane
|
||||||
|
><el-tab-pane label="配置管理" name="配置管理"></el-tab-pane></el-tabs
|
||||||
|
></el-card> -->
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: '',
|
name: "",
|
||||||
data() {
|
data() {
|
||||||
return { tabName: '配置管理', myChart1: '', myChart2: '', myChart3: '', myChart4: '' };
|
return {
|
||||||
|
tabName: "配置管理",
|
||||||
|
myChart1: "",
|
||||||
|
myChart2: "",
|
||||||
|
myChart3: "",
|
||||||
|
myChart4: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"$store.state.collapse"(val) {
|
||||||
|
console.log(val);
|
||||||
|
setTimeout(() => {
|
||||||
|
//echarts得重绘方法
|
||||||
|
this.myChart1.resize();
|
||||||
|
this.myChart2.resize();
|
||||||
|
this.myChart3.resize();
|
||||||
|
this.myChart4.resize();
|
||||||
|
}, 300);
|
||||||
},
|
},
|
||||||
mounted() {
|
},
|
||||||
this.init();
|
methods: {
|
||||||
|
init() {
|
||||||
|
this.getEchart1();
|
||||||
|
this.getEchart2();
|
||||||
|
this.getEchart3();
|
||||||
|
this.getEchart4();
|
||||||
},
|
},
|
||||||
watch: {
|
handleClick(value) {
|
||||||
'$store.state.collapse'(val) {
|
console.log("value", value);
|
||||||
console.log(val);
|
if (value.name === "用户管理") {
|
||||||
setTimeout(() => {
|
this.getEchart1();
|
||||||
//echarts得重绘方法
|
this.getEchart2();
|
||||||
this.myChart1.resize();
|
} else {
|
||||||
this.myChart2.resize();
|
this.getEchart3();
|
||||||
this.myChart3.resize();
|
}
|
||||||
this.myChart4.resize();
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
getEchart1() {
|
||||||
init() {
|
this.$nextTick(() => {
|
||||||
this.getEchart1();
|
this.$echarts.init(document.getElementById("echart1")).dispose();
|
||||||
this.getEchart2();
|
this.myChart1 = this.$echarts.init(document.getElementById("echart1"));
|
||||||
this.getEchart3();
|
let option = {
|
||||||
this.getEchart4();
|
title: {
|
||||||
},
|
text: "装置数量统计",
|
||||||
handleClick(value) {
|
},
|
||||||
console.log('value', value);
|
legend: { top: "bottom" },
|
||||||
if (value.name === '用户管理') {
|
toolbox: {
|
||||||
this.getEchart1();
|
show: true,
|
||||||
this.getEchart2();
|
},
|
||||||
} else {
|
series: [
|
||||||
this.getEchart3();
|
{
|
||||||
}
|
name: "面积模式",
|
||||||
},
|
type: "pie",
|
||||||
getEchart1() {
|
radius: [50, 120],
|
||||||
this.$nextTick(() => {
|
center: ["50%", "50%"],
|
||||||
this.$echarts.init(document.getElementById('echart1')).dispose();
|
roseType: "area",
|
||||||
this.myChart1 = this.$echarts.init(document.getElementById('echart1'));
|
itemStyle: { borderRadius: 8 },
|
||||||
let option = {
|
data: [
|
||||||
legend: { top: 'bottom' },
|
{ value: 40, name: "rose 1" },
|
||||||
toolbox: {
|
{ value: 38, name: "rose 2" },
|
||||||
show: true,
|
{ value: 32, name: "rose 3" },
|
||||||
feature: {
|
{ value: 30, name: "rose 4" },
|
||||||
mark: { show: true },
|
{ value: 28, name: "rose 5" },
|
||||||
dataView: { show: true, readOnly: false },
|
{ value: 26, name: "rose 6" },
|
||||||
restore: { show: true },
|
{ value: 22, name: "rose 7" },
|
||||||
saveAsImage: { show: true }
|
{ value: 18, name: "rose 8" },
|
||||||
}
|
],
|
||||||
},
|
},
|
||||||
series: [
|
],
|
||||||
{
|
};
|
||||||
name: '面积模式',
|
this.myChart1.setOption(option);
|
||||||
type: 'pie',
|
window.addEventListener("resize", () => {
|
||||||
radius: [50, 250],
|
this.myChart1.resize();
|
||||||
center: ['50%', '50%'],
|
});
|
||||||
roseType: 'area',
|
});
|
||||||
itemStyle: { borderRadius: 8 },
|
},
|
||||||
data: [
|
getEchart2() {
|
||||||
{ value: 40, name: 'rose 1' },
|
this.$nextTick(() => {
|
||||||
{ value: 38, name: 'rose 2' },
|
this.$echarts.init(document.getElementById("echart2")).dispose();
|
||||||
{ value: 32, name: 'rose 3' },
|
this.myChart2 = this.$echarts.init(document.getElementById("echart2"));
|
||||||
{ value: 30, name: 'rose 4' },
|
let option = {
|
||||||
{ value: 28, name: 'rose 5' },
|
title: {
|
||||||
{ value: 26, name: 'rose 6' },
|
text: "隐患分类统计",
|
||||||
{ value: 22, name: 'rose 7' },
|
},
|
||||||
{ value: 18, name: 'rose 8' }
|
xAxis: {
|
||||||
]
|
type: "category",
|
||||||
}
|
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
||||||
]
|
},
|
||||||
};
|
yAxis: { type: "value" },
|
||||||
this.myChart1.setOption(option);
|
series: [
|
||||||
window.addEventListener('resize', () => {
|
{
|
||||||
this.myChart1.resize();
|
data: [120, 200, 150, 80, 70, 110, 130],
|
||||||
});
|
type: "bar",
|
||||||
});
|
showBackground: true,
|
||||||
},
|
backgroundStyle: { color: "rgba(180, 180, 180, 0.2)" },
|
||||||
getEchart2() {
|
},
|
||||||
this.$nextTick(() => {
|
],
|
||||||
this.$echarts.init(document.getElementById('echart2')).dispose();
|
};
|
||||||
this.myChart2 = this.$echarts.init(document.getElementById('echart2'));
|
this.myChart2.setOption(option);
|
||||||
let option = {
|
window.addEventListener("resize", () => {
|
||||||
xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
this.myChart2.resize();
|
||||||
yAxis: { type: 'value' },
|
});
|
||||||
series: [
|
});
|
||||||
{
|
},
|
||||||
data: [120, 200, 150, 80, 70, 110, 130],
|
getEchart3() {
|
||||||
type: 'bar',
|
this.$nextTick(() => {
|
||||||
showBackground: true,
|
this.$echarts.init(document.getElementById("echart3")).dispose();
|
||||||
backgroundStyle: { color: 'rgba(180, 180, 180, 0.2)' }
|
this.myChart3 = this.$echarts.init(document.getElementById("echart3"));
|
||||||
}
|
let option = {
|
||||||
]
|
title: {
|
||||||
};
|
text: "装置信息统计",
|
||||||
this.myChart2.setOption(option);
|
},
|
||||||
window.addEventListener('resize', () => {
|
xAxis: {
|
||||||
this.myChart2.resize();
|
type: "category",
|
||||||
});
|
boundaryGap: false,
|
||||||
});
|
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
||||||
},
|
},
|
||||||
getEchart3() {
|
yAxis: { type: "value" },
|
||||||
this.$nextTick(() => {
|
series: [
|
||||||
this.$echarts.init(document.getElementById('echart3')).dispose();
|
{
|
||||||
this.myChart3 = this.$echarts.init(document.getElementById('echart3'));
|
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
||||||
let option = {
|
type: "line",
|
||||||
xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
|
areaStyle: {},
|
||||||
yAxis: { type: 'value' },
|
},
|
||||||
series: [{ data: [820, 932, 901, 934, 1290, 1330, 1320], type: 'line', areaStyle: {} }]
|
],
|
||||||
};
|
};
|
||||||
this.myChart3.setOption(option);
|
this.myChart3.setOption(option);
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener("resize", () => {
|
||||||
this.myChart3.resize();
|
this.myChart3.resize();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getEchart4() {
|
getEchart4() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$echarts.init(document.getElementById('echart4')).dispose();
|
this.$echarts.init(document.getElementById("echart4")).dispose();
|
||||||
this.myChart4 = this.$echarts.init(document.getElementById('echart4'));
|
this.myChart4 = this.$echarts.init(document.getElementById("echart4"));
|
||||||
let option = {
|
let option = {
|
||||||
xAxis: {},
|
title: {
|
||||||
yAxis: {},
|
text: "装置在线统计",
|
||||||
series: [
|
},
|
||||||
{
|
tooltip: {
|
||||||
data: [
|
trigger: "item",
|
||||||
[10, 40],
|
},
|
||||||
[50, 100],
|
legend: {
|
||||||
[40, 20]
|
top: "5%",
|
||||||
],
|
left: "center",
|
||||||
type: 'line'
|
},
|
||||||
}
|
series: [
|
||||||
]
|
{
|
||||||
};
|
type: "pie",
|
||||||
this.myChart4.setOption(option);
|
radius: ["40%", "70%"],
|
||||||
window.addEventListener('resize', () => {
|
avoidLabelOverlap: false,
|
||||||
this.myChart4.resize();
|
itemStyle: {
|
||||||
});
|
borderRadius: 10,
|
||||||
});
|
borderColor: "#fff",
|
||||||
}
|
borderWidth: 2,
|
||||||
}
|
},
|
||||||
|
label: {
|
||||||
|
show: false,
|
||||||
|
position: "center",
|
||||||
|
},
|
||||||
|
emphasis: {
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
fontSize: 40,
|
||||||
|
fontWeight: "bold",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
labelLine: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{ value: 1048, name: "在线" },
|
||||||
|
{ value: 735, name: "离线" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
this.myChart4.setOption(option);
|
||||||
|
window.addEventListener("resize", () => {
|
||||||
|
this.myChart4.resize();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style lang="less">
|
||||||
.echart-top {
|
.echartsPage {
|
||||||
|
height: calc(100% - 32px);
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-around;
|
||||||
|
.echart-top {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
height: 48%;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100%;
|
|
||||||
height: 500px;
|
.el-card {
|
||||||
|
width: 48%;
|
||||||
|
height: 100%;
|
||||||
|
.el-card__body {
|
||||||
|
height: calc(100% - 40px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue