This commit is contained in:
shijing 2024-12-06 15:34:06 +08:00
commit 856cd3dad1
4 changed files with 112 additions and 33 deletions

View File

@ -143,14 +143,6 @@ export default {
data);
}
},
groupValues: {
name: "测点统计记录",
req: async function(data){
return await http.get(
`${config.API_URL}/enm/mpointstat/group_values/`,
data);
}
},
statCreate: {
name: "添加测点统计记录",
req: async function(data){
@ -184,6 +176,14 @@ export default {
data);
}
},
groupValues: {
name: "测点统计记录",
req: async function(data){
return await http.get(
`${config.API_URL}/enm/mpointstat/group_values/`,
data);
}
},
create: {
name: "新增",
req: async function(data){

View File

@ -58,24 +58,6 @@
</div>
</el-header>
<el-card style="margin-top:5px">
<!-- <div ref="print" id="myReport" class="printContainer">
<h3 style="text-align: center;">{{ tableName }}</h3>
<el-table
:data="tableData"
style="width: 100%"
border
:height="tableHeight"
:span-method="objectSpanMethod">
<el-table-column
v-for="item in tableData[0]"
:key="item"
:prop="item"
:label="item"
width="100">
</el-table-column>
</el-table>
</div> -->
<div>
<table id="myTable" class="myTable" border="1" cellspacing="0" style="width: 100%; text-align: center;">
<thead class="myTableHead">
@ -86,7 +68,14 @@
</thead>
<tbody>
<tr v-for="(row, rowIndex) in tableData" :key="rowIndex">
<td v-for="(cell, cellIndex) in row" :key="cellIndex"
<td
v-if="rowIndex === 0 || rowIndex === 2 || rowIndex === 4"
:rowspan="rowIndex === 0 || rowIndex === 2 ? 2 : 1"
>
{{ row[0] }}
</td>
<td>{{ row[1] }}</td>
<td v-for="(cell, cellIndex) in row.slice(2)" :key="cellIndex"
>{{ cell }}</td>
</tr>
</tbody>
@ -180,7 +169,7 @@
obj.type = 'hour';
obj.group_by = 'val_level';
obj.mpoint__in = that.mpointList[0];
this.$API.enm.mpoint.groupValues.req(obj)
this.$API.enm.mpointstat.groupValues.req(obj)
.then((res) => {
res.forEach(item => {
//

View File

@ -424,7 +424,7 @@ export default {
obj.end_time = this.daterange[1];
obj.mpoint__in = "3631858394648182784,3631858982832218112,3631858687335112704";
obj.page = 0;
this.$API.enm.mpoint.groupValues.req(obj).then((res) => {
this.$API.enm.mpointstat.groupValues.req(obj).then((res) => {
//res total_val
res.forEach(item => {
item.total_val = Number(item.total_val).toFixed(2);

View File

@ -1,12 +1,102 @@
<template>
<el-container>
<el-main class="nopadding">
<el-card title="">
<el-main class="nopadding" style="padding: 10px">
<el-row>
<xtSelect
:apiObj="apiObjM"
:params="paramsM"
style="width: 600px"
v-model = "query.mpoint"
placeholder="选择测点"
>
<el-table-column label="测点名" prop="name"></el-table-column>
<el-table-column label="别名" prop="nickname"></el-table-column>
<el-table-column label="计量物料" prop="material_name"></el-table-column>
</xtSelect>
</el-row>
<div style="height: 6px;"></div>
<el-row style="width: 600px;">
<el-date-picker v-model="timeRange" type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss" range-separator="至"
start-placeholder="开始时间" end-placeholder="结束时间"
format="YYYY-MM-DD HH"
popper-class="tpc"/>
</el-row>
<div style="height: 6px;"></div>
<el-row>
<el-button type="primary" @click="start" v-loading="bLoading">开始计算</el-button>
</el-row>
<div style="height: 6px;"></div>
<el-row style="width: 600px;">
<el-table
id="hourBaseTable"
:data="tableData"
border
>
<el-table-column label="指标聚合" align="center">
<el-table-column label="指标名称" prop="mpoint__name" min-width="80">
</el-table-column>
<el-table-column label="指标别名" prop="mpoint__nickname" min-width="100">
</el-table-column>
<el-table-column label="计算值" prop="total_val" min-width="100">
</el-table-column>
</el-table-column>
</el-table>
</el-row>
</el-card>
</el-main>
</el-container>
</template>
<script>
</script>
export default {
name: 'enstat',
data() {
return {
apiObjM: this.$API.enm.mpoint.list,
paramsM: {page: 0},
timeRange: [],
tableData: [],
bLoading: false,
query:{
mpoint: null,
start_time: null,
end_time: null
}
}
},
methods: {
start() {
let that = this;
this.query.type = "hour";
this.tableData = [];
if (this.query.mpoint == null) {
this.$message.error('请选择测点');
return;
}
if (this.timeRange.length == 0) {
this.$message.error('请选择时间范围');
return;
}
this.query.start_time = this.timeRange[0]
this.query.end_time = this.timeRange[1]
this.bLoading = true;
this.$API.enm.mpointstat.groupValues.req(this.query).then((res)=>{
this.bLoading = false;
this.tableData = res;
}).catch(e=>{
this.bLoading = false;
})
}
}
}
</script>
<style>
.tpc .el-time-spinner__wrapper {
width:100% !important;
}
.tpc .el-scrollbar:nth-of-type(2) {
display: none !important;
}
</style>