能源需求修改
This commit is contained in:
@@ -1,148 +1,149 @@
|
||||
<template>
|
||||
<div
|
||||
id="analysischartBar"
|
||||
style="width: 100%"
|
||||
:style="{ height: chartHeight + 'px' }"
|
||||
></div>
|
||||
<div
|
||||
id="analysischartBar"
|
||||
style="width: 100%"
|
||||
:style="{ height: chartHeight + 'px' }"></div>
|
||||
</template>
|
||||
<script>
|
||||
import * as echarts from 'echarts'
|
||||
import resize from '@/utils/chartMixins/resize'
|
||||
import * as echarts from 'echarts';
|
||||
import resize from '@/utils/chartMixins/resize';
|
||||
export default {
|
||||
name: "BarChart",
|
||||
mixins: [resize],
|
||||
data() {
|
||||
return {
|
||||
chartDom: '',
|
||||
chart: '',
|
||||
chartHeight: this.tableHeight(214) - 70
|
||||
}
|
||||
},
|
||||
props: {
|
||||
chartData: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
timeDim: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
chartData: function () {
|
||||
this.getChart()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.chartHeight = this.tableHeight(214) - 70
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getChart() {
|
||||
if (
|
||||
this.chart !== null &&
|
||||
this.chart !== '' &&
|
||||
this.chart !== undefined
|
||||
) {
|
||||
this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||
}
|
||||
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++) {
|
||||
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 : ''
|
||||
obj.data.push(num)
|
||||
}
|
||||
yData.push(obj)
|
||||
}
|
||||
var option = {
|
||||
color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
},
|
||||
formatter: function(params) {
|
||||
return (
|
||||
params[0].axisValue +
|
||||
`<br>` +
|
||||
params.map((item) => {
|
||||
let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${item.color};"></span>`
|
||||
let seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</span>`
|
||||
let value = item.value ? item.value : '-'
|
||||
let valueStr = `<span style="display:inline-block;margin-left:10px;color:rgba(0,0,0,0.45);">${value}</span>`
|
||||
return `<span style="display:flex; justify-content:space-between; margin-bottom: 2px">
|
||||
name: 'BarChart',
|
||||
mixins: [resize],
|
||||
data() {
|
||||
return {
|
||||
chartDom: '',
|
||||
chart: '',
|
||||
chartHeight: this.tableHeight(250) / 2,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
chartData: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
timeDim: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
chartData: function () {
|
||||
this.getChart();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.chartHeight = this.tableHeight(250) / 2;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getChart() {
|
||||
if (
|
||||
this.chart !== null &&
|
||||
this.chart !== '' &&
|
||||
this.chart !== undefined
|
||||
) {
|
||||
this.chart.dispose(); // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||
}
|
||||
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++) {
|
||||
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.toFixed(2) : '';
|
||||
obj.data.push(num);
|
||||
}
|
||||
yData.push(obj);
|
||||
}
|
||||
var option = {
|
||||
color: ['#FFDC94', '#8EF0AB', '#63BDFF', '#288AFF', '#7164FF'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow',
|
||||
},
|
||||
formatter: function (params) {
|
||||
return (
|
||||
params[0].axisValue +
|
||||
`<br>` +
|
||||
params
|
||||
.map((item) => {
|
||||
let str = `<span style="display:inline-block;width:8px;height:8px;margin: 0 8px 0 -3px;border-radius:2px;background-color:${item.color};"></span>`;
|
||||
let seriesNameStr = `<span style="display:inline-block;">${item.seriesName}</span>`;
|
||||
let value = item.value ? item.value : '-';
|
||||
let valueStr = `<span style="display:inline-block;margin-left:10px;color:rgba(0,0,0,0.45);">${value}</span>`;
|
||||
return `<span style="display:flex; justify-content:space-between; margin-bottom: 2px">
|
||||
<span>${str}${seriesNameStr}</span>
|
||||
<span>${valueStr}</span>
|
||||
</span>`
|
||||
}).join(``)
|
||||
)
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '4%',
|
||||
right: '1%',
|
||||
bottom: '1%',
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
data: legendData,
|
||||
right: '1%',
|
||||
icon: 'rect',
|
||||
itemHeight: 8,
|
||||
itemWidth: 8
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData,
|
||||
axisLabel: {
|
||||
rotate: "45"
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: yData
|
||||
};
|
||||
</span>`;
|
||||
})
|
||||
.join(``)
|
||||
);
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
left: '4%',
|
||||
right: '1%',
|
||||
bottom: '1%',
|
||||
containLabel: true,
|
||||
},
|
||||
legend: {
|
||||
data: legendData,
|
||||
right: '1%',
|
||||
icon: 'rect',
|
||||
itemHeight: 8,
|
||||
itemWidth: 8,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData,
|
||||
axisLabel: {
|
||||
rotate: '45',
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: yData,
|
||||
};
|
||||
|
||||
option && this.chart.setOption(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
option && this.chart.setOption(option);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -1,126 +0,0 @@
|
||||
<template>
|
||||
<div
|
||||
id="analysischartLine"
|
||||
style="width: 100%"
|
||||
:style="{ height: chartHeight + 'px' }"
|
||||
></div>
|
||||
</template>
|
||||
<script>
|
||||
import * as echarts from 'echarts'
|
||||
import resize from '@/utils/chartMixins/resize'
|
||||
export default {
|
||||
name: "LineChart",
|
||||
mixins: [resize],
|
||||
data() {
|
||||
return {
|
||||
chartDom: '',
|
||||
chart: '',
|
||||
chartHeight: this.tableHeight(214) - 70
|
||||
}
|
||||
},
|
||||
props: {
|
||||
chartData: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
timeDim: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
chartData: function () {
|
||||
this.getChart()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.chartHeight = this.tableHeight(214) - 70
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getChart() {
|
||||
if (
|
||||
this.chart !== null &&
|
||||
this.chart !== '' &&
|
||||
this.chart !== undefined
|
||||
) {
|
||||
this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||
}
|
||||
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++) {
|
||||
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: '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 : ''
|
||||
obj.data.push(num)
|
||||
}
|
||||
yData.push(obj)
|
||||
}
|
||||
|
||||
var option = {
|
||||
color:['#FFDC94','#8EF0AB','#63BDFF','#288AFF','#7164FF'],
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '4%',
|
||||
right: '1%',
|
||||
bottom: '1%',
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
data: legendData,
|
||||
right: '1%'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData,
|
||||
axisLabel: {
|
||||
rotate: "45"
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: yData
|
||||
};
|
||||
|
||||
option && this.chart.setOption(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,96 +1,129 @@
|
||||
<template>
|
||||
<div class="app-container contrastAnalysisBox" id="contrastAnalysisBox">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-area :isFold="isFold" @submit="getList"/>
|
||||
<el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
|
||||
<el-tab-pane label="柱状图" name="bar">
|
||||
<bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="折线图" name="line">
|
||||
<line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<!-- 没有数据 -->
|
||||
<div class="no-data-bg" v-show='!chartData.length'></div>
|
||||
</div>
|
||||
<div
|
||||
class="app-container contrastAnalysisBox"
|
||||
id="contrastAnalysisBox">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-area
|
||||
:isFold="isFold"
|
||||
@submit="getList"
|
||||
@export="exportExl" />
|
||||
<div v-show="chartData.length">
|
||||
<bar-chart
|
||||
ref="analysisBarChart"
|
||||
:chartData="chartData"
|
||||
:timeDim="timeDim" />
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:max-height="tableH"
|
||||
class="contrast-out-table" />
|
||||
</div>
|
||||
<!-- 没有数据 -->
|
||||
<div
|
||||
class="no-data-bg"
|
||||
v-show="!chartData.length"></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getCompare } from "@/api/analysis/energyAnalysis"
|
||||
import SearchArea from "./components/searchArea"
|
||||
import BarChart from "./components/barChart"
|
||||
import LineChart from "./components/lineChart"
|
||||
import { getCompare } from '@/api/analysis/energyAnalysis';
|
||||
import SearchArea from './components/searchArea';
|
||||
import BarChart from './components/barChart';
|
||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||
import FileSaver from 'file-saver';
|
||||
import * as XLSX from 'xlsx/xlsx.mjs';
|
||||
// import moment from 'moment'
|
||||
export default {
|
||||
name: 'ContrastAnalysis',
|
||||
components: { SearchArea, BarChart, LineChart },
|
||||
data() {
|
||||
return {
|
||||
isFold: false,
|
||||
activeName: 'bar',
|
||||
chartData: [],
|
||||
timeDim: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260)
|
||||
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
|
||||
// console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
|
||||
})
|
||||
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437)
|
||||
},
|
||||
methods: {
|
||||
getList(params) {
|
||||
this.timeDim = params.timeDim
|
||||
getCompare({ ...params }).then((res) => {
|
||||
console.log(res)
|
||||
if (res.code === 0) {
|
||||
this.chartData = res.data || []
|
||||
} else {
|
||||
this.chartData = []
|
||||
}
|
||||
})
|
||||
},
|
||||
switchChart() {
|
||||
if (this.activeName === 'bar') {
|
||||
this.$nextTick((res) => {
|
||||
this.$refs.analysisBarChart.getChart()
|
||||
})
|
||||
} else {
|
||||
this.$nextTick((res) => {
|
||||
this.$refs.analysisLineChart.getChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'ContrastAnalysis',
|
||||
components: { SearchArea, BarChart },
|
||||
mixins: [tableHeightMixin],
|
||||
data() {
|
||||
return {
|
||||
isFold: false,
|
||||
chartData: [],
|
||||
timeDim: '',
|
||||
tableProps: [],
|
||||
list: [],
|
||||
tableH: this.tableHeight(250) / 2,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
|
||||
// console.log(document.getElementById("contrastAnalysisBox").offsetWidth)
|
||||
});
|
||||
this.isFold = this.searchBarWidth('contrastAnalysisBox', 1437);
|
||||
},
|
||||
methods: {
|
||||
_setTableHeight() {
|
||||
this.tableH = this.tableHeight(250) / 2;
|
||||
},
|
||||
getList(params) {
|
||||
this.timeDim = params.timeDim;
|
||||
getCompare({ ...params }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.getTableList(res.data || []);
|
||||
this.chartData = res.data || [];
|
||||
} else {
|
||||
this.chartData = [];
|
||||
}
|
||||
});
|
||||
},
|
||||
getTableList(arr) {
|
||||
this.tableProps = [];
|
||||
this.list = [];
|
||||
let tempX = [];
|
||||
let timeArr = arr[0].trendRespVOList || [];
|
||||
this.list = timeArr.map((item) => {
|
||||
return { time: item.time };
|
||||
});
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let obj = {};
|
||||
obj.prop = arr[i].objId;
|
||||
obj.label = arr[i].objName;
|
||||
obj.minWidth = 100;
|
||||
tempX.push(obj);
|
||||
let tiemList = arr[i].trendRespVOList;
|
||||
for (let j = 0; j < tiemList.length; j++) {
|
||||
this.list[j][arr[i].objId] = tiemList[j].useNum
|
||||
? tiemList[j].useNum.toFixed(2)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
|
||||
},
|
||||
// 导出
|
||||
exportExl() {
|
||||
if (this.list.length > 0) {
|
||||
var wb = XLSX.utils.table_to_book(
|
||||
document.querySelector('.contrast-out-table')
|
||||
);
|
||||
let fileName = '对比分析.xlsx';
|
||||
var wbout = XLSX.write(wb, {
|
||||
bookType: 'xlsx',
|
||||
bookSST: true,
|
||||
type: 'array',
|
||||
});
|
||||
try {
|
||||
FileSaver.saveAs(
|
||||
new Blob([wbout], { type: 'application/octet-stream' }),
|
||||
fileName
|
||||
);
|
||||
this.$message.success('导出成功');
|
||||
} catch (e) {
|
||||
if (typeof console !== 'undefined') console.log(e, wbout);
|
||||
}
|
||||
return wbout;
|
||||
} else {
|
||||
this.$modal.msgWarning('暂无数据导出');
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</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);
|
||||
}
|
||||
.contrast-out-table {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,232 +1,253 @@
|
||||
<template>
|
||||
<el-form :inline="true" class="demo-form-inline">
|
||||
<span class="blue-block"></span>
|
||||
<el-form-item label="对象选择" required>
|
||||
<el-cascader
|
||||
v-model="objArr"
|
||||
:options="objList"
|
||||
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
||||
popper-class="cascaderParent"
|
||||
size="small"
|
||||
style="width: 250px;"
|
||||
clearable></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间维度" required>
|
||||
<el-select v-model="queryParams.type" placeholder="请选择" style="width: 80px;" size="small">
|
||||
<el-option
|
||||
v-for="item in timeType"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:clearable="false">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间" required>
|
||||
<div v-show="queryParams.type === 1">
|
||||
<el-date-picker
|
||||
v-model="monthValue"
|
||||
type="month"
|
||||
:picker-options="pickerOptions"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择月">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div v-show="queryParams.type === 2">
|
||||
<el-date-picker
|
||||
v-model="weekValue"
|
||||
type="week"
|
||||
format="yyyy 第 WW 周"
|
||||
:picker-options="pickerOptionsWeek"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择周">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div v-show="queryParams.type === 3">
|
||||
<el-date-picker
|
||||
v-model="dateValue"
|
||||
type="date"
|
||||
:picker-options="pickerOptions"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择日">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" @click="search">查询</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<span class="separateStyle"></span>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" @click="exportData" plain>导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline">
|
||||
<span class="blue-block"></span>
|
||||
<el-form-item
|
||||
label="对象选择"
|
||||
required>
|
||||
<el-select
|
||||
v-model="queryParams.objId"
|
||||
placeholder="请选择"
|
||||
style="width: 250px"
|
||||
filterable
|
||||
size="small">
|
||||
<el-option
|
||||
v-for="item in objList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:clearable="false"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="时间维度"
|
||||
required>
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
placeholder="请选择"
|
||||
style="width: 80px"
|
||||
size="small">
|
||||
<el-option
|
||||
v-for="item in timeType"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:clearable="false"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="时间"
|
||||
required>
|
||||
<div v-show="queryParams.type === 1">
|
||||
<el-date-picker
|
||||
v-model="monthValue"
|
||||
type="month"
|
||||
:picker-options="pickerOptions"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择月"></el-date-picker>
|
||||
</div>
|
||||
<div v-show="queryParams.type === 2">
|
||||
<el-date-picker
|
||||
v-model="weekValue"
|
||||
type="week"
|
||||
format="yyyy 第 WW 周"
|
||||
:picker-options="pickerOptionsWeek"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择周"></el-date-picker>
|
||||
</div>
|
||||
<div v-show="queryParams.type === 3">
|
||||
<el-date-picker
|
||||
v-model="dateValue"
|
||||
type="date"
|
||||
:picker-options="pickerOptions"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择日"></el-date-picker>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="search">
|
||||
查询
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<span class="separateStyle"></span>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="exportData"
|
||||
plain>
|
||||
导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import { getTree } from '@/api/base/factory'
|
||||
import moment from 'moment'
|
||||
import { getTree } from '@/api/analysis/energyAnalysis';
|
||||
import moment from 'moment';
|
||||
export default {
|
||||
name: 'searchArea',
|
||||
data() {
|
||||
return {
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
type: 1,
|
||||
searchTime: null,
|
||||
objId: null
|
||||
},
|
||||
timeType: [
|
||||
{id: 1, name: '月'},
|
||||
{id: 2, name: '周'},
|
||||
{id: 3, name: '日'}
|
||||
],
|
||||
monthValue: '',
|
||||
weekValue: '',
|
||||
dateValue: '',
|
||||
objArr: [],
|
||||
objList: [],
|
||||
pickerOptions: {
|
||||
disabledDate(date) {
|
||||
return date.getTime() > Date.now()
|
||||
}
|
||||
},
|
||||
pickerOptionsWeek: {
|
||||
disabledDate(time) {
|
||||
let day = Date.now()
|
||||
let limitTime = moment(day).day(-1)
|
||||
return time.getTime() > new Date(limitTime).getTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getObjTree()
|
||||
},
|
||||
methods: {
|
||||
getObjTree() {
|
||||
getTree().then(res => {
|
||||
this.objList = res.data || []
|
||||
})
|
||||
},
|
||||
selectTime() {
|
||||
switch (this.queryParams.type) {
|
||||
case 1:
|
||||
this.queryParams.searchTime = this.monthValue
|
||||
break;
|
||||
case 2:
|
||||
this.queryParams.searchTime = this.weekValue
|
||||
break;
|
||||
default:
|
||||
this.queryParams.searchTime = this.dateValue
|
||||
}
|
||||
},
|
||||
// 查询
|
||||
search() {
|
||||
if (this.objArr.length === 0) {
|
||||
this.$modal.msgError('请选择对象')
|
||||
return false
|
||||
} else {
|
||||
this.queryParams.objId = this.objArr[this.objArr.length-1]
|
||||
}
|
||||
if (!this.queryParams.type) {
|
||||
this.$modal.msgError('请选择时间维度')
|
||||
return false
|
||||
}
|
||||
if (!this.queryParams.searchTime) {
|
||||
this.$modal.msgError('请选择时间')
|
||||
return false
|
||||
}
|
||||
switch (this.queryParams.type) {
|
||||
case 1:
|
||||
this.queryParams.searchTime = this.transformTime(this.monthValue)
|
||||
break;
|
||||
case 2:
|
||||
let value = moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59'
|
||||
this.queryParams.searchTime = new Date(value).getTime()
|
||||
break;
|
||||
default:
|
||||
let value2 = moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59'
|
||||
this.queryParams.searchTime = new Date(value2).getTime()
|
||||
}
|
||||
this.$emit('submit', this.queryParams)
|
||||
},
|
||||
exportData() {
|
||||
let name
|
||||
if (this.queryParams.objId) {
|
||||
name = this.getObjName(this.objList, this.queryParams.objId)
|
||||
} else {
|
||||
this.$modal.msgWarning("对象不能为空")
|
||||
return false
|
||||
}
|
||||
this.$emit('exportD', {name: name})
|
||||
},
|
||||
// 递归取对象name
|
||||
getObjName(list, id) {
|
||||
let _this = this
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let a = list[i]
|
||||
if (a.id === id) {
|
||||
return a.name
|
||||
} else {
|
||||
if (a.children && a.children.length > 0) {
|
||||
let res = _this.getObjName(a.children, id)
|
||||
if (res) {
|
||||
return res
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
transformTime(timeStamp) {// 本月最后一天
|
||||
let year = moment(timeStamp).format('YYYY')
|
||||
let month = moment(timeStamp).format('MM')
|
||||
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
|
||||
let value = new Date(newData).getTime()
|
||||
return value
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'searchArea',
|
||||
data() {
|
||||
return {
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
type: 1,
|
||||
searchTime: null,
|
||||
objId: null,
|
||||
objType: 1,
|
||||
},
|
||||
timeType: [
|
||||
{ id: 1, name: '月' },
|
||||
{ id: 2, name: '周' },
|
||||
{ id: 3, name: '日' },
|
||||
],
|
||||
monthValue: '',
|
||||
weekValue: '',
|
||||
dateValue: '',
|
||||
objList: [],
|
||||
pickerOptions: {
|
||||
disabledDate(date) {
|
||||
return date.getTime() > Date.now();
|
||||
},
|
||||
},
|
||||
pickerOptionsWeek: {
|
||||
disabledDate(time) {
|
||||
let day = Date.now();
|
||||
let limitTime = moment(day).day(-1);
|
||||
return time.getTime() > new Date(limitTime).getTime();
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getObjTree();
|
||||
},
|
||||
methods: {
|
||||
getObjTree() {
|
||||
getTree().then((res) => {
|
||||
this.objList = res.data || [];
|
||||
if (this.objList.length > 0) {
|
||||
this.queryParams.objId = this.objList[0].id;
|
||||
}
|
||||
});
|
||||
},
|
||||
selectTime() {
|
||||
switch (this.queryParams.type) {
|
||||
case 1:
|
||||
this.queryParams.searchTime = this.monthValue;
|
||||
break;
|
||||
case 2:
|
||||
this.queryParams.searchTime = this.weekValue;
|
||||
break;
|
||||
default:
|
||||
this.queryParams.searchTime = this.dateValue;
|
||||
}
|
||||
},
|
||||
// 查询
|
||||
search() {
|
||||
if (!this.queryParams.objId) {
|
||||
this.$modal.msgError('请选择对象');
|
||||
return false;
|
||||
}
|
||||
if (!this.queryParams.type) {
|
||||
this.$modal.msgError('请选择时间维度');
|
||||
return false;
|
||||
}
|
||||
if (!this.queryParams.searchTime) {
|
||||
this.$modal.msgError('请选择时间');
|
||||
return false;
|
||||
}
|
||||
switch (this.queryParams.type) {
|
||||
case 1:
|
||||
this.queryParams.searchTime = this.transformTime(this.monthValue);
|
||||
break;
|
||||
case 2:
|
||||
let value =
|
||||
moment(this.weekValue).day(6).format('YYYY-MM-DD') + ' 23:59:59';
|
||||
this.queryParams.searchTime = new Date(value).getTime();
|
||||
break;
|
||||
default:
|
||||
let value2 =
|
||||
moment(this.dateValue).format('YYYY-MM-DD') + ' 23:59:59';
|
||||
this.queryParams.searchTime = new Date(value2).getTime();
|
||||
}
|
||||
this.$emit('submit', this.queryParams);
|
||||
},
|
||||
exportData() {
|
||||
let name;
|
||||
if (this.queryParams.objId) {
|
||||
name = this.getObjName(this.objList, this.queryParams.objId);
|
||||
} else {
|
||||
this.$modal.msgWarning('对象不能为空');
|
||||
return false;
|
||||
}
|
||||
this.$emit('exportD', { name: name });
|
||||
},
|
||||
// 递归取对象name
|
||||
getObjName(list, id) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let a = list[i];
|
||||
if (a.id === id) {
|
||||
return a.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
transformTime(timeStamp) {
|
||||
// 本月最后一天
|
||||
let year = moment(timeStamp).format('YYYY');
|
||||
let month = moment(timeStamp).format('MM');
|
||||
let newData =
|
||||
moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
|
||||
let value = new Date(newData).getTime();
|
||||
return value;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
/* 级联选择器 */
|
||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
||||
display: none;
|
||||
}
|
||||
.demo-form-inline {
|
||||
.el-date-editor .el-range__icon {
|
||||
font-size: 16px;
|
||||
color: #0B58FF;
|
||||
}
|
||||
.el-input__prefix .el-icon-date {
|
||||
font-size: 16px;
|
||||
color: #0B58FF;
|
||||
}
|
||||
.el-date-editor .el-range__icon {
|
||||
font-size: 16px;
|
||||
color: #0b58ff;
|
||||
}
|
||||
.el-input__prefix .el-icon-date {
|
||||
font-size: 16px;
|
||||
color: #0b58ff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.separateStyle {
|
||||
display: inline-block;
|
||||
width: 1px;
|
||||
height: 24px;
|
||||
background: #E8E8E8;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
width: 1px;
|
||||
height: 24px;
|
||||
background: #e8e8e8;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.demo-form-inline {
|
||||
.blue-block {
|
||||
display: inline-block;
|
||||
width: 4px;
|
||||
height: 16px;
|
||||
background-color: #0B58FF;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.blue-block {
|
||||
display: inline-block;
|
||||
width: 4px;
|
||||
height: 16px;
|
||||
background-color: #0b58ff;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.el-form-item {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,132 +1,140 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-area @submit="getList" @exportD="exportData"/>
|
||||
<!-- 表格 -->
|
||||
<div v-show="chartData.length">
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
class="qoq-out-table"
|
||||
/>
|
||||
<div class="chartTitle">环比分析图</div>
|
||||
<div style='width: 100%'>
|
||||
<line-chart ref="analysisLineChart" :chartData="chartData"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 没有数据 -->
|
||||
<div class="no-data-bg" v-show='!chartData.length'></div>
|
||||
</div>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-area
|
||||
@submit="getList"
|
||||
@exportD="exportData" />
|
||||
<!-- 表格 -->
|
||||
<div v-show="chartData.length">
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
class="qoq-out-table" />
|
||||
<div class="chartTitle">环比分析图</div>
|
||||
<div style="width: 100%">
|
||||
<line-chart
|
||||
ref="analysisLineChart"
|
||||
:chartData="chartData" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 没有数据 -->
|
||||
<div
|
||||
class="no-data-bg"
|
||||
v-show="!chartData.length"></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getQoq } from "@/api/analysis/energyAnalysis"
|
||||
import SearchArea from "./components/searchArea"
|
||||
import LineChart from "./components/lineChart"
|
||||
import FileSaver from "file-saver"
|
||||
import * as XLSX from 'xlsx/xlsx.mjs'
|
||||
import { getQoq } from '@/api/analysis/energyAnalysis';
|
||||
import SearchArea from './components/searchArea';
|
||||
import LineChart from './components/lineChart';
|
||||
import FileSaver from 'file-saver';
|
||||
import * as XLSX from 'xlsx/xlsx.mjs';
|
||||
export default {
|
||||
name: 'QoqAnalysis',
|
||||
components: { SearchArea, LineChart },
|
||||
data() {
|
||||
return {
|
||||
chartData: [],
|
||||
tableProps: [],
|
||||
list: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList(params) {
|
||||
getQoq({ ...params }).then((res) => {
|
||||
if (res.code === 0 && res.data) {
|
||||
this.getTableList(res.data)
|
||||
} else {
|
||||
this.chartData = []
|
||||
this.list = []
|
||||
}
|
||||
})
|
||||
},
|
||||
getTableList(arr) {
|
||||
let data = arr.data
|
||||
let nameData = arr.nameData
|
||||
let tempX = []
|
||||
data[0].data.map((item) => {
|
||||
let obj = {}
|
||||
obj.prop = item.dynamicName
|
||||
obj.label = item.dynamicName
|
||||
obj.id = item.id
|
||||
obj.children = []
|
||||
tempX.push(obj)
|
||||
})
|
||||
for (let i = 0; i < nameData.length; i++) {
|
||||
for (let j = 0; j < tempX.length; j++) {
|
||||
if (tempX[j].id === nameData[i].parentId) {
|
||||
let obj = {}
|
||||
obj.prop = tempX[j].prop + '_' + nameData[i].name
|
||||
obj.label = nameData[i].name
|
||||
tempX[j].children.push(obj)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.tableProps = [{prop: 'time',label: '时间'}].concat(tempX)
|
||||
// 数据
|
||||
this.list = []
|
||||
for (let k = 0; k < data.length; k++) {
|
||||
let obj = {}
|
||||
obj.time = data[k].time
|
||||
let arr1 = data[k].data
|
||||
obj.type = []
|
||||
for (let q = 0; q < arr1.length; q++) {
|
||||
let name = arr1[q].dynamicName
|
||||
obj.type.push(name)
|
||||
let arr2 = arr1[q].children
|
||||
for (let p = 0; p < arr2.length; p++) {
|
||||
let prop = name + '_' + arr2[p].dynamicName
|
||||
obj[prop] = arr2[p].dynamicValue
|
||||
}
|
||||
}
|
||||
this.list.push(obj)
|
||||
}
|
||||
this.chartData = this.list
|
||||
},
|
||||
exportData(val) {
|
||||
if (this.list.length > 0) {
|
||||
var wb = XLSX.utils.table_to_book(document.querySelector(".qoq-out-table"))
|
||||
let fileName = val.name + "环比分析.xlsx"
|
||||
var wbout = XLSX.write(wb, {
|
||||
bookType: "xlsx",
|
||||
bookSST: true,
|
||||
type: "array"
|
||||
})
|
||||
try {
|
||||
FileSaver.saveAs(
|
||||
new Blob([wbout], { type: "application/octet-stream" }),
|
||||
fileName
|
||||
)
|
||||
} catch (e) {
|
||||
if (typeof console !== "undefined") console.log(e, wbout);
|
||||
}
|
||||
return wbout
|
||||
} else {
|
||||
this.$modal.msgWarning("暂无数据导出")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'QoqAnalysis',
|
||||
components: { SearchArea, LineChart },
|
||||
data() {
|
||||
return {
|
||||
chartData: [],
|
||||
tableProps: [],
|
||||
list: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getList(params) {
|
||||
getQoq({ ...params }).then((res) => {
|
||||
if (res.code === 0 && res.data) {
|
||||
this.getTableList(res.data);
|
||||
} else {
|
||||
this.chartData = [];
|
||||
this.list = [];
|
||||
}
|
||||
});
|
||||
},
|
||||
getTableList(arr) {
|
||||
let data = arr.data;
|
||||
let nameData = arr.nameData;
|
||||
let tempX = [];
|
||||
data[0].data.map((item) => {
|
||||
let obj = {};
|
||||
obj.prop = item.dynamicName;
|
||||
obj.label = item.dynamicName;
|
||||
obj.id = item.id;
|
||||
obj.children = [];
|
||||
tempX.push(obj);
|
||||
});
|
||||
for (let i = 0; i < nameData.length; i++) {
|
||||
for (let j = 0; j < tempX.length; j++) {
|
||||
if (tempX[j].id === nameData[i].parentId) {
|
||||
let obj = {};
|
||||
obj.prop = tempX[j].prop + '_' + nameData[i].name;
|
||||
obj.label = nameData[i].name;
|
||||
tempX[j].children.push(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.tableProps = [{ prop: 'time', label: '时间' }].concat(tempX);
|
||||
// 数据
|
||||
this.list = [];
|
||||
for (let k = 0; k < data.length; k++) {
|
||||
let obj = {};
|
||||
obj.time = data[k].time;
|
||||
let arr1 = data[k].data;
|
||||
obj.type = [];
|
||||
for (let q = 0; q < arr1.length; q++) {
|
||||
let name = arr1[q].dynamicName;
|
||||
obj.type.push(name);
|
||||
let arr2 = arr1[q].children;
|
||||
for (let p = 0; p < arr2.length; p++) {
|
||||
let prop = name + '_' + arr2[p].dynamicName;
|
||||
obj[prop] = arr2[p].dynamicValue;
|
||||
}
|
||||
}
|
||||
this.list.push(obj);
|
||||
}
|
||||
this.chartData = this.list;
|
||||
},
|
||||
exportData(val) {
|
||||
if (this.list.length > 0) {
|
||||
var wb = XLSX.utils.table_to_book(
|
||||
document.querySelector('.qoq-out-table')
|
||||
);
|
||||
let fileName = val.name + '环比分析.xlsx';
|
||||
var wbout = XLSX.write(wb, {
|
||||
bookType: 'xlsx',
|
||||
bookSST: true,
|
||||
type: 'array',
|
||||
});
|
||||
try {
|
||||
FileSaver.saveAs(
|
||||
new Blob([wbout], { type: 'application/octet-stream' }),
|
||||
fileName
|
||||
);
|
||||
this.$message.success('导出成功');
|
||||
} catch (e) {
|
||||
if (typeof console !== 'undefined') console.log(e, wbout);
|
||||
}
|
||||
return wbout;
|
||||
} else {
|
||||
this.$modal.msgWarning('暂无数据导出');
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang='scss' scoped>
|
||||
.chartTitle {
|
||||
font-size: 16px;
|
||||
color: #000;
|
||||
margin-top: 20px;
|
||||
font-size: 16px;
|
||||
color: #000;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.chartTitle::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 4px;
|
||||
height: 18px;
|
||||
background-color: #0B58FF;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
vertical-align: bottom;
|
||||
content: '';
|
||||
display: inline-block;
|
||||
width: 4px;
|
||||
height: 18px;
|
||||
background-color: #0b58ff;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
</style>
|
||||
@@ -1,103 +1,102 @@
|
||||
<template>
|
||||
<div
|
||||
id="analysischartLine"
|
||||
style="width: 100%"
|
||||
:style="{ height: chartHeight + 'px' }"
|
||||
></div>
|
||||
<div
|
||||
id="analysischartLine"
|
||||
style="width: 100%"
|
||||
:style="{ height: chartHeight + 'px' }"></div>
|
||||
</template>
|
||||
<script>
|
||||
import * as echarts from 'echarts'
|
||||
import resize from '@/utils/chartMixins/resize'
|
||||
import * as echarts from 'echarts';
|
||||
import resize from '@/utils/chartMixins/resize';
|
||||
export default {
|
||||
name: "LineChart",
|
||||
mixins: [resize],
|
||||
data() {
|
||||
return {
|
||||
chartDom: '',
|
||||
chart: '',
|
||||
chartHeight: this.tableHeight(214) - 70
|
||||
}
|
||||
},
|
||||
props: {
|
||||
chartData: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
timeDim: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
chartData: function () {
|
||||
this.getChart()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.chartHeight = this.tableHeight(214) - 70
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getChart() {
|
||||
if (
|
||||
this.chart !== null &&
|
||||
this.chart !== '' &&
|
||||
this.chart !== undefined
|
||||
) {
|
||||
this.chart.dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||
}
|
||||
this.chartDom = document.getElementById('analysischartLine')
|
||||
this.chart = echarts.init(this.chartDom)
|
||||
let xData = []
|
||||
let yData = []
|
||||
for (let i = 0; i < this.chartData.length; i++) {
|
||||
let time = ""
|
||||
if (this.timeDim === '3') {
|
||||
let year = this.chartData[i].time.slice(0,4)
|
||||
let weak = this.chartData[i].time.slice(4,6)
|
||||
time = year+' 第 '+weak+' 周'
|
||||
} else {
|
||||
time = this.chartData[i].time
|
||||
}
|
||||
xData.push(time)
|
||||
yData.push(this.chartData[i].useNum)
|
||||
}
|
||||
name: 'LineChart',
|
||||
mixins: [resize],
|
||||
data() {
|
||||
return {
|
||||
chartDom: '',
|
||||
chart: '',
|
||||
chartHeight: this.tableHeight(214) - 100,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
chartData: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
timeDim: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
chartData: function () {
|
||||
this.getChart();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.chartHeight = this.tableHeight(214) - 70;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getChart() {
|
||||
if (
|
||||
this.chart !== null &&
|
||||
this.chart !== '' &&
|
||||
this.chart !== undefined
|
||||
) {
|
||||
this.chart.dispose(); // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||
}
|
||||
this.chartDom = document.getElementById('analysischartLine');
|
||||
this.chart = echarts.init(this.chartDom);
|
||||
let xData = [];
|
||||
let yData = [];
|
||||
for (let i = 0; i < this.chartData.length; i++) {
|
||||
let time = '';
|
||||
if (this.timeDim === '3') {
|
||||
let year = this.chartData[i].time.slice(0, 4);
|
||||
let weak = this.chartData[i].time.slice(4, 6);
|
||||
time = year + ' 第 ' + weak + ' 周';
|
||||
} else {
|
||||
time = this.chartData[i].time;
|
||||
}
|
||||
xData.push(time);
|
||||
yData.push(this.chartData[i].useNum);
|
||||
}
|
||||
|
||||
var option = {
|
||||
color:['#288AFF'],
|
||||
// tooltip: {
|
||||
// trigger: 'axis'
|
||||
// },
|
||||
grid: {
|
||||
left: '4%',
|
||||
right: '1%',
|
||||
bottom: '1%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData,
|
||||
axisLabel: {
|
||||
rotate: "45"
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: yData,
|
||||
type: 'line'
|
||||
}
|
||||
]
|
||||
};
|
||||
var option = {
|
||||
color: ['#288AFF'],
|
||||
// tooltip: {
|
||||
// trigger: 'axis'
|
||||
// },
|
||||
grid: {
|
||||
left: '4%',
|
||||
right: '1%',
|
||||
bottom: '1%',
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xData,
|
||||
axisLabel: {
|
||||
rotate: '45',
|
||||
},
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: yData,
|
||||
type: 'line',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
option && this.chart.setOption(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
option && this.chart.setOption(option);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,94 +1,113 @@
|
||||
<template>
|
||||
<div class="app-container trendAnalysisBox" id="trendAnalysisBox">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-area :isFold="isFold" @submit="getList"/>
|
||||
<el-tabs v-model="activeName" @tab-click="switchChart" v-show='chartData.length'>
|
||||
<el-tab-pane label="柱状图" name="bar">
|
||||
<bar-chart ref="analysisBarChart" :chartData="chartData" :timeDim="timeDim"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="折线图" name="line">
|
||||
<line-chart ref="analysisLineChart" :chartData="chartData" :timeDim="timeDim"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<!-- 没有数据 -->
|
||||
<div class="no-data-bg" v-show='!chartData.length'></div>
|
||||
</div>
|
||||
<div
|
||||
class="app-container trendAnalysisBox"
|
||||
id="trendAnalysisBox">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-area
|
||||
:isFold="isFold"
|
||||
@submit="getList"
|
||||
@export="exportExl" />
|
||||
<div v-show="chartData.length">
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
class="trend-out-table" />
|
||||
<line-chart
|
||||
ref="analysisLineChart"
|
||||
:chartData="chartData"
|
||||
:timeDim="timeDim" />
|
||||
</div>
|
||||
<!-- 没有数据 -->
|
||||
<div
|
||||
class="no-data-bg"
|
||||
v-show="!chartData.length"></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getEnergyTrend } from "@/api/analysis/energyAnalysis"
|
||||
import SearchArea from "./components/searchArea"
|
||||
import BarChart from "./components/barChart"
|
||||
import LineChart from "./components/lineChart"
|
||||
import { getEnergyTrend, exportTrend } from '@/api/analysis/energyAnalysis';
|
||||
import SearchArea from './components/searchArea';
|
||||
import LineChart from './components/lineChart';
|
||||
// import moment from 'moment'
|
||||
export default {
|
||||
name: 'TrendAnalysis',
|
||||
components: { SearchArea, BarChart, LineChart },
|
||||
data() {
|
||||
return {
|
||||
isFold: false,
|
||||
activeName: 'bar',
|
||||
chartData: [],
|
||||
timeDim: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260)
|
||||
this.isFold = this.searchBarWidth('trendAnalysisBox', 1263)
|
||||
})
|
||||
this.isFold = this.searchBarWidth('trendAnalysisBox', 1263)
|
||||
},
|
||||
methods: {
|
||||
getList(params) {
|
||||
this.timeDim = params.timeDim
|
||||
getEnergyTrend({ ...params }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.chartData = res.data
|
||||
} else {
|
||||
this.chartData = []
|
||||
}
|
||||
})
|
||||
},
|
||||
switchChart() {
|
||||
if (this.activeName === 'bar') {
|
||||
this.$nextTick((res) => {
|
||||
this.$refs.analysisBarChart.getChart()
|
||||
})
|
||||
} else {
|
||||
this.$nextTick((res) => {
|
||||
this.$refs.analysisLineChart.getChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'TrendAnalysis',
|
||||
components: { SearchArea, LineChart },
|
||||
data() {
|
||||
return {
|
||||
isFold: false,
|
||||
chartData: [],
|
||||
timeDim: '',
|
||||
tableProps: [],
|
||||
list: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260);
|
||||
this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
|
||||
});
|
||||
this.isFold = this.searchBarWidth('trendAnalysisBox', 1480);
|
||||
},
|
||||
methods: {
|
||||
getList(params) {
|
||||
this.timeDim = params.timeDim;
|
||||
getEnergyTrend({ ...params }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.getTableList(res.data || []);
|
||||
this.chartData = res.data || [];
|
||||
} else {
|
||||
this.chartData = [];
|
||||
}
|
||||
});
|
||||
},
|
||||
getTableList(arr) {
|
||||
this.tableProps = [];
|
||||
this.list = [];
|
||||
let tempX = [];
|
||||
let listObj = { useNum: '消耗量' }; // 数据
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let obj = {};
|
||||
obj.prop = arr[i].time;
|
||||
obj.label = arr[i].time;
|
||||
obj.minWidth = 100;
|
||||
tempX.push(obj);
|
||||
listObj[arr[i].time] = arr[i].useNum || null;
|
||||
}
|
||||
this.tableProps = [{ prop: 'useNum', label: '时间' }].concat(tempX);
|
||||
this.list.push(listObj);
|
||||
},
|
||||
// 导出excel
|
||||
exportExl(params) {
|
||||
exportTrend({ ...params }).then((res) => {
|
||||
// let fileName = '';
|
||||
// const contentDisposition = res.headers['content-disposition'];
|
||||
// if (contentDisposition) {
|
||||
// fileName = decodeURIComponent(
|
||||
// contentDisposition.slice(
|
||||
// contentDisposition.indexOf('filename=') + 9
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
const blob = new Blob([res.data]);
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(blob);
|
||||
reader.onload = (e) => {
|
||||
const a = document.createElement('a');
|
||||
a.download = '走势分析';
|
||||
a.href = e.target.result;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
this.$message.success('导出成功');
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
.trendAnalysisBox {
|
||||
.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);
|
||||
}
|
||||
.trend-out-table {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,205 +1,227 @@
|
||||
<template>
|
||||
<el-form :inline="true" class="demo-form-inline">
|
||||
<span class="blue-block"></span>
|
||||
<el-form-item label="对象选择" required>
|
||||
<el-cascader
|
||||
v-model="objArr"
|
||||
:options="objList"
|
||||
:props="{ checkStrictly: true, value: 'id', label: 'name' }"
|
||||
popper-class="cascaderParent"
|
||||
size="small"
|
||||
clearable></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间维度" required>
|
||||
<el-select v-model="queryParams.type" placeholder="请选择" style="width: 80px;" size="small">
|
||||
<el-option
|
||||
v-for="item in timeType"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:clearable="false">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间" required>
|
||||
<div v-show="queryParams.type === 1 || queryParams.type === 2">
|
||||
<el-date-picker
|
||||
v-model="yearValue"
|
||||
type="year"
|
||||
:picker-options="pickerOptions"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择年">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div v-show="queryParams.type === 3">
|
||||
<el-date-picker
|
||||
v-model="yearMonth"
|
||||
type="month"
|
||||
:picker-options="pickerOptions"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择月">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" @click="search">查询</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<span class="separateStyle"></span>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" @click="exportData" plain>导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline">
|
||||
<span class="blue-block"></span>
|
||||
<el-form-item
|
||||
label="对象选择"
|
||||
required>
|
||||
<el-select
|
||||
v-model="queryParams.objId"
|
||||
placeholder="请选择"
|
||||
style="width: 250px"
|
||||
filterable
|
||||
size="small">
|
||||
<el-option
|
||||
v-for="item in objList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:clearable="false"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="时间维度"
|
||||
required>
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
placeholder="请选择"
|
||||
style="width: 80px"
|
||||
size="small">
|
||||
<el-option
|
||||
v-for="item in timeType"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:clearable="false"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="时间"
|
||||
required>
|
||||
<div v-show="queryParams.type === 1 || queryParams.type === 2">
|
||||
<el-date-picker
|
||||
v-model="yearValue"
|
||||
type="year"
|
||||
:picker-options="pickerOptions"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择年"></el-date-picker>
|
||||
</div>
|
||||
<div v-show="queryParams.type === 3">
|
||||
<el-date-picker
|
||||
v-model="yearMonth"
|
||||
type="month"
|
||||
:picker-options="pickerOptions"
|
||||
@change="selectTime"
|
||||
:clearable="false"
|
||||
size="small"
|
||||
placeholder="选择月"></el-date-picker>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="search">
|
||||
查询
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<span class="separateStyle"></span>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="exportData"
|
||||
plain>
|
||||
导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import { getTree } from '@/api/base/factory'
|
||||
import moment from 'moment'
|
||||
import { getTree } from '@/api/analysis/energyAnalysis';
|
||||
import moment from 'moment';
|
||||
export default {
|
||||
name: 'searchArea',
|
||||
data() {
|
||||
return {
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
type: 1, // 1季度2月3日
|
||||
searchTime: null,
|
||||
objId: null
|
||||
},
|
||||
timeType: [
|
||||
{id: 1, name: '季度'},
|
||||
{id: 2, name: '月'},
|
||||
{id: 3, name: '日'}
|
||||
],
|
||||
yearValue: '',
|
||||
yearMonth: '',
|
||||
objArr: [],
|
||||
objList: [],
|
||||
pickerOptions: {
|
||||
disabledDate(date) {
|
||||
return date.getTime() > Date.now()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getObjTree()
|
||||
},
|
||||
methods: {
|
||||
getObjTree() {
|
||||
getTree().then(res => {
|
||||
this.objList = res.data || []
|
||||
})
|
||||
},
|
||||
selectTime() {
|
||||
if (this.queryParams.type === 3) {
|
||||
this.queryParams.searchTime = this.yearMonth
|
||||
} else {
|
||||
this.queryParams.searchTime = this.yearValue
|
||||
}
|
||||
},
|
||||
// 查询
|
||||
search() {
|
||||
if (this.objArr.length === 0) {
|
||||
this.$modal.msgError('请选择对象')
|
||||
return false
|
||||
} else {
|
||||
this.queryParams.objId = this.objArr[this.objArr.length-1]
|
||||
}
|
||||
if (!this.queryParams.type) {
|
||||
this.$modal.msgError('请选择时间维度')
|
||||
return false
|
||||
}
|
||||
if (!this.queryParams.searchTime) {
|
||||
this.$modal.msgError('请选择时间')
|
||||
return false
|
||||
}
|
||||
if (this.queryParams.type === 3) {
|
||||
this.queryParams.searchTime = this.transformTime(this.yearMonth) + ''
|
||||
} else {
|
||||
this.queryParams.searchTime = this.transformYear(this.yearValue) + ''
|
||||
}
|
||||
this.$emit('submit', this.queryParams)
|
||||
},
|
||||
exportData() {
|
||||
let name
|
||||
if (this.queryParams.objId) {
|
||||
name = this.getObjName(this.objList, this.queryParams.objId)
|
||||
} else {
|
||||
this.$modal.msgWarning("对象不能为空")
|
||||
return false
|
||||
}
|
||||
this.$emit('exportD', {name: name})
|
||||
},
|
||||
// 递归取对象name
|
||||
getObjName(list, id) {
|
||||
let _this = this
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let a = list[i]
|
||||
if (a.id === id) {
|
||||
return a.name
|
||||
} else {
|
||||
if (a.children && a.children.length > 0) {
|
||||
let res = _this.getObjName(a.children, id)
|
||||
if (res) {
|
||||
return res
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
transformTime(timeStamp) {// 本月最后一天
|
||||
let year = moment(timeStamp).format('YYYY')
|
||||
let month = moment(timeStamp).format('MM')
|
||||
let newData = moment(new Date(year,month,0)).format('YYYY-MM-DD') + ' 23:59:59'
|
||||
let value = new Date(newData).getTime()
|
||||
return value
|
||||
},
|
||||
transformYear(timeStamp) {// 本年最后一天
|
||||
let year = moment(timeStamp).format('YYYY')
|
||||
let newData = year+'-12-31 23:59:59'
|
||||
let value = new Date(newData).getTime()
|
||||
return value
|
||||
}
|
||||
}
|
||||
}
|
||||
name: 'searchArea',
|
||||
data() {
|
||||
return {
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
type: 1, // 1季度2月3日
|
||||
searchTime: null,
|
||||
objId: null,
|
||||
objType: 1,
|
||||
},
|
||||
timeType: [
|
||||
{ id: 1, name: '季度' },
|
||||
{ id: 2, name: '月' },
|
||||
{ id: 3, name: '日' },
|
||||
],
|
||||
yearValue: '',
|
||||
yearMonth: '',
|
||||
objList: [],
|
||||
pickerOptions: {
|
||||
disabledDate(date) {
|
||||
return date.getTime() > Date.now();
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getObjTree();
|
||||
},
|
||||
methods: {
|
||||
getObjTree() {
|
||||
getTree().then((res) => {
|
||||
this.objList = res.data || [];
|
||||
if (this.objList.length > 0) {
|
||||
this.queryParams.objId = this.objList[0].id;
|
||||
}
|
||||
});
|
||||
},
|
||||
selectTime() {
|
||||
if (this.queryParams.type === 3) {
|
||||
this.queryParams.searchTime = this.yearMonth;
|
||||
} else {
|
||||
this.queryParams.searchTime = this.yearValue;
|
||||
}
|
||||
},
|
||||
// 查询
|
||||
search() {
|
||||
if (!this.queryParams.objId) {
|
||||
this.$modal.msgError('请选择对象');
|
||||
return false;
|
||||
}
|
||||
if (!this.queryParams.type) {
|
||||
this.$modal.msgError('请选择时间维度');
|
||||
return false;
|
||||
}
|
||||
if (!this.queryParams.searchTime) {
|
||||
this.$modal.msgError('请选择时间');
|
||||
return false;
|
||||
}
|
||||
if (this.queryParams.type === 3) {
|
||||
this.queryParams.searchTime = this.transformTime(this.yearMonth) + '';
|
||||
} else {
|
||||
this.queryParams.searchTime = this.transformYear(this.yearValue) + '';
|
||||
}
|
||||
this.$emit('submit', this.queryParams);
|
||||
},
|
||||
exportData() {
|
||||
let name;
|
||||
if (this.queryParams.objId) {
|
||||
name = this.getObjName(this.objList, this.queryParams.objId);
|
||||
} else {
|
||||
this.$modal.msgWarning('对象不能为空');
|
||||
return false;
|
||||
}
|
||||
this.$emit('exportD', { name: name });
|
||||
},
|
||||
// 递归取对象name
|
||||
getObjName(list, id) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let a = list[i];
|
||||
if (a.id === id) {
|
||||
return a.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
transformTime(timeStamp) {
|
||||
// 本月最后一天
|
||||
let year = moment(timeStamp).format('YYYY');
|
||||
let month = moment(timeStamp).format('MM');
|
||||
let newData =
|
||||
moment(new Date(year, month, 0)).format('YYYY-MM-DD') + ' 23:59:59';
|
||||
let value = new Date(newData).getTime();
|
||||
return value;
|
||||
},
|
||||
transformYear(timeStamp) {
|
||||
// 本年最后一天
|
||||
let year = moment(timeStamp).format('YYYY');
|
||||
let newData = year + '-12-31 23:59:59';
|
||||
let value = new Date(newData).getTime();
|
||||
return value;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
/* 级联选择器 */
|
||||
.cascaderParent .el-cascader-panel .el-scrollbar:first-child .el-radio {
|
||||
display: none;
|
||||
}
|
||||
.demo-form-inline {
|
||||
.el-date-editor .el-range__icon {
|
||||
font-size: 16px;
|
||||
color: #0B58FF;
|
||||
}
|
||||
.el-input__prefix .el-icon-date {
|
||||
font-size: 16px;
|
||||
color: #0B58FF;
|
||||
}
|
||||
.el-date-editor .el-range__icon {
|
||||
font-size: 16px;
|
||||
color: #0b58ff;
|
||||
}
|
||||
.el-input__prefix .el-icon-date {
|
||||
font-size: 16px;
|
||||
color: #0b58ff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.demo-form-inline {
|
||||
.blue-block {
|
||||
display: inline-block;
|
||||
width: 4px;
|
||||
height: 16px;
|
||||
background-color: #0B58FF;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.blue-block {
|
||||
display: inline-block;
|
||||
width: 4px;
|
||||
height: 16px;
|
||||
background-color: #0b58ff;
|
||||
border-radius: 1px;
|
||||
margin-right: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.el-form-item {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
}
|
||||
.separateStyle {
|
||||
display: inline-block;
|
||||
width: 1px;
|
||||
height: 24px;
|
||||
background: #E8E8E8;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
width: 1px;
|
||||
height: 24px;
|
||||
background: #e8e8e8;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user