能源分析
This commit is contained in:
@@ -48,13 +48,39 @@ export default {
|
||||
}
|
||||
this.chartDom = document.getElementById('analysischartBar')
|
||||
this.chart = echarts.init(this.chartDom)
|
||||
let tempArr = []
|
||||
let xData = []
|
||||
let yData = []
|
||||
let legendData = []
|
||||
if (this.chartData.length === 0) {
|
||||
return false
|
||||
} else {
|
||||
tempArr = this.chartData[0].trendRespVOList
|
||||
}
|
||||
for (let k = 0; k < tempArr.length; k++) {
|
||||
xData.push(tempArr[k].time)
|
||||
}
|
||||
for (let i = 0; i < this.chartData.length; i++) {
|
||||
xData.push(this.chartData[i].time)
|
||||
yData.push(this.chartData[i].useNum)
|
||||
let obj = {
|
||||
name: this.chartData[i].objName + this.chartData[i].objCode,
|
||||
type: 'bar',
|
||||
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
|
||||
obj.data.push(num)
|
||||
}
|
||||
yData.push(obj)
|
||||
}
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: legendData
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData
|
||||
@@ -62,12 +88,7 @@ export default {
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: yData,
|
||||
type: 'bar'
|
||||
}
|
||||
]
|
||||
series: yData
|
||||
};
|
||||
|
||||
option && this.chart.setOption(option);
|
||||
|
||||
@@ -48,14 +48,41 @@ export default {
|
||||
}
|
||||
this.chartDom = document.getElementById('analysischartLine')
|
||||
this.chart = echarts.init(this.chartDom)
|
||||
let tempArr = []
|
||||
let xData = []
|
||||
let yData = []
|
||||
let legendData = []
|
||||
if (this.chartData.length === 0) {
|
||||
return false
|
||||
} else {
|
||||
tempArr = this.chartData[0].trendRespVOList
|
||||
}
|
||||
for (let k = 0; k < tempArr.length; k++) {
|
||||
xData.push(tempArr[k].time)
|
||||
}
|
||||
for (let i = 0; i < this.chartData.length; i++) {
|
||||
xData.push(this.chartData[i].time)
|
||||
yData.push(this.chartData[i].useNum)
|
||||
let obj = {
|
||||
name: this.chartData[i].objName + this.chartData[i].objCode,
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
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
|
||||
obj.data.push(num)
|
||||
}
|
||||
yData.push(obj)
|
||||
}
|
||||
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: legendData
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData
|
||||
@@ -63,12 +90,7 @@ export default {
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: yData,
|
||||
type: 'line'
|
||||
}
|
||||
]
|
||||
series: yData
|
||||
};
|
||||
|
||||
option && this.chart.setOption(option);
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
:picker-options="pickerOptions"
|
||||
popper-class="noneMinute"
|
||||
@change="timeSelect"
|
||||
:clearable="false"
|
||||
>
|
||||
</el-date-picker>
|
||||
</div>
|
||||
@@ -45,6 +46,7 @@
|
||||
end-placeholder="结束日期"
|
||||
value-format="timestamp"
|
||||
:picker-options="pickerOptions"
|
||||
:clearable="false"
|
||||
@change="timeSelect"
|
||||
>
|
||||
</el-date-picker>
|
||||
@@ -57,6 +59,7 @@
|
||||
style='width:150px;'
|
||||
:picker-options="pickerOptionsWeek"
|
||||
@change="startWeek"
|
||||
:clearable="false"
|
||||
placeholder="选择周">
|
||||
</el-date-picker>-
|
||||
<el-date-picker
|
||||
@@ -66,6 +69,7 @@
|
||||
:picker-options="pickerOptionsWeek"
|
||||
style='width:150px;'
|
||||
@change="endWeek"
|
||||
:clearable="false"
|
||||
placeholder="选择周">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
@@ -77,6 +81,7 @@
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="timestamp"
|
||||
:clearable="false"
|
||||
:picker-options="pickerOptions"
|
||||
@change="timeSelect"
|
||||
>
|
||||
@@ -91,6 +96,7 @@
|
||||
value-format="timestamp"
|
||||
placeholder="选择年"
|
||||
@change="startYear"
|
||||
:clearable="false"
|
||||
>
|
||||
</el-date-picker>-
|
||||
<el-date-picker
|
||||
@@ -101,6 +107,7 @@
|
||||
value-format="timestamp"
|
||||
placeholder="选择年"
|
||||
@change="endYear"
|
||||
:clearable="false"
|
||||
>
|
||||
</el-date-picker>
|
||||
</div>
|
||||
@@ -116,12 +123,14 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="对象选择">
|
||||
<el-select v-model="queryParams.objIds" placeholder="请选择" multiple style="width: 80px;">
|
||||
<el-select v-model="queryParams.objIds" placeholder="请选择" multiple collapse-tags style="width: 200px;">
|
||||
<el-option
|
||||
v-for="item in objectList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<span style="float: left">{{ item.name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -132,6 +141,9 @@
|
||||
</template>
|
||||
<script>
|
||||
import { getEnergyTypeListAll } from "@/api/base/energyType"
|
||||
import { getLineAll } from "@/api/base/productionLine"
|
||||
import { getWorkShopAll } from "@/api/base/workshopSection"
|
||||
import { getEquipmentAll } from "@/api/base/equipment"
|
||||
import moment from 'moment'
|
||||
export default {
|
||||
name: 'searchArea',
|
||||
@@ -268,6 +280,25 @@ export default {
|
||||
// 对象维度
|
||||
selectObjs(val) {
|
||||
console.log(val)
|
||||
switch (val) {
|
||||
case '1':
|
||||
getLineAll().then(res => {
|
||||
this.objectList = res.data || []
|
||||
this.queryParams.objIds = []
|
||||
})
|
||||
break;
|
||||
case '2':
|
||||
getWorkShopAll().then(res => {
|
||||
this.objectList = res.data || []
|
||||
this.queryParams.objIds = []
|
||||
})
|
||||
break;
|
||||
default:
|
||||
getEquipmentAll().then(res => {
|
||||
this.objectList = res.data || []
|
||||
this.queryParams.objIds = []
|
||||
})
|
||||
}
|
||||
},
|
||||
// 查询
|
||||
search() {
|
||||
@@ -332,8 +363,17 @@ export default {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (!this.queryParams.objType) {
|
||||
this.$modal.msgError('请选择对象维度')
|
||||
return false
|
||||
}
|
||||
if (this.queryParams.objIds.length === 0) {
|
||||
this.$modal.msgError('请选择对象')
|
||||
return false
|
||||
}
|
||||
this.queryParams.startTime = this.queryParams.startTime + ''
|
||||
this.queryParams.endTime = this.queryParams.endTime + ''
|
||||
console.log(this.queryParams)
|
||||
this.$emit('submit', this.queryParams)
|
||||
},
|
||||
transformTime(timeStamp) {// 本月最后一天
|
||||
|
||||
Reference in New Issue
Block a user