Merge branch 'master' of https://e.coding.net/ctcdevteam/ehs/ehs_web
This commit is contained in:
commit
55f99058cf
|
@ -1026,12 +1026,12 @@ const routes = [
|
||||||
component: "enm_energy/hour_base",
|
component: "enm_energy/hour_base",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "hourBase",
|
name: "hourBaseTotal",
|
||||||
path: "/enm_energy/electric_total",
|
path: "/enm_energy/electric_total",
|
||||||
meta: {
|
meta: {
|
||||||
title: "电量报表",
|
title: "电量报表",
|
||||||
// icon: "el-icon-grid",
|
// icon: "el-icon-grid",
|
||||||
perms: ["hour_base"],
|
perms: ["hour_base_elec"],
|
||||||
},
|
},
|
||||||
component: "enm_energy/electric_total",
|
component: "enm_energy/electric_total",
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,19 @@
|
||||||
<div class="app-container" id="app-container" style="height: 100%">
|
<div class="app-container" id="app-container" style="height: 100%">
|
||||||
<el-header id="app-header">
|
<el-header id="app-header">
|
||||||
<div class="left-panel">
|
<div class="left-panel">
|
||||||
|
<el-select
|
||||||
|
v-model="query.type"
|
||||||
|
placeholder="查询类型"
|
||||||
|
clearable
|
||||||
|
class="headerSearch"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="query.day"
|
v-model="query.day"
|
||||||
type="date"
|
type="date"
|
||||||
|
@ -10,7 +23,21 @@
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD"
|
||||||
placeholder="日"
|
placeholder="日"
|
||||||
style="margin-right: 6px"
|
style="margin-right: 6px"
|
||||||
@change="dateChange"
|
v-if = "query.type == 0"
|
||||||
|
@change="dateChange"
|
||||||
|
/>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="daterange"
|
||||||
|
type="datetimerange"
|
||||||
|
:shortcuts="shortcuts"
|
||||||
|
range-separator="To"
|
||||||
|
start-placeholder="Start date"
|
||||||
|
end-placeholder="End date"
|
||||||
|
placeholder="时间范围"
|
||||||
|
value-format="YYYY-MM-DD hh:mm:ss"
|
||||||
|
v-if="query.type==1"
|
||||||
|
style="margin-right: 6px"
|
||||||
|
@change="changeDate"
|
||||||
/>
|
/>
|
||||||
<!-- <el-button
|
<!-- <el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
@ -33,6 +60,7 @@
|
||||||
<div ref="print" id="myReport" class="printContainer">
|
<div ref="print" id="myReport" class="printContainer">
|
||||||
<el-table
|
<el-table
|
||||||
id="hourBaseTable"
|
id="hourBaseTable"
|
||||||
|
v-if="query.type==0"
|
||||||
:data="tableDatas2"
|
:data="tableDatas2"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
border
|
border
|
||||||
|
@ -58,6 +86,34 @@
|
||||||
<el-table-column label="年累计" prop="year" align="center" fixed>
|
<el-table-column label="年累计" prop="year" align="center" fixed>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<el-table
|
||||||
|
v-if="query.type==1"
|
||||||
|
id="hourBaseTable"
|
||||||
|
:data="tableDatas_range"
|
||||||
|
style="width: 100%"
|
||||||
|
border
|
||||||
|
:height="tableHeight"
|
||||||
|
@cell-click="handleCellClick_range"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
label="设备名称"
|
||||||
|
prop="mpoint__name"
|
||||||
|
fixed
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="对应点位"
|
||||||
|
prop="mpoint__code"
|
||||||
|
fixed
|
||||||
|
align="center"
|
||||||
|
></el-table-column><el-table-column
|
||||||
|
label="统计值(kwh)"
|
||||||
|
prop="total_val"
|
||||||
|
fixed
|
||||||
|
align="center"
|
||||||
|
></el-table-column>
|
||||||
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -98,7 +154,13 @@ export default {
|
||||||
indexList: [],
|
indexList: [],
|
||||||
mpointList: [],
|
mpointList: [],
|
||||||
tableDatas: [],
|
tableDatas: [],
|
||||||
|
daterange: [],
|
||||||
tableDatas2: [],
|
tableDatas2: [],
|
||||||
|
tableDatas_range:[],
|
||||||
|
options: [
|
||||||
|
{id:0,name:'日统计'},
|
||||||
|
{id:1,name:'时间范围'},
|
||||||
|
],
|
||||||
tableHeight: 600,
|
tableHeight: 600,
|
||||||
itemChartTitle: "",
|
itemChartTitle: "",
|
||||||
itemChartData: [],
|
itemChartData: [],
|
||||||
|
@ -198,6 +260,8 @@ export default {
|
||||||
xAxisData: [],
|
xAxisData: [],
|
||||||
xAxisData_day: [],
|
xAxisData_day: [],
|
||||||
xAxisData_month: [],
|
xAxisData_month: [],
|
||||||
|
mpointIdList: [],
|
||||||
|
result: ""
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -210,6 +274,7 @@ export default {
|
||||||
that.headerLength = that.days + 4;
|
that.headerLength = that.days + 4;
|
||||||
that.tableWidth = that.headerLength * 100 + "";
|
that.tableWidth = that.headerLength * 100 + "";
|
||||||
this.getMPoints();
|
this.getMPoints();
|
||||||
|
|
||||||
let heightContainer =
|
let heightContainer =
|
||||||
document.getElementById("app-container").clientHeight;
|
document.getElementById("app-container").clientHeight;
|
||||||
let heightHeader = document.getElementById("app-header").clientHeight;
|
let heightHeader = document.getElementById("app-header").clientHeight;
|
||||||
|
@ -217,28 +282,13 @@ export default {
|
||||||
that.tableHeight = heightTable;
|
that.tableHeight = heightTable;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
|
||||||
// let that = this;
|
|
||||||
// if (columnIndex == 0) {
|
|
||||||
// if (that.indexList.indexOf(rowIndex) > -1) {
|
|
||||||
// let rowspans = that.mgroupObj[row.mgroupName];
|
|
||||||
// return {
|
|
||||||
// rowspan: rowspans,
|
|
||||||
// colspan: 1,
|
|
||||||
// };
|
|
||||||
// } else {
|
|
||||||
// return {
|
|
||||||
// rowspan: 1,
|
|
||||||
// colspan: 0,
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
dateChange(e) {
|
dateChange(e) {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.tableDatas = [];
|
that.tableDatas = [];
|
||||||
let arr = [];
|
let arr = [];
|
||||||
if(e){//日
|
let obj = {};
|
||||||
|
|
||||||
|
if (that.queryset.type == 0) {
|
||||||
arr = e.split('-');
|
arr = e.split('-');
|
||||||
that.year = Number(arr[0]);
|
that.year = Number(arr[0]);
|
||||||
that.month = Number(arr[1]);
|
that.month = Number(arr[1]);
|
||||||
|
@ -248,6 +298,27 @@ export default {
|
||||||
let nowDate = new Date();
|
let nowDate = new Date();
|
||||||
that.timeStamp = nowDate.getTime();
|
that.timeStamp = nowDate.getTime();
|
||||||
},
|
},
|
||||||
|
formatArry(){
|
||||||
|
this.result = this.mpointIdList.join(","); // 将数组转换为字符串
|
||||||
|
},
|
||||||
|
changeDate(){
|
||||||
|
let that = this;
|
||||||
|
let obj = {};
|
||||||
|
obj.type = "hour";
|
||||||
|
obj.start_time = this.daterange[0];
|
||||||
|
obj.end_time = this.daterange[1];
|
||||||
|
this.formatArry();
|
||||||
|
obj.mpoint__in = that.result;
|
||||||
|
obj.group_by = "mpoint__code";
|
||||||
|
obj.page = 0;
|
||||||
|
this.$API.enm.mpointstat.groupValues.req(obj).then((res) => {
|
||||||
|
//处理res数组中的 total_val 字段 保留两位
|
||||||
|
res.forEach(item => {
|
||||||
|
item.total_val = Number(item.total_val).toFixed(2);
|
||||||
|
});
|
||||||
|
this.tableDatas_range = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
getMPoints() {
|
getMPoints() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$API.enm.mpoint.list
|
that.$API.enm.mpoint.list
|
||||||
|
@ -261,6 +332,8 @@ export default {
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
that.mpointList = res.filter((item) => {
|
that.mpointList = res.filter((item) => {
|
||||||
|
// 提取mpointIdList
|
||||||
|
that.mpointIdList.push(item.id);
|
||||||
return item.report_sortstr !== "";
|
return item.report_sortstr !== "";
|
||||||
});
|
});
|
||||||
that.dataLoop();
|
that.dataLoop();
|
||||||
|
@ -271,7 +344,6 @@ export default {
|
||||||
that.tableDatas2 = [];
|
that.tableDatas2 = [];
|
||||||
that.mpointList.forEach((item, index) => {
|
that.mpointList.forEach((item, index) => {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
console.log('item', item.name)
|
|
||||||
obj.name = item.name;
|
obj.name = item.name;
|
||||||
obj.code =
|
obj.code =
|
||||||
item.code != null && item.code != ""
|
item.code != null && item.code != ""
|
||||||
|
@ -318,7 +390,6 @@ export default {
|
||||||
that.tableDatas2[index]['year'] = item.val;
|
that.tableDatas2[index]['year'] = item.val;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.log('that.tableDatas2', that.tableDatas2)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// handleCellClick(row, column, cell, event) {
|
// handleCellClick(row, column, cell, event) {
|
||||||
|
|
Loading…
Reference in New Issue