4 changed files with 768 additions and 29 deletions
@ -0,0 +1,19 @@ |
|||||||
|
import request from "@/utils/request"; |
||||||
|
|
||||||
|
export const meterReadingsList = (data) => { |
||||||
|
return request({ |
||||||
|
url: "/reportMeterReadings/list", |
||||||
|
method: "post", |
||||||
|
data: data, |
||||||
|
}); |
||||||
|
}; |
||||||
|
|
||||||
|
// 导出
|
||||||
|
export const meterReadingsExport = (data) => { |
||||||
|
return request({ |
||||||
|
url: "/reportMeterReadings/export", |
||||||
|
method: "post", |
||||||
|
data, |
||||||
|
responseType: "blob", |
||||||
|
}); |
||||||
|
}; |
||||||
@ -0,0 +1,709 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="btn-condition"> |
||||||
|
<div class="condition-left" v-show="showSearch"> |
||||||
|
<el-form |
||||||
|
:model="queryParams" |
||||||
|
ref="queryForm" |
||||||
|
size="small" |
||||||
|
:inline="true" |
||||||
|
> |
||||||
|
<el-form-item label="日期" prop="msgCode"> |
||||||
|
<el-date-picker |
||||||
|
style="width: auto" |
||||||
|
v-model="dayValue" |
||||||
|
type="date" |
||||||
|
placeholder="选择日" |
||||||
|
value-format="yyyy-MM-dd" |
||||||
|
> |
||||||
|
</el-date-picker> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="primary-btn"> |
||||||
|
<el-button |
||||||
|
type="primary" |
||||||
|
icon="el-icon-search" |
||||||
|
size="mini" |
||||||
|
@click="handleQuery" |
||||||
|
>搜索</el-button |
||||||
|
> |
||||||
|
</div> |
||||||
|
<div class="warning-btn"> |
||||||
|
<el-button |
||||||
|
type="warning" |
||||||
|
icon="el-icon-download" |
||||||
|
size="mini" |
||||||
|
@click="handleExport" |
||||||
|
>导出</el-button |
||||||
|
> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="meter-Context"> |
||||||
|
<div class="meter-li">最高气温:{{ heightValue }}℃</div> |
||||||
|
<div class="meter-li">最低气温:{{ lowValue }}℃</div> |
||||||
|
<!-- <div class="meter-li">住房量:108间</div> --> |
||||||
|
</div> |
||||||
|
<el-table |
||||||
|
:data="tableData" |
||||||
|
:span-method="arraySpanMethod" |
||||||
|
:cell-style="tableRowStyle" |
||||||
|
border |
||||||
|
style="width: 100%" |
||||||
|
v-loading="loading" |
||||||
|
> |
||||||
|
<el-table-column prop="mtType" label="名称" width="180"> |
||||||
|
<template #default="{ row, $index }"> |
||||||
|
<!-- 当是第 27 行时,显示 amount7费用 的值 --> |
||||||
|
<span |
||||||
|
v-if=" |
||||||
|
$index === 8 || |
||||||
|
$index === 13 || |
||||||
|
$index === 18 || |
||||||
|
$index === 21 || |
||||||
|
$index === 23 || |
||||||
|
$index === 25 || |
||||||
|
$index === 26 |
||||||
|
" |
||||||
|
>{{ row.location }}</span |
||||||
|
> |
||||||
|
<!-- 否则显示合计的值 --> |
||||||
|
<span v-else>{{ row.mtType }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column prop="location" label="位置"> </el-table-column> |
||||||
|
<el-table-column prop="mtNum" sortable label="编号"> </el-table-column> |
||||||
|
<el-table-column prop="yesterdayReading" sortable label="昨日读数"> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column prop="todayReading" sortable label="今日读数"> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column prop="mtRatio" sortable label="倍率"> </el-table-column> |
||||||
|
<el-table-column prop="total" sortable label="合计"> |
||||||
|
<template #default="{ row, $index }"> |
||||||
|
<!-- 当是第 27 行时,显示 amount7费用 的值 --> |
||||||
|
<span v-if="$index === 26">{{ row.cost }}</span> |
||||||
|
<!-- 否则显示合计的值 --> |
||||||
|
<span v-else>{{ row.total }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column prop="unitPrice" sortable label="单价"> </el-table-column> |
||||||
|
<el-table-column prop="cost" sortable label="费用"> </el-table-column> |
||||||
|
</el-table> |
||||||
|
|
||||||
|
<el-table |
||||||
|
:data="tableData2" |
||||||
|
:span-method="objectSpanMethod" |
||||||
|
border |
||||||
|
style="width: 100%; margin-top: 20px" |
||||||
|
> |
||||||
|
<el-table-column prop="mtType" label="" width="180"> </el-table-column> |
||||||
|
<el-table-column prop="location" label="分项"> </el-table-column> |
||||||
|
<el-table-column prop="yesterdayReading" label="昨日流量"> </el-table-column> |
||||||
|
<el-table-column prop="todayReading" label="今日流量"> </el-table-column> |
||||||
|
<el-table-column prop="total" label="用量"> </el-table-column> |
||||||
|
<el-table-column prop="remake" label="备注"> </el-table-column> |
||||||
|
</el-table> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { weatherTempData } from "@/api/centerairC/temHistory"; |
||||||
|
import { |
||||||
|
meterReadingsList, |
||||||
|
meterReadingsExport, |
||||||
|
} from "@/api/comprehensiveEnergy/meterRecord"; |
||||||
|
|
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 遮罩层 |
||||||
|
loading: true, |
||||||
|
// 选中数组 |
||||||
|
ids: [], |
||||||
|
// 非单个禁用 |
||||||
|
single: true, |
||||||
|
// 非多个禁用 |
||||||
|
multiple: true, |
||||||
|
// 显示搜索条件 |
||||||
|
showSearch: true, |
||||||
|
// 总条数 |
||||||
|
total: 0, |
||||||
|
// 表格数据 |
||||||
|
postList: [], |
||||||
|
// 弹出层标题 |
||||||
|
title: "", |
||||||
|
// 是否显示弹出层 |
||||||
|
open: false, |
||||||
|
// 查询参数 |
||||||
|
queryParams: { |
||||||
|
pageNum: 0, |
||||||
|
pageSize: 10, |
||||||
|
startTime: "", |
||||||
|
endTime: "", |
||||||
|
}, |
||||||
|
dayValue: "", |
||||||
|
monthValue: "", |
||||||
|
lowValue: "", //最低温度 |
||||||
|
heightValue: "", // 最高温度 |
||||||
|
tableData: [ |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置1", |
||||||
|
amount1: "编号1", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置2", |
||||||
|
amount1: "编号2", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置3", |
||||||
|
amount1: "编号3", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置4", |
||||||
|
amount1: "编号4", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置5", |
||||||
|
amount1: "编号5", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置6", |
||||||
|
amount1: "编号6", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置7", |
||||||
|
amount1: "编号7", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置8", |
||||||
|
amount1: "编号8", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "空调系统用电总合计", |
||||||
|
name: "位置9", |
||||||
|
amount1: "编号9", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置10", |
||||||
|
amount1: "编号10", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置11", |
||||||
|
amount1: "编号11", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置12", |
||||||
|
amount1: "编号12", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置13", |
||||||
|
amount1: "编号13", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "热水热泵系统用电总合计", |
||||||
|
name: "位置14", |
||||||
|
amount1: "编号14", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "水表", |
||||||
|
name: "位置15", |
||||||
|
amount1: "编号15", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "水表", |
||||||
|
name: "位置16", |
||||||
|
amount1: "编号16", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "水表", |
||||||
|
name: "位置17", |
||||||
|
amount1: "编号17", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "水表", |
||||||
|
name: "位置18", |
||||||
|
amount1: "编号18", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "热水热泵系统用水总合计", |
||||||
|
name: "位置19", |
||||||
|
amount1: "编号19", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "燃气表(常用)", |
||||||
|
name: "位置20", |
||||||
|
amount1: "编号20", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
|
||||||
|
{ |
||||||
|
id: "燃气表(备用)", |
||||||
|
name: "位置21", |
||||||
|
amount1: "编号21", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "蒸汽发生器+采暖用气总合计", |
||||||
|
name: "位置22", |
||||||
|
amount1: "编号22", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置23", |
||||||
|
amount1: "编号23", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "蒸汽发生器+采暖用电总合计", |
||||||
|
name: "位置24", |
||||||
|
amount1: "编号24", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "电表", |
||||||
|
name: "位置25", |
||||||
|
amount1: "编号25", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "蒸汽发生器用水总合计", |
||||||
|
name: "位置26", |
||||||
|
amount1: "编号26", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "水、电、气费用总合计(水/电/气价预估单价,单价需以实际缴费为准)", |
||||||
|
name: "位置27", |
||||||
|
amount1: "编号27", |
||||||
|
amount2: "234.132", |
||||||
|
amount3: 192.72, |
||||||
|
amount4: 1, |
||||||
|
amount5: 345, |
||||||
|
amount6: 0.678, |
||||||
|
amount7: 150, |
||||||
|
}, |
||||||
|
], |
||||||
|
tableData2: [ |
||||||
|
{ |
||||||
|
id: "流量计量表", |
||||||
|
name: "中央空调冷冻流量", |
||||||
|
amount1: "0", |
||||||
|
amount2: "0", |
||||||
|
amount3: 0, |
||||||
|
amount4: "", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "3", |
||||||
|
name: "中央空调冷却流量", |
||||||
|
amount1: "0", |
||||||
|
amount2: "0", |
||||||
|
amount3: 0, |
||||||
|
amount4: "", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "4", |
||||||
|
name: "中央空调采暖流量", |
||||||
|
amount1: "0", |
||||||
|
amount2: "0", |
||||||
|
amount3: 0, |
||||||
|
amount4: "", |
||||||
|
}, |
||||||
|
{ |
||||||
|
id: "1", |
||||||
|
name: "蒸汽流量", |
||||||
|
amount1: "0", |
||||||
|
amount2: "0", |
||||||
|
amount3: 0, |
||||||
|
amount4: "", |
||||||
|
}, |
||||||
|
], |
||||||
|
}; |
||||||
|
}, |
||||||
|
created() { |
||||||
|
// 获取当前日期 |
||||||
|
const currentDate = new Date(); |
||||||
|
// 获取当前年份 |
||||||
|
const year = currentDate.getFullYear(); |
||||||
|
// 获取当前月份,注意月份是从 0 开始的,所以要加 1 |
||||||
|
const month = String(currentDate.getMonth() + 1).padStart(2, "0"); |
||||||
|
// 获取当前日期中的“天”,并进行补零处理 |
||||||
|
const day = String(currentDate.getDate()).padStart(2, "0"); |
||||||
|
// 格式化日期为 yyyy-MM-dd 格式 |
||||||
|
this.dayValue = `${year}-${month}-${day}`; |
||||||
|
this.monthValue = `${year}-${month}`; |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.getList(); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
tableRowStyle({ row, column, rowIndex, columnIndex }) { |
||||||
|
// 修改颜色 |
||||||
|
// if (columnIndex === 1) { |
||||||
|
// return "color: #fd1e00;!important;text-align:center"; |
||||||
|
// } |
||||||
|
// if (columnIndex === 2) { |
||||||
|
// return "color: #3390ff;!important;text-align:center"; |
||||||
|
// } |
||||||
|
if ( |
||||||
|
rowIndex === 8 || |
||||||
|
rowIndex === 13 || |
||||||
|
rowIndex === 18 || |
||||||
|
rowIndex === 21 || |
||||||
|
rowIndex === 23 || |
||||||
|
rowIndex === 25 || |
||||||
|
rowIndex === 26 |
||||||
|
) { |
||||||
|
return "color: #75d148;!important;font-weight: bold;background-color: rgba(0, 71, 125, 0.4)"; |
||||||
|
} |
||||||
|
}, |
||||||
|
// 表格1合计内容 |
||||||
|
arraySpanMethod({ row, column, rowIndex, columnIndex }) { |
||||||
|
// console.log("打印", row, column, rowIndex, columnIndex); |
||||||
|
// // rowIndex表示→方向相当于x轴 columnIndex表示↓方向相当于y轴 |
||||||
|
// // rowIndex % 2 === 0表示偶数行 |
||||||
|
// if (rowIndex % 2 === 0) { |
||||||
|
// // 如果偶数行的列为0,则 |
||||||
|
// if (columnIndex === 0) { |
||||||
|
// // 第一列和第二列合并 |
||||||
|
// return [1, 2]; |
||||||
|
// } else if (columnIndex === 1) { |
||||||
|
// // 返回 [0, 0] 表示当前单元格不显示,不合并 |
||||||
|
// return [0, 0]; |
||||||
|
// } |
||||||
|
// } |
||||||
|
if ( |
||||||
|
rowIndex === 8 || |
||||||
|
rowIndex === 13 || |
||||||
|
rowIndex === 18 || |
||||||
|
rowIndex === 21 || |
||||||
|
rowIndex === 23 || |
||||||
|
rowIndex === 25 |
||||||
|
) { |
||||||
|
if (columnIndex === 0) { |
||||||
|
// 当 rowIndex 为 8 且 columnIndex 为 0 时,合并 1 行 6 列 |
||||||
|
return [1, 6]; |
||||||
|
} else if (columnIndex < 6) { |
||||||
|
// 当 rowIndex 为 8 且 columnIndex 小于 6 时,隐藏该单元格 |
||||||
|
return [0, 0]; |
||||||
|
} |
||||||
|
} |
||||||
|
if (rowIndex === 26) { |
||||||
|
if (columnIndex < 6) { |
||||||
|
if (columnIndex === 0) { |
||||||
|
// 前六列合并,第一列设置合并规则 |
||||||
|
return [1, 6]; |
||||||
|
} else { |
||||||
|
// 除第一列外的前六列其他列隐藏 |
||||||
|
return [0, 0]; |
||||||
|
} |
||||||
|
} else if (columnIndex >= 6) { |
||||||
|
if (columnIndex === 6) { |
||||||
|
// 后三列合并,第七列设置合并规则 |
||||||
|
return [1, 3]; |
||||||
|
} else { |
||||||
|
// 除第七列外的后三列其他列隐藏 |
||||||
|
return [0, 0]; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
// 其他情况不做处理 |
||||||
|
return [1, 1]; |
||||||
|
}, |
||||||
|
// 表格2合计内容 |
||||||
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) { |
||||||
|
if (columnIndex === 0) { |
||||||
|
if (rowIndex === 0) { |
||||||
|
return { |
||||||
|
rowspan: 4, |
||||||
|
colspan: 1, |
||||||
|
}; |
||||||
|
} else { |
||||||
|
return { |
||||||
|
rowspan: 0, |
||||||
|
colspan: 0, |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
/** 查询表格数据 */ |
||||||
|
getList() { |
||||||
|
this.loading = true; |
||||||
|
if (!this.dayValue) { |
||||||
|
this.$modal.msgWarning("请选择日期!"); |
||||||
|
return; |
||||||
|
} |
||||||
|
let data = { |
||||||
|
todayTimestamp: `${this.dayValue} 00:00:00`, |
||||||
|
}; |
||||||
|
meterReadingsList(data).then((res) => { |
||||||
|
console.log("列表返回", res); |
||||||
|
if (res.code == 200 && res.rows) { |
||||||
|
this.tableData = res.rows.slice(0, 27); |
||||||
|
this.tableData2 = res.rows.slice(27, 31); |
||||||
|
} else { |
||||||
|
this.tableData = []; |
||||||
|
this.tableData2 = []; |
||||||
|
} |
||||||
|
}); |
||||||
|
// 处理表格数据 |
||||||
|
this.loading = false; |
||||||
|
//查询温度 |
||||||
|
this.getTemValue(); |
||||||
|
}, |
||||||
|
getTemValue() { |
||||||
|
if (this.dayValue) { |
||||||
|
// 处理月参数 |
||||||
|
const parts = this.dayValue.split("-"); |
||||||
|
this.monthValue = `${parts[0]}-${parts[1]}`; |
||||||
|
} |
||||||
|
this.queryParams.startTime = this.queryParams.endTime = this.monthValue; |
||||||
|
console.log("参数", this.queryParams); |
||||||
|
weatherTempData(this.queryParams).then((response) => { |
||||||
|
let data = response.rows; |
||||||
|
// console.log("this.dayValue", this.dayValue); |
||||||
|
if (data && data.length > 0) { |
||||||
|
data.forEach((item) => { |
||||||
|
if (item.dateAndWeek) { |
||||||
|
let objectDate = item.dateAndWeek.split(" ")[0]; |
||||||
|
// console.log(" objectDate", objectDate); |
||||||
|
if (objectDate == this.dayValue) { |
||||||
|
this.lowValue = item.minTemp; |
||||||
|
this.heightValue = item.maxTemp; |
||||||
|
console.log("最低气温", this.lowValue); |
||||||
|
console.log("最高气温", this.heightValue); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
/** 搜索按钮操作 */ |
||||||
|
handleQuery() { |
||||||
|
this.getList(); |
||||||
|
}, |
||||||
|
/** 导出按钮操作 */ |
||||||
|
handleExport() { |
||||||
|
let data = { |
||||||
|
todayTimestamp: this.dayValue, |
||||||
|
}; |
||||||
|
console.log("导出数据参数", data); |
||||||
|
meterReadingsExport(data).then((res) => { |
||||||
|
console.log("导出返回", res); |
||||||
|
if (res) { |
||||||
|
// 请求的结果就是文件 |
||||||
|
// 创建一个blob URL,用于生成下载链接 |
||||||
|
const url = window.URL.createObjectURL(new Blob([res])); |
||||||
|
// 创建一个<a>元素,并设置其href和download属性 |
||||||
|
const link = document.createElement("a"); |
||||||
|
link.href = url; |
||||||
|
link.setAttribute("download", "水电表抄表记录.xls"); // 设置下载的文件名 |
||||||
|
// 模拟点击下载链接 |
||||||
|
document.body.appendChild(link); |
||||||
|
link.click(); |
||||||
|
document.body.removeChild(link); |
||||||
|
// 释放blob URL资源 |
||||||
|
window.URL.revokeObjectURL(url); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "导出成功!", |
||||||
|
}); |
||||||
|
} else { |
||||||
|
this.$message.error("导出失败!"); |
||||||
|
} |
||||||
|
}); |
||||||
|
// .catch((err) => { |
||||||
|
// this.$message.error('导出失败!'); |
||||||
|
// }) |
||||||
|
}, |
||||||
|
}, |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style scoped> |
||||||
|
.app-container >>> .el-table th.el-table__cell.is-leaf, |
||||||
|
.app-container >>> .el-table td.el-table__cell { |
||||||
|
border-bottom: 1px solid #000000 !important; |
||||||
|
} |
||||||
|
.app-container >>> .el-table--border .el-table__cell { |
||||||
|
border-right: 1px solid #000000 !important; |
||||||
|
} |
||||||
|
</style> |
||||||
|
<style lang="scss" scoped> |
||||||
|
.meter-Context { |
||||||
|
width: 100%; |
||||||
|
display: flex; |
||||||
|
flex-direction: row; |
||||||
|
align-items: center; |
||||||
|
border: 1px solid #000000 !important; |
||||||
|
padding: 0 30px; |
||||||
|
.meter-li { |
||||||
|
line-height: 23px; |
||||||
|
padding: 10px 0; |
||||||
|
height: 45px; |
||||||
|
color: #ffffff; |
||||||
|
font-size: 14px; |
||||||
|
margin-right: 30px; |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
||||||
Loading…
Reference in new issue