修改bug及能源分析样式

This commit is contained in:
2023-09-27 09:33:28 +08:00
parent 42550264c8
commit ee40707d2c
15 changed files with 302 additions and 53 deletions

View File

@@ -25,6 +25,10 @@ export default {
default: () => {
return []
}
},
timeDim: {
type: String,
default: ''
}
},
watch: {
@@ -58,32 +62,58 @@ export default {
tempArr = this.chartData[0].trendRespVOList
}
for (let k = 0; k < tempArr.length; k++) {
xData.push(tempArr[k].time)
let time = ''
if (this.timeDim === '3') {
let year = tempArr[k].time.slice(0,4)
let weak = tempArr[k].time.slice(4,6)
time = year+' 第 '+weak+' 周'
} else {
time = tempArr[k].time
}
xData.push(time)
}
for (let i = 0; i < this.chartData.length; i++) {
let obj = {
name: this.chartData[i].objName + this.chartData[i].objCode,
type: 'bar',
barMaxWidth: 20,
label: {
show: true,
position: 'top'
},
data: []
}
legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
let temp = this.chartData[i].trendRespVOList
for (let j = 0; j < temp.length; j++) {
let num = temp[j].useNum ? temp[j].useNum : 0
let num = temp[j].useNum ? temp[j].useNum : ''
obj.data.push(num)
}
yData.push(obj)
}
var option = {
color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
tooltip: {
trigger: 'axis'
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '4%',
right: '1%',
bottom: '1%',
containLabel: true
},
legend: {
data: legendData
},
xAxis: {
type: 'category',
data: xData
data: xData,
axisLabel: {
rotate: "45"
}
},
yAxis: {
type: 'value'

View File

@@ -25,6 +25,10 @@ export default {
default: () => {
return []
}
},
timeDim: {
type: String,
default: ''
}
},
watch: {
@@ -58,7 +62,15 @@ export default {
tempArr = this.chartData[0].trendRespVOList
}
for (let k = 0; k < tempArr.length; k++) {
xData.push(tempArr[k].time)
let time = ''
if (this.timeDim === '3') {
let year = tempArr[k].time.slice(0,4)
let weak = tempArr[k].time.slice(4,6)
time = year+' 第 '+weak+' 周'
} else {
time = tempArr[k].time
}
xData.push(time)
}
for (let i = 0; i < this.chartData.length; i++) {
let obj = {
@@ -70,22 +82,35 @@ export default {
legendData.push(this.chartData[i].objName + this.chartData[i].objCode)
let temp = this.chartData[i].trendRespVOList
for (let j = 0; j < temp.length; j++) {
let num = temp[j].useNum ? temp[j].useNum : 0
let num = temp[j].useNum ? temp[j].useNum : ''
obj.data.push(num)
}
yData.push(obj)
}
var option = {
color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
tooltip: {
trigger: 'axis'
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
grid: {
left: '4%',
right: '1%',
bottom: '1%',
containLabel: true
},
legend: {
data: legendData
},
xAxis: {
type: 'category',
data: xData
data: xData,
axisLabel: {
rotate: "45"
}
},
yAxis: {
type: 'value'

View File

@@ -135,7 +135,7 @@
</el-select>
</el-form-item>
<el-form-item label="对象选择">
<el-select v-model="queryParams.objIds" placeholder="请选择" multiple collapse-tags style="width: 200px;" size="small">
<el-select v-model="queryParams.objIds" placeholder="请选择" multiple :multiple-limit='5' collapse-tags style="width: 200px;" size="small">
<el-option
v-for="item in objectList"
:key="item.id"

View File

@@ -1,15 +1,17 @@
<template>
<div class="app-container" id="contrastAnalysisBox">
<div class="app-container contrastAnalysisBox" id="contrastAnalysisBox">
<!-- 搜索工作栏 -->
<search-area :isFold="isFold" @submit="getList"/>
<el-tabs v-model="activeName" @tab-click="switchChart">
<el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
<el-tab-pane label="柱状图" name="bar">
<bar-chart ref="analysisBarChart" :chartData="chartData" />
<bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim" />
</el-tab-pane>
<el-tab-pane label="折线图" name="line">
<line-chart ref="analysisLineChart" :chartData="chartData"/>
<line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
</el-tab-pane>
</el-tabs>
<!-- 没有数据 -->
<div class="no-data-bg" v-show='!chartData.length'></div>
</div>
</template>
<script>
@@ -25,7 +27,8 @@ export default {
return {
isFold: false,
activeName: 'bar',
chartData: []
chartData: [],
timeDim: ''
}
},
mounted() {
@@ -38,6 +41,7 @@ export default {
},
methods: {
getList(params) {
this.timeDim = params.timeDim
getCompare({ ...params }).then((res) => {
console.log(res)
if (res.code === 0) {
@@ -60,4 +64,33 @@ export default {
}
}
}
</script>
</script>
<style lang='scss'>
.contrastAnalysisBox {
.el-tabs__nav::after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
/* z-index: 1; */
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
}
</style>