Browse Source

一次性电表日统计表

master
songguoqiang 9 months ago
parent
commit
f411393e23
  1. 5
      src/api/tjanalysis/index.ts
  2. 36
      src/views/tjanalysis/electricdatatotal/index.vue
  3. 170
      src/views/tjanalysis/irealdatatotal/index.vue

5
src/api/tjanalysis/index.ts

@ -5,6 +5,11 @@ export const queryIrealdataTj = async (params) => {
return await request.get({ url: `/tjanalysis/queryIrealdataTj`, params })
}
// 获取一次主表时间范围统计报表数据
export const queryIrealdataTimeTj = async (params) => {
return await request.get({ url: `/tjanalysis/queryIrealdataTimeTj`, params })
}
// 获取智能电表日统计报表数据
export const queryElectricdataTj = async (params) => {
return await request.get({ url: `/tjanalysis/queryElectricdataTj`, params })

36
src/views/tjanalysis/electricdatatotal/index.vue

@ -62,7 +62,23 @@ const handleQuery = async () => {
}
const resetQuery = async () => {
queryParams.dateRange = []
//
let today = new Date();
//
today.setDate(today.getDate() - 1);
// "yyyy-MM-dd"
let year = today.getFullYear();
let month = String(today.getMonth() + 1).padStart(2, '0'); // 0+1
let date = String(today.getDate()).padStart(2, '0'); //
let yesterdayAsString = `${year}-${month}-${date}`;
console.log(yesterdayAsString);
queryParams.dateRange=[yesterdayAsString,yesterdayAsString]
getList()
}
@ -119,7 +135,25 @@ function getSummaries(param) {
/** 初始化 **/
onMounted(async () => {
//
let today = new Date();
//
today.setDate(today.getDate() - 1);
// "yyyy-MM-dd"
let year = today.getFullYear();
let month = String(today.getMonth() + 1).padStart(2, '0'); // 0+1
let date = String(today.getDate()).padStart(2, '0'); //
let yesterdayAsString = `${year}-${month}-${date}`;
console.log(yesterdayAsString);
queryParams.dateRange=[yesterdayAsString,yesterdayAsString]
getList()
})
</script>

170
src/views/tjanalysis/irealdatatotal/index.vue

@ -0,0 +1,170 @@
<template>
<ContentWrap>
<!-- 智能电表统计表搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="日期" prop="dateRange">
<el-date-picker
v-model="queryParams.dateRange"
style="width: 240px; height: 30px"
value-format="YYYY-MM-DD"
end-placeholder="结束日期"
start-placeholder="开始日期"
type="daterange"
/>
</el-form-item>
<el-form-item label="仪表的描述总用电表" prop="mcode">
<el-select v-model="queryParams.flag" placeholder="请选择">
<el-option
v-for="item in typeList"
:key="item.flag"
:label="item.mname"
:value="item.flag" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" size="mini" @click="handleQuery">搜索</el-button>
<el-button size="mini" @click="resetQuery">重置</el-button>
<!-- <el-button type="success" @click="exportElecTotal" size="mini">导出</el-button> -->
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading="loading" :data="dataList.dList" border="true" >
highlight-current-row="无功" prop="wugong" align="center" :show-overflow-tooltip="true" />
<el-table-column label="无功" prop="wugong" align="center" :show-overflow-tooltip="true" />
<el-table-column label="总" prop="idescTotal" align="center" :show-overflow-tooltip="true" />
<el-table-column label="峰" prop="idescF" align="center" :show-overflow-tooltip="true" />
<el-table-column label="谷" prop="idescG" align="center" :show-overflow-tooltip="true" />
<el-table-column label="平" prop="idescP" align="center" :show-overflow-tooltip="true" />
<el-table-column label="尖峰" prop="idescPt" align="center" :show-overflow-tooltip="true" />
<el-table-column label="功率因数" prop="gy" align="center" :show-overflow-tooltip="true" />
</el-table>
</ContentWrap>
</template>
<script setup lang="ts">
import * as TjanalysisApi from '@/api/tjanalysis'
import { formatDate } from '@/utils/formatTime'
defineOptions({ name: 'PlatscaleAnalysis' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const loading = ref(true)
const dataList = reactive({dList: [] , total: 0})
const queryParams = reactive({
dateRange: [],
flag:'0'
})
const typeList= ref([{"flag":"0","mname":"主变1号"},{"flag":"1","mname":"主变2号"}]);
const handleQuery = async () => {
getList()
}
const resetQuery = async () => {
//
let today = new Date();
//
today.setDate(today.getDate() - 1);
// "yyyy-MM-dd"
let year = today.getFullYear();
let month = String(today.getMonth() + 1).padStart(2, '0'); // 0+1
let date = String(today.getDate()).padStart(2, '0'); //
let yesterdayAsString = `${year}-${month}-${date}`;
console.log(yesterdayAsString);
queryParams.dateRange=[yesterdayAsString,yesterdayAsString]
getList()
}
const getList = async () => {
const res = await TjanalysisApi.queryIrealdataTimeTj(queryParams)
console.log(res)
if (res != null && res.dataList != null) {
dataList.dList = res.dataList
}
loading.value = false
}
const exportElecTotal = async () => {
const res = await TjanalysisApi.queryIrealdataTimeTj(queryParams)
if (res != null) {
let url = window.URL.createObjectURL(new Blob([res]));
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", "一次主表统计表.xlsx");
document.body.appendChild(link);
link.click();
}
}
function getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
// console.log(column)
if (index === 0) {
sums[index] = '总';
// return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
// sums[index] += ' ';
} else {
// sums[index] = 'N/A';
}
});
return sums;
}
/** 初始化 **/
onMounted(async () => {
//
let today = new Date();
//
today.setDate(today.getDate() - 1);
// "yyyy-MM-dd"
let year = today.getFullYear();
let month = String(today.getMonth() + 1).padStart(2, '0'); // 0+1
let date = String(today.getDate()).padStart(2, '0'); //
let yesterdayAsString = `${year}-${month}-${date}`;
console.log(yesterdayAsString);
queryParams.dateRange=[yesterdayAsString,yesterdayAsString]
getList()
})
</script>
Loading…
Cancel
Save