邓洁 : 用电量弹窗及样式修改
This commit is contained in:
@@ -16,6 +16,7 @@ a {
|
|||||||
html, body, #app, .el-container, .el-aside, .el-main {
|
html, body, #app, .el-container, .el-aside, .el-main {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tunnel-title {
|
.tunnel-title {
|
||||||
width: 2330px;
|
width: 2330px;
|
||||||
height: 156px;
|
height: 156px;
|
||||||
@@ -26,6 +27,7 @@ html, body, #app, .el-container, .el-aside, .el-main {
|
|||||||
margin-left: -1165px;
|
margin-left: -1165px;
|
||||||
background-image: url('../images/topAndDown/sp_tb.png');
|
background-image: url('../images/topAndDown/sp_tb.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
.box-top {
|
.box-top {
|
||||||
.manage-btn {
|
.manage-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -125,7 +127,7 @@ html, body, #app, .el-container, .el-aside, .el-main {
|
|||||||
background-image: url('../images/topAndDown/sp_icon_zyc.png');
|
background-image: url('../images/topAndDown/sp_icon_zyc.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
.tunnel-length{
|
.tunnel-length {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 13%;
|
top: 13%;
|
||||||
left: 36%;
|
left: 36%;
|
||||||
@@ -242,3 +244,130 @@ html, body, #app, .el-container, .el-aside, .el-main {
|
|||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//弹窗样式
|
||||||
|
.digital-tunnel {
|
||||||
|
#container {
|
||||||
|
height: 650px;
|
||||||
|
width: 1300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#containerEle {
|
||||||
|
height: 564px;
|
||||||
|
width: 1300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dialog {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 785px;
|
||||||
|
border: 2px solid #0F82AF;
|
||||||
|
background: rgba(6, 34, 71, 0.78);
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 47px 30px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 588px auto 0 auto;
|
||||||
|
|
||||||
|
.el-dialog__header {
|
||||||
|
padding:0 0 25px 0;
|
||||||
|
//display: none;
|
||||||
|
.el-dialog__title {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #D6F1FA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dialog__close {
|
||||||
|
color: #05FEFF;
|
||||||
|
font-size: 35px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dialog__body {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-top-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: -3px;
|
||||||
|
left: -3px;
|
||||||
|
width: 41px;
|
||||||
|
height: 41px;
|
||||||
|
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-top-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: -3px;
|
||||||
|
right: -3px;
|
||||||
|
width: 41px;
|
||||||
|
height: 41px;
|
||||||
|
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-select {
|
||||||
|
position: absolute;
|
||||||
|
top: 47px;
|
||||||
|
right: 119px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-bottom-icon {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -3px;
|
||||||
|
left: -3px;
|
||||||
|
width: 41px;
|
||||||
|
height: 41px;
|
||||||
|
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-bottom-icon {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -3px;
|
||||||
|
right: -3px;
|
||||||
|
width: 41px;
|
||||||
|
height: 41px;
|
||||||
|
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
//用电量
|
||||||
|
.top-tag {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.allUsedEle {
|
||||||
|
width: 240px;
|
||||||
|
height: 149px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 2px solid #0F82AF;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&:nth-child(2) {
|
||||||
|
margin-left: 39px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.use-title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 240px;
|
||||||
|
height: 50px;
|
||||||
|
background: #264A78;
|
||||||
|
font-size: 26px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
margin-top: 20px;
|
||||||
|
font-size: 40px;
|
||||||
|
font-family: MicrosoftYaHei;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,30 +4,40 @@
|
|||||||
<div class="info-list">
|
<div class="info-list">
|
||||||
<gas-info-item v-for="item in badGasList" :key="item.equipmentId" :gasInfo="item" @click="handleOpenChart"/>
|
<gas-info-item v-for="item in badGasList" :key="item.equipmentId" :gasInfo="item" @click="handleOpenChart"/>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="isVisited" title="有害气体监控数据" width="1996px" :modal="false">
|
<div class="digital-tunnel">
|
||||||
<div class="left-icon"></div>
|
<el-dialog v-model="isVisited" title="有害气体监控数据" width="1365px" :modal="false">
|
||||||
<div class="right-icon"></div>
|
<div class="left-top-icon"></div>
|
||||||
<div id="container" ref="chart"></div>
|
<div class="right-top-icon"></div>
|
||||||
<div class="time-select">
|
<div id="container"></div>
|
||||||
|
<div class="time-select">
|
||||||
</div>
|
<time-range-btn
|
||||||
</el-dialog>
|
:buttonList="timeList"
|
||||||
|
v-model="selectTimeButton"
|
||||||
|
@select="timeSelect"
|
||||||
|
width="124px"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="left-bottom-icon"></div>
|
||||||
|
<div class="right-bottom-icon"></div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import GasInfoItem from "./childComps/GasInfoItem.vue";
|
import GasInfoItem from "./childComps/GasInfoItem.vue";
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
|
import TimeRangeBtn from "@/components/timeRangeBtn/index.vue"
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: Array,
|
list: Array,
|
||||||
badGasData: Array
|
badGasData: Array
|
||||||
});
|
});
|
||||||
|
const timeList = ref(["年", "月", "日"]);
|
||||||
|
const selectTimeButton = ref(0);
|
||||||
const isVisited = ref(false);
|
const isVisited = ref(false);
|
||||||
const badGasList = ref([])
|
const badGasList = ref([])
|
||||||
const chart = ref();
|
|
||||||
let myEcharts = reactive({});
|
let myEcharts = reactive({});
|
||||||
// const option = reactive()
|
|
||||||
|
|
||||||
watch(() => props.list, (now) => {
|
watch(() => props.list, (now) => {
|
||||||
badGasList.value.forEach(item => {
|
badGasList.value.forEach(item => {
|
||||||
@@ -42,7 +52,16 @@ watch(() => props.list, (now) => {
|
|||||||
watch(() => props.badGasData, (now) => {
|
watch(() => props.badGasData, (now) => {
|
||||||
getBadGasInfo(now.sensorList)
|
getBadGasInfo(now.sensorList)
|
||||||
}, {deep: true});
|
}, {deep: true});
|
||||||
|
const timeSelect = (index) => {
|
||||||
|
console.log('选择时间', index)
|
||||||
|
if(index===0){
|
||||||
|
console.log('--年')
|
||||||
|
}else if(index===1){
|
||||||
|
console.log('--月')
|
||||||
|
}else if(index===2){
|
||||||
|
console.log('--日')
|
||||||
|
}
|
||||||
|
};
|
||||||
const getBadGasInfo = (now) => {
|
const getBadGasInfo = (now) => {
|
||||||
let windPressureObj = {}
|
let windPressureObj = {}
|
||||||
let windPressureArr = []
|
let windPressureArr = []
|
||||||
@@ -70,7 +89,6 @@ const handleOpenChart = () => {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
initChart()
|
initChart()
|
||||||
})
|
})
|
||||||
// initChart()
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 初始化echarts实例方法
|
* 初始化echarts实例方法
|
||||||
@@ -79,24 +97,24 @@ const initChart = () => {
|
|||||||
//3.初始化container容器
|
//3.初始化container容器
|
||||||
myEcharts = echarts.init(document.getElementById('container'));
|
myEcharts = echarts.init(document.getElementById('container'));
|
||||||
//5.传入数据
|
//5.传入数据
|
||||||
let option={
|
let option = {
|
||||||
//图例
|
//图例
|
||||||
legend: {
|
legend: {
|
||||||
left: 0,
|
left: 0,
|
||||||
textStyle:{
|
textStyle: {
|
||||||
color:'#FFFFFF',
|
color: '#FFFFFF',
|
||||||
fontSize:28
|
fontSize: 28
|
||||||
},
|
},
|
||||||
// itemWidth: 20,
|
// itemWidth: 20,
|
||||||
// itemHeight: 20
|
// itemHeight: 20
|
||||||
},
|
},
|
||||||
//离容器四侧的距离
|
//离容器四侧的距离
|
||||||
grid: {
|
grid: {
|
||||||
left: 45, // 左边距
|
left: 0, // 左边距
|
||||||
// right: 60, // 右边距
|
right: 0, // 右边距
|
||||||
top: 60, // 顶边距
|
top: 80, // 顶边距
|
||||||
bottom: 40, // 底边距
|
bottom: 0, // 底边距
|
||||||
// containLabel: true,
|
containLabel: true,
|
||||||
},
|
},
|
||||||
//提示框组件
|
//提示框组件
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@@ -110,7 +128,7 @@ const initChart = () => {
|
|||||||
axisLabel: {
|
axisLabel: {
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
color:'#D6F1FA'
|
color: '#D6F1FA'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -120,7 +138,7 @@ const initChart = () => {
|
|||||||
axisLabel: {
|
axisLabel: {
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
color:'#D6F1FA'
|
color: '#D6F1FA'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -131,9 +149,9 @@ const initChart = () => {
|
|||||||
data: [5, 9, 10, 7, 8, 15, 12],
|
data: [5, 9, 10, 7, 8, 15, 12],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
symbolSize:24,
|
symbolSize: 24,
|
||||||
lineStyle:{
|
lineStyle: {
|
||||||
width:5
|
width: 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -141,9 +159,9 @@ const initChart = () => {
|
|||||||
data: [8, 15, 5, 9, 10, 7, 12],
|
data: [8, 15, 5, 9, 10, 7, 12],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
symbolSize:24,
|
symbolSize: 24,
|
||||||
lineStyle:{
|
lineStyle: {
|
||||||
width:5
|
width: 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -151,9 +169,9 @@ const initChart = () => {
|
|||||||
data: [5, 15, 1, 9, 10, 7, 8],
|
data: [5, 15, 1, 9, 10, 7, 8],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
symbolSize:24,
|
symbolSize: 24,
|
||||||
lineStyle:{
|
lineStyle: {
|
||||||
width:5
|
width: 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -161,9 +179,9 @@ const initChart = () => {
|
|||||||
data: [8, 15, 12, 5, 9, 2, 7],
|
data: [8, 15, 12, 5, 9, 2, 7],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
symbolSize:24,
|
symbolSize: 24,
|
||||||
lineStyle:{
|
lineStyle: {
|
||||||
width:5
|
width: 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -171,9 +189,9 @@ const initChart = () => {
|
|||||||
data: [2, 9, 10, 15, 12, 7, 8,],
|
data: [2, 9, 10, 15, 12, 7, 8,],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
symbolSize:24,
|
symbolSize: 24,
|
||||||
lineStyle:{
|
lineStyle: {
|
||||||
width:5
|
width: 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -188,37 +206,6 @@ const initChart = () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
#container {
|
|
||||||
box-sizing: border-box;
|
|
||||||
height: 754px;
|
|
||||||
width: 1996px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-dialog) {
|
|
||||||
border: 2px solid #0F82AF;
|
|
||||||
background: rgba(6, 34, 71, 0.78);
|
|
||||||
border-radius: 20px;
|
|
||||||
padding: 47px 30px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 588px auto 0 auto;
|
|
||||||
|
|
||||||
.el-dialog__header {
|
|
||||||
padding: 0;
|
|
||||||
//display: none;
|
|
||||||
.el-dialog__title {
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #D6F1FA;
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-dialog__close {
|
|
||||||
color: #05FEFF;
|
|
||||||
font-size: 35px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#bad-gas-info {
|
#bad-gas-info {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
@@ -228,34 +215,7 @@ const initChart = () => {
|
|||||||
right: 72px;
|
right: 72px;
|
||||||
background-image: url(@/assets/images/badGasInfo/bg.png);
|
background-image: url(@/assets/images/badGasInfo/bg.png);
|
||||||
|
|
||||||
.left-icon {
|
|
||||||
position: absolute;
|
|
||||||
top: -3px;
|
|
||||||
left: -3px;
|
|
||||||
width: 41px;
|
|
||||||
height: 41px;
|
|
||||||
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-icon {
|
|
||||||
position: absolute;
|
|
||||||
top: -3px;
|
|
||||||
right: -3px;
|
|
||||||
width: 41px;
|
|
||||||
height: 41px;
|
|
||||||
background-image: url(@/assets/images/badGasInfo/sp_jz.png);
|
|
||||||
transform: rotate(90deg);
|
|
||||||
}
|
|
||||||
.time-select{
|
|
||||||
position: absolute;
|
|
||||||
top: 47px;
|
|
||||||
right: 119px;
|
|
||||||
//display: flex;
|
|
||||||
width: 204px;
|
|
||||||
height: 68px;
|
|
||||||
border-radius: 10px;
|
|
||||||
border: 2px solid #0F82AF;
|
|
||||||
}
|
|
||||||
.title {
|
.title {
|
||||||
width: 128px;
|
width: 128px;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="used-ele">
|
<div id="used-ele">
|
||||||
<div class="content">
|
<div class="content" @click="handleOpenChart">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div></div>
|
<div></div>
|
||||||
<span>当月用电量:{{ electricityConsumptionMonthly }}v</span>
|
<span>当月用电量:{{ electricityConsumptionMonthly }}v</span>
|
||||||
@@ -10,17 +10,44 @@
|
|||||||
<span>当月节省量:{{ monthlySavings }}v</span>
|
<span>当月节省量:{{ monthlySavings }}v</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="digital-tunnel">
|
||||||
|
<el-dialog v-model="isVisited" width="1365px" :modal="false">
|
||||||
|
<div class="left-top-icon"></div>
|
||||||
|
<div class="right-top-icon"></div>
|
||||||
|
<div class="top-tag">
|
||||||
|
<div class="allUsedEle">
|
||||||
|
<div class="use-title">
|
||||||
|
12月总用电量
|
||||||
|
</div>
|
||||||
|
<div class="value">2345v</div>
|
||||||
|
</div>
|
||||||
|
<div class="allUsedEle">
|
||||||
|
<div class="use-title">
|
||||||
|
当月节省量
|
||||||
|
</div>
|
||||||
|
<div class="value">345v</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="containerEle"></div>
|
||||||
|
<div class="left-bottom-icon"></div>
|
||||||
|
<div class="right-bottom-icon"></div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: Array,
|
list: Array,
|
||||||
eleData: Array
|
eleData: Array
|
||||||
});
|
});
|
||||||
|
let myEcharts = reactive({});
|
||||||
|
const isVisited = ref(false);
|
||||||
const eleData = ref([])
|
const eleData = ref([])
|
||||||
const electricityConsumptionMonthly=ref()
|
const electricityConsumptionMonthly = ref()
|
||||||
const monthlySavings=ref(55555)
|
const monthlySavings = ref(55555)
|
||||||
watch(() => props.eleData, (now) => {
|
watch(() => props.eleData, (now) => {
|
||||||
getBasicData(now.frequencyChangerList)
|
getBasicData(now.frequencyChangerList)
|
||||||
}, {deep: true});
|
}, {deep: true});
|
||||||
@@ -29,7 +56,7 @@ watch(() => props.list, (now) => {
|
|||||||
now.forEach(newItem => {
|
now.forEach(newItem => {
|
||||||
if (item.equipmentId === newItem.equipmentId) {
|
if (item.equipmentId === newItem.equipmentId) {
|
||||||
if (newItem.electricityConsumptionDay) {
|
if (newItem.electricityConsumptionDay) {
|
||||||
electricityConsumptionMonthly.value=newItem.electricityConsumptionMonthly
|
electricityConsumptionMonthly.value = newItem.electricityConsumptionMonthly
|
||||||
// item.electricityConsumptionDay = newItem.electricityConsumptionDay
|
// item.electricityConsumptionDay = newItem.electricityConsumptionDay
|
||||||
// item.electricityConsumptionMonthly = newItem.electricityConsumptionMonthly
|
// item.electricityConsumptionMonthly = newItem.electricityConsumptionMonthly
|
||||||
// item.electricityConsumptionTotal = newItem.electricityConsumptionTotal
|
// item.electricityConsumptionTotal = newItem.electricityConsumptionTotal
|
||||||
@@ -42,18 +69,92 @@ const getBasicData = (data) => {
|
|||||||
let tranObj = {}
|
let tranObj = {}
|
||||||
let tranArr = []
|
let tranArr = []
|
||||||
data.map(item => {
|
data.map(item => {
|
||||||
electricityConsumptionMonthly.value=item.electricityConsumptionMonthly,
|
electricityConsumptionMonthly.value = item.electricityConsumptionMonthly,
|
||||||
tranObj = {
|
tranObj = {
|
||||||
equipmentId: item.equipmentId,
|
equipmentId: item.equipmentId,
|
||||||
// equipmentName: item.equipmentName,
|
// equipmentName: item.equipmentName,
|
||||||
// electricityConsumptionDay: item.electricityConsumptionDay,
|
// electricityConsumptionDay: item.electricityConsumptionDay,
|
||||||
// electricityConsumptionMonthly: item.electricityConsumptionMonthly,
|
// electricityConsumptionMonthly: item.electricityConsumptionMonthly,
|
||||||
// electricityConsumptionTotal: item.electricityConsumptionTotal,
|
// electricityConsumptionTotal: item.electricityConsumptionTotal,
|
||||||
}
|
}
|
||||||
tranArr.push(tranObj)
|
tranArr.push(tranObj)
|
||||||
})
|
})
|
||||||
eleData.value = tranArr
|
eleData.value = tranArr
|
||||||
}
|
}
|
||||||
|
const handleOpenChart = () => {
|
||||||
|
console.log('用电量弹窗')
|
||||||
|
isVisited.value = true
|
||||||
|
nextTick(() => {
|
||||||
|
initChart()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 初始化echarts实例方法
|
||||||
|
*/
|
||||||
|
const initChart = () => {
|
||||||
|
//3.初始化container容器
|
||||||
|
myEcharts = echarts.init(document.getElementById('containerEle'));
|
||||||
|
//5.传入数据
|
||||||
|
let option = {
|
||||||
|
//图例
|
||||||
|
legend: {
|
||||||
|
left: 0,
|
||||||
|
textStyle: {
|
||||||
|
color: '#FFFFFF',
|
||||||
|
fontSize: 28
|
||||||
|
},
|
||||||
|
// itemWidth: 20,
|
||||||
|
// itemHeight: 20
|
||||||
|
},
|
||||||
|
//离容器四侧的距离
|
||||||
|
grid: {
|
||||||
|
left: 0, // 左边距
|
||||||
|
right: 20, // 右边距
|
||||||
|
// top: 80, // 顶边距
|
||||||
|
bottom: 20, // 底边距
|
||||||
|
containLabel: true,
|
||||||
|
},
|
||||||
|
//提示框组件
|
||||||
|
tooltip: {
|
||||||
|
show: true,
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
//X轴
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
|
||||||
|
axisLabel: {
|
||||||
|
textStyle: {
|
||||||
|
fontSize: 24,
|
||||||
|
color: '#D6F1FA'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
//Y轴
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
axisLabel: {
|
||||||
|
textStyle: {
|
||||||
|
fontSize: 24,
|
||||||
|
color: '#D6F1FA'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
//配置项
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
data: [120, 200, 150, 80, 70, 110, 130, 100, 140, 130, 160, 150, 90, 130, 110, 120, 150, 140, 130, 120, 110, 100, 90, 80, 100, 140, 130, 160, 150, 24, 50],
|
||||||
|
type: 'bar'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
myEcharts.setOption(option);
|
||||||
|
//图表大小自适应窗口大小变化
|
||||||
|
window.onresize = () => {
|
||||||
|
myEcharts.resize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -82,6 +183,7 @@ const getBasicData = (data) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
height: 37px;
|
height: 37px;
|
||||||
|
|||||||
69
src/components/timeRangeBtn/index.vue
Normal file
69
src/components/timeRangeBtn/index.vue
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<template>
|
||||||
|
<div class="time-range-group">
|
||||||
|
<div
|
||||||
|
class="time-range-button"
|
||||||
|
:class="{ 'time-range-button-active': selectButton == index }"
|
||||||
|
@click="select(index)"
|
||||||
|
v-for="(item, index) in buttonList"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<div class="time-range-text">{{ item }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
// 按钮列表
|
||||||
|
buttonList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
// 按钮选中的值
|
||||||
|
modelValue: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: "auto",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emit = defineEmits(["update:modelValue", "select"]);
|
||||||
|
|
||||||
|
const selectButton = ref(props.modelValue);
|
||||||
|
|
||||||
|
const select = (index) => {
|
||||||
|
if (selectButton.value === index) return;
|
||||||
|
selectButton.value = index;
|
||||||
|
emit("update:modelValue", index);
|
||||||
|
emit("select", index);
|
||||||
|
};
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
selectButton.value = props.modelValue;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.time-range-group {
|
||||||
|
width: 204px;
|
||||||
|
height: 68px;
|
||||||
|
border: 2px solid #0F82AF;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #062247;
|
||||||
|
display: flex;
|
||||||
|
font-size: 28px;
|
||||||
|
.time-range-button {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 15px 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #FFFFFF;
|
||||||
|
&.time-range-button-active {
|
||||||
|
background: #264A78;
|
||||||
|
border-radius: 10px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user