新增报表
This commit is contained in:
148
src/views/report/components/chartButton.vue
Normal file
148
src/views/report/components/chartButton.vue
Normal file
@@ -0,0 +1,148 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-06-07 08:37:17
|
||||
* @LastEditTime: 2024-06-07 11:04:41
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<button
|
||||
class="chart-btn"
|
||||
:class="[active ? 'active' : '']"
|
||||
@click="$emit('click', label)"
|
||||
>
|
||||
{{ label }}
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CopilotButton",
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
active: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
button {
|
||||
appearance: none;
|
||||
outline: none;
|
||||
border: none;
|
||||
background: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.skate {
|
||||
/* flex: 1; */
|
||||
position: relative;
|
||||
width: 88px;
|
||||
height: 32px;
|
||||
background: #01306C;
|
||||
/* border-radius: 4px 0px 0px 4px; */
|
||||
backdrop-filter: blur(3px);
|
||||
/* text-align: center;
|
||||
padding: 12px;
|
||||
padding-left: 20px;
|
||||
color: #fff;
|
||||
font-size: 18px; */
|
||||
font-family: PingFangSC, PingFang SC;
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
color: #FFFFFF;
|
||||
line-height: 22px;
|
||||
letter-spacing: 5px;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
/* margin-right: 1px; */
|
||||
/* letter-spacing: 10px; */
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chart-btn:nth-child(6)::after {
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
display: none;
|
||||
}
|
||||
.chart-btn {
|
||||
/* flex: 1; */
|
||||
position: relative;
|
||||
width: 88px;
|
||||
height: 32px;
|
||||
background: #01306C;
|
||||
/* border-radius: 4px 0px 0px 4px; */
|
||||
backdrop-filter: blur(3px);
|
||||
/* text-align: center;
|
||||
padding: 12px;
|
||||
padding-left: 20px;
|
||||
color: #fff;
|
||||
font-size: 18px; */
|
||||
font-family: PingFangSC, PingFang SC;
|
||||
font-weight: 400;
|
||||
font-size: 12px;
|
||||
color: #FFFFFF;
|
||||
line-height: 22px;
|
||||
letter-spacing: 5px;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
/* margin-right: 1px; */
|
||||
/* letter-spacing: 10px; */
|
||||
cursor: pointer;
|
||||
}
|
||||
.chart-btn::after {
|
||||
/* flex: 1; */
|
||||
/* position: relative; */
|
||||
content: "";
|
||||
position: absolute;
|
||||
/* width: 16px; */
|
||||
/* height: 16px; */
|
||||
top: px;
|
||||
right: -1px;
|
||||
width: 1px;
|
||||
height: 23px;
|
||||
border: 1px solid #010D18;
|
||||
}
|
||||
.chart-btn.active {
|
||||
background: #1D74D8;
|
||||
/* border-radius: 4px;; */
|
||||
}
|
||||
.chart-btn.active::after {
|
||||
display: none;
|
||||
/* border-radius: 4px;; */
|
||||
}
|
||||
/* .copilot-btn::before,
|
||||
.copilot-btn::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
top: 0;
|
||||
background: transparent;
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
border-color: transparent;
|
||||
border-top-color: #007be4;
|
||||
}
|
||||
|
||||
.copilot-btn::before {
|
||||
left: 0;
|
||||
border-left-color: #007be4;
|
||||
}
|
||||
|
||||
.copilot-btn::after {
|
||||
right: 0;
|
||||
border-right-color: #007be4;
|
||||
} */
|
||||
</style>
|
||||
218
src/views/report/components/lineChart.vue
Normal file
218
src/views/report/components/lineChart.vue
Normal file
@@ -0,0 +1,218 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-06-11 09:48:40
|
||||
* @LastEditTime: 2024-06-11 10:22:05
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<!-- <div> -->
|
||||
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
|
||||
<div :id="id" :class="className" style="height: 100%,width: 100%;;" />
|
||||
<!-- </div> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as echarts from 'echarts'
|
||||
import { debounce } from "@/utils/debounce";
|
||||
export default {
|
||||
name: 'OverviewBar',
|
||||
// mixins: [resize],
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default: 'reportChart'
|
||||
},
|
||||
className: {
|
||||
type: String,
|
||||
default: 'reportChart'
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
beilv: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '100%'
|
||||
},
|
||||
legendPosition: {
|
||||
type: String,
|
||||
default: 'center'
|
||||
},
|
||||
showLegend: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
legendData: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chart: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.initChart()
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (!this.chart) {
|
||||
return
|
||||
}
|
||||
this.chart.dispose()
|
||||
this.chart = null
|
||||
},
|
||||
mounted() {
|
||||
// if (screenfull.isEnabled) {
|
||||
// screenfull.on("change", () => {
|
||||
// this.isFullscreen = screenfull.isFullscreen;
|
||||
// });
|
||||
// }
|
||||
this.canvasReset();
|
||||
window.addEventListener("resize", this.canvasReset);
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.chart) {
|
||||
this.chart.dispose();
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
window.removeEventListener("resize", this.canvasReset);
|
||||
},
|
||||
methods: {
|
||||
canvasReset() {
|
||||
debounce(() => {
|
||||
this.initChart();
|
||||
}, 500)();
|
||||
},
|
||||
initChart() {
|
||||
console.log(1111)
|
||||
this.chart = echarts.init(document.getElementById(this.id))
|
||||
console.log(this.$parent);
|
||||
this.chart.setOption({
|
||||
title: {
|
||||
text: '',
|
||||
// subtext: 'Fake Data'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
grid: { top: 100, right: 90, bottom: 10, left: 10, containLabel: true },
|
||||
legend: {
|
||||
data: ['芯片总功率', '标准组件总功率', '转化效率'],
|
||||
right: '90px',
|
||||
top: '0%',
|
||||
icon: 'rect',
|
||||
itemWidth: 10,
|
||||
itemHeight: 10,
|
||||
itemGap: 40,
|
||||
},
|
||||
// toolbox: {
|
||||
// show: true,
|
||||
// feature: {
|
||||
// dataView: { show: true, readOnly: false },
|
||||
// magicType: { show: true, type: ['line', 'bar'] },
|
||||
// restore: { show: true },
|
||||
// saveAsImage: { show: true }
|
||||
// }
|
||||
// },
|
||||
calculable: true,
|
||||
xAxis: [
|
||||
{
|
||||
type: 'category',
|
||||
// prettier-ignore
|
||||
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||
}
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value'
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
// name: 'Temperature',
|
||||
min: 0,
|
||||
max: 100,
|
||||
interval: 20,
|
||||
axisLabel: {
|
||||
formatter: '{value}%'
|
||||
}
|
||||
}
|
||||
],
|
||||
grid: {
|
||||
top: '20%',
|
||||
left: "1%",
|
||||
right: "3%",
|
||||
bottom: "1%",
|
||||
containLabel: true
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '芯片总功率',
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'rgba(142, 240, 171, 1)', //改变折线点的颜色
|
||||
lineStyle: {
|
||||
color: 'rgba(142, 240, 171, 1)' //改变折线颜色
|
||||
}
|
||||
}
|
||||
},
|
||||
data: [
|
||||
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '标准组件总功率',
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#288AFF', //改变折线点的颜色
|
||||
lineStyle: {
|
||||
color: '#288AFF' //改变折线颜色
|
||||
}
|
||||
}
|
||||
},
|
||||
data: [
|
||||
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '转化效率',
|
||||
type: 'bar',
|
||||
type: 'line',
|
||||
yAxisIndex: 1,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#FFCE6A', //改变折线点的颜色
|
||||
lineStyle: {
|
||||
color: '#FFCE6A' //改变折线颜色
|
||||
}
|
||||
}
|
||||
},
|
||||
data: [
|
||||
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 18.8, 6.0, 2.3
|
||||
],
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* .reportChart {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
top: 10px;
|
||||
} */
|
||||
</style>
|
||||
Reference in New Issue
Block a user