<template> <div class="app-container"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px"> <el-form-item label="设备编号" prop="deviceThreshold"> <el-input v-model="queryParams.deviceNum" placeholder="请输入设备编号" clearable size="small" @keyup.enter.native="handleQuery" /> </el-form-item> <el-form-item label="设备名称" prop="deviceThreshold"> <el-input v-model="queryParams.deviceThreshold" placeholder="请输入设备名称" clearable size="small" @keyup.enter.native="handleQuery" /> </el-form-item> <el-form-item label="开始时间" prop="startTime"> <el-date-picker clearable size="small" v-model="queryParams.startTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="请选择开始时间" align="right" style="width: 200px"> </el-date-picker> <font color="#C0C4CC"> 至</font> </el-form-item> <el-form-item label="结束时间" prop="endTime"> <el-date-picker clearable size="small" v-model="queryParams.endTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="请选择结束时间" align="right" style="width: 200px"> </el-date-picker> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> </el-form-item> </el-form> <!--<el-row :gutter="10" class="mb8"> <el-col :span="1.5"> <el-button type="warning" plain icon="el-icon-download" size="mini" :loading="exportLoading" @click="handleExport" v-hasPermi="['system:device:export']" >导出</el-button> </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row>--> <el-table v-loading="loading" :data="deviceList"> <el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备编号" align="center" prop="deviceNum" /> <el-table-column label="设备上报开始时间" align="center" prop="startTime" /> <el-table-column label="设备上报结束时间" align="center" prop="endTime" /> <el-table-column label="标况累计流量(m³)" align="center" prop="standardConditionAccumulation" /> </el-table> <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> </div> </template> <script> import { getDeviceStatisticsInfo } from "@/api/dataMonitoring/deviceStatistics"; export default { data() { return { // 遮罩层 loading: true, // 导出遮罩层 exportLoading: false, // 选中数组 ids: [], // 非单个禁用 single: true, // 非多个禁用 multiple: true, // 显示搜索条件 showSearch: true, // 总条数 total: 0, // 设备监控表格数据 deviceList: [], // 弹出层标题 title: "", // 是否显示弹出层 open: false, // 查询参数 queryParams: { pageNum: 1, pageSize: 10, deviceNum: null, deviceName: null, startTime: null, endTime: null, }, // 表单参数 form: {} }; }, created() { // this.getList(); this.loading = false; this.getCurrentMonthFirst(); this.getCurrentMonthLast(); }, methods: { /** 查询设备监控列表 */ getList() { this.loading = true; getDeviceStatisticsInfo(this.queryParams).then(response => { console.log(response) this.deviceList = response.rows; this.total = response.total; this.loading = false; }); }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1; this.getList(); }, /** 重置按钮操作 */ resetQuery() { this.resetForm("queryForm"); this.handleQuery(); }, /** 导出按钮操作 */ handleExport() { const queryParams = this.queryParams; this.$confirm('是否确认导出所有设备监控数据项?', "警告", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" }).then(() => { this.exportLoading = true; return exportDevice(queryParams); }).then(response => { this.download(response.msg); this.exportLoading = false; }).catch(() => { }); }, getCurrentMonthFirst() { var date = new Date() date.setDate(1) var month = parseInt(date.getMonth() + 1) var day = date.getDate() if (month < 10) month = '0' + month if (day < 10) day = '0' + day this.queryParams.startTime = date.getFullYear() + '-' + month + '-' + day + ' 00:00:00' }, getCurrentMonthLast() { var date = new Date() var month = parseInt(date.getMonth() + 1) var day = date.getDate() if (month < 10) month = '0' + month if (day < 10) day = '0' + day this.queryParams.endTime = date.getFullYear() + '-' + month + '-' + day + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() }, } }; </script>