diff --git a/src/utils/request.js b/src/utils/request.js index a94a448..dd715cb 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -18,7 +18,7 @@ const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 baseURL: process.env.VUE_APP_BASE_API, // 超时 - timeout: 10000 + timeout: 60000 }) // request拦截器 diff --git a/src/views/ems/record/recordDnbInstant/index.vue b/src/views/ems/record/recordDnbInstant/index.vue index ccea72b..6bf0e41 100644 --- a/src/views/ems/record/recordDnbInstant/index.vue +++ b/src/views/ems/record/recordDnbInstant/index.vue @@ -142,8 +142,8 @@ - - + + diff --git a/src/views/ems/report/energyPreview/index.vue b/src/views/ems/report/energyPreview/index.vue index db11599..d3cb576 100644 --- a/src/views/ems/report/energyPreview/index.vue +++ b/src/views/ems/report/energyPreview/index.vue @@ -103,12 +103,24 @@ >导出 + + 展开/折叠 + + + @@ -178,6 +196,10 @@ export default { multiple: true, // 显示搜索条件 showSearch: true, + // 重新渲染表格状态 + refreshTable: true, + // 是否展开,默认全部展开 + isExpandAll: false, // 表格数据 dataList: null, // 时间List @@ -437,60 +459,71 @@ export default { myChart.setOption(option) energyPreviewReportList(this.queryParams).then((response) => { - this.dataList = this.handleTree(response.data,'objId') - this.loading = false + this.dataList = this.handleTree(response.data, 'objId'); + this.loading = false const data = response.data || [] if (data.length === 0) return this.totalConsumption = data.reduce((sum, item) => { return sum + parseFloat(item.expendSum || 0); }, 0); + if (parseFloat(data[0].expendSum) > 0){ + const keys = Object.keys(data[0]) + const filteredKeys = keys.filter(item => item.includes('dateData|')); - const keys = Object.keys(data[0]) - const filteredKeys = keys.filter(key => key && !['unitName', 'state', 'expendSum', 'type'].includes(key)) + const yData = filteredKeys.map(key => { + return data.reduce((sum, item) => sum + parseFloat(item[key] || 0), 0).toFixed(2) + }) - const yData = filteredKeys.map(key => { - return data.reduce((sum, item) => sum + parseFloat(item[key] || 0), 0).toFixed(2) - }) + const timeData = filteredKeys.map(key => key.split('dateData|')[1] + ':00:00') - const timeData = filteredKeys.map(key => key.split('expend')[1] + ':00:00') - const sortedData = timeData.map((time, index) => ({ - name: time, - value: parseFloat(yData[index]), - time: new Date(time).getTime() - })).sort((a, b) => a.time - b.time) + const sortedData = timeData.map((time, index) => ({ + name: time, + value: parseFloat(yData[index]), + time: new Date(time).getTime() + })).sort((a, b) => b.time - a.time); - const xAxisData = sortedData.map(item => item.name.split(':')[0]) - const seriesData = sortedData.map(item => item.value) + console.log(sortedData) - myChart.setOption({ - dataZoom: [{ - show: true, - type: 'slider', - bottom: '3%', - xAxisIndex: 0, - height: 12, - start: 0, - brushSelect: false, - end: (1 / (seriesData.length / 20)) * 100, - textStyle: { - fontSize: 0, - color: 'rgba(0,0,0,0)' - } - }], - xAxis: [{ - data: xAxisData - }], - series: [{ - data: seriesData - }, { - data: seriesData - }] - }) + const xAxisData = sortedData.map(item => item.name.split(':')[0]) + const seriesData = sortedData.map(item => item.value) + myChart.setOption({ + dataZoom: [{ + show: true, + type: 'slider', + bottom: '3%', + xAxisIndex: 0, + height: 12, + start: 0, + brushSelect: false, + end: (1 / (seriesData.length / 20)) * 100, + textStyle: { + fontSize: 0, + color: 'rgba(0,0,0,0)' + } + }], + xAxis: [{ + data: xAxisData + }], + series: [{ + data: seriesData + }, { + data: seriesData + }] + }) + } }) }, + /** 展开/折叠操作 */ + toggleExpandAll() { + this.refreshTable = false + this.isExpandAll = !this.isExpandAll + this.$nextTick(() => { + this.refreshTable = true + }) + }, /** 查询用户列表 */ getList(dateList) { this.loading = true @@ -512,20 +545,21 @@ export default { title: '耗量合计(' + this.measurementUnit + ')', align: 'center', rowspan: 2 + }, + { + field: 'powerExpendSum', + title: '发电量合计(' + this.measurementUnit + ')', + align: 'center', + rowspan: 2 } ) for (let i in columns) { this.timeList.push({ title: columns[i], align: 'center', - colspan: 1, - field: 'expend' + columns[i].substring(0, 13) - }) - this.energyList.push({ + colspan: 2, field: 'expend' + columns[i].substring(0, 13), - title: '耗量(' + this.measurementUnit + ')', - align: 'center', - rowspan: 1 + powerField: 'powerExpend' + columns[i].substring(0, 13), }) } }, diff --git a/src/views/ems/report/reportPointDnb/index.vue b/src/views/ems/report/reportPointDnb/index.vue index 30d3776..fec79a5 100644 --- a/src/views/ems/report/reportPointDnb/index.vue +++ b/src/views/ems/report/reportPointDnb/index.vue @@ -121,6 +121,9 @@ + + + -