Commit d5f664c5 authored by 耿迪迪's avatar 耿迪迪

Merge branch 'master' of ssh://111.61.77.35:15/gengdidi/gassafety

parents 9191f390 9dd2f0a7
package com.zehong.web.controller.dataMonitoring;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TDeviceReportData;
import com.zehong.system.service.ITDeviceReportDataService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 设备监控Controller
*
* @author zehong
* @date 2021-08-09
*/
@RestController
@RequestMapping("/dataMonitoring/reportData")
public class TDeviceReportDataController extends BaseController
{
@Autowired
private ITDeviceReportDataService tDeviceReportDataService;
/**
* 查询设备监控列表
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:list')")
@GetMapping("/list")
public TableDataInfo list(TDeviceReportData tDeviceReportData)
{
startPage();
List<TDeviceReportData> list = tDeviceReportDataService.selectTDeviceReportDataList(tDeviceReportData);
return getDataTable(list);
}
/**
* 查询设备监控列表
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:realtimeList')")
@GetMapping("/realtimeList")
public TableDataInfo realtimeList(TDeviceReportData tDeviceReportData)
{
startPage();
List<TDeviceReportData> list = tDeviceReportDataService.selectTDeviceReportDataList(tDeviceReportData);
return getDataTable(list);
}
/**
* 导出设备监控列表
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:export')")
@Log(title = "设备监控", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TDeviceReportData tDeviceReportData)
{
List<TDeviceReportData> list = tDeviceReportDataService.selectTDeviceReportDataList(tDeviceReportData);
ExcelUtil<TDeviceReportData> util = new ExcelUtil<TDeviceReportData>(TDeviceReportData.class);
return util.exportExcel(list, "设备监控数据");
}
/**
* 获取设备监控详细信息
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:query')")
@GetMapping(value = "/{deviceReportDataId}")
public AjaxResult getInfo(@PathVariable("deviceReportDataId") Long deviceReportDataId)
{
return AjaxResult.success(tDeviceReportDataService.selectTDeviceReportDataById(deviceReportDataId));
}
/**
* 新增设备监控
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:add')")
@Log(title = "设备监控", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TDeviceReportData tDeviceReportData)
{
return toAjax(tDeviceReportDataService.insertTDeviceReportData(tDeviceReportData));
}
/**
* 修改设备监控
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:edit')")
@Log(title = "设备监控", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TDeviceReportData tDeviceReportData)
{
return toAjax(tDeviceReportDataService.updateTDeviceReportData(tDeviceReportData));
}
/**
* 删除设备监控
*/
@PreAuthorize("@ss.hasPermi('dataMonitoring:reportData:remove')")
@Log(title = "设备监控", businessType = BusinessType.DELETE)
@DeleteMapping("/{deviceReportDataIds}")
public AjaxResult remove(@PathVariable Long[] deviceReportDataIds)
{
return toAjax(tDeviceReportDataService.deleteTDeviceReportDataByIds(deviceReportDataIds));
}
}
package com.zehong.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 设备监控对象 t_device_report_data
*
* @author zehong
* @date 2021-08-09
*/
public class TDeviceReportData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 设备上报id */
private Long deviceReportDataId;
/** 设备id */
@Excel(name = "设备id")
private Long deviceNum;
/** 标况累计量 */
@Excel(name = "标况累计量")
private BigDecimal standardConditionAccumulation;
/** 工况累计量 */
@Excel(name = "工况累计量")
private BigDecimal workingConditionAccumulation;
/** 剩余量 */
@Excel(name = "剩余量")
private BigDecimal residualQuantity;
/** 标况流量 */
@Excel(name = "标况流量")
private BigDecimal standardConditionFlow;
/** 工况流量 */
@Excel(name = "工况流量")
private BigDecimal workingConditionFlow;
/** 温度 */
@Excel(name = "温度")
private BigDecimal temperature;
/** 压力 */
@Excel(name = "压力")
private BigDecimal pressure;
/** 上报时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上报时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date reportTime;
/** 通讯状态 */
@Excel(name = "通讯状态")
private String communicationStatus;
/** 设备状态 */
@Excel(name = "设备状态")
private String deviceStatus;
public void setDeviceReportDataId(Long deviceReportDataId)
{
this.deviceReportDataId = deviceReportDataId;
}
public Long getDeviceReportDataId()
{
return deviceReportDataId;
}
public void setDeviceNum(Long deviceNum)
{
this.deviceNum = deviceNum;
}
public Long getDeviceNum()
{
return deviceNum;
}
public void setStandardConditionAccumulation(BigDecimal standardConditionAccumulation)
{
this.standardConditionAccumulation = standardConditionAccumulation;
}
public BigDecimal getStandardConditionAccumulation()
{
return standardConditionAccumulation;
}
public void setWorkingConditionAccumulation(BigDecimal workingConditionAccumulation)
{
this.workingConditionAccumulation = workingConditionAccumulation;
}
public BigDecimal getWorkingConditionAccumulation()
{
return workingConditionAccumulation;
}
public void setResidualQuantity(BigDecimal residualQuantity)
{
this.residualQuantity = residualQuantity;
}
public BigDecimal getResidualQuantity()
{
return residualQuantity;
}
public void setStandardConditionFlow(BigDecimal standardConditionFlow)
{
this.standardConditionFlow = standardConditionFlow;
}
public BigDecimal getStandardConditionFlow()
{
return standardConditionFlow;
}
public void setWorkingConditionFlow(BigDecimal workingConditionFlow)
{
this.workingConditionFlow = workingConditionFlow;
}
public BigDecimal getWorkingConditionFlow()
{
return workingConditionFlow;
}
public void setTemperature(BigDecimal temperature)
{
this.temperature = temperature;
}
public BigDecimal getTemperature()
{
return temperature;
}
public void setPressure(BigDecimal pressure)
{
this.pressure = pressure;
}
public BigDecimal getPressure()
{
return pressure;
}
public void setReportTime(Date reportTime)
{
this.reportTime = reportTime;
}
public Date getReportTime()
{
return reportTime;
}
public void setCommunicationStatus(String communicationStatus)
{
this.communicationStatus = communicationStatus;
}
public String getCommunicationStatus()
{
return communicationStatus;
}
public void setDeviceStatus(String deviceStatus)
{
this.deviceStatus = deviceStatus;
}
public String getDeviceStatus()
{
return deviceStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceReportDataId", getDeviceReportDataId())
.append("deviceNum", getDeviceNum())
.append("standardConditionAccumulation", getStandardConditionAccumulation())
.append("workingConditionAccumulation", getWorkingConditionAccumulation())
.append("residualQuantity", getResidualQuantity())
.append("standardConditionFlow", getStandardConditionFlow())
.append("workingConditionFlow", getWorkingConditionFlow())
.append("temperature", getTemperature())
.append("pressure", getPressure())
.append("reportTime", getReportTime())
.append("communicationStatus", getCommunicationStatus())
.append("deviceStatus", getDeviceStatus())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TDeviceReportData;
/**
* 设备监控Mapper接口
*
* @author zehong
* @date 2021-08-09
*/
public interface TDeviceReportDataMapper
{
/**
* 查询设备监控
*
* @param deviceReportDataId 设备监控ID
* @return 设备监控
*/
public TDeviceReportData selectTDeviceReportDataById(Long deviceReportDataId);
/**
* 查询设备监控列表
*
* @param tDeviceReportData 设备监控
* @return 设备监控集合
*/
public List<TDeviceReportData> selectTDeviceReportDataList(TDeviceReportData tDeviceReportData);
/**
* 新增设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
public int insertTDeviceReportData(TDeviceReportData tDeviceReportData);
/**
* 修改设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
public int updateTDeviceReportData(TDeviceReportData tDeviceReportData);
/**
* 删除设备监控
*
* @param deviceReportDataId 设备监控ID
* @return 结果
*/
public int deleteTDeviceReportDataById(Long deviceReportDataId);
/**
* 批量删除设备监控
*
* @param deviceReportDataIds 需要删除的数据ID
* @return 结果
*/
public int deleteTDeviceReportDataByIds(Long[] deviceReportDataIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TDeviceReportData;
/**
* 设备监控Service接口
*
* @author zehong
* @date 2021-08-09
*/
public interface ITDeviceReportDataService
{
/**
* 查询设备监控
*
* @param deviceReportDataId 设备监控ID
* @return 设备监控
*/
public TDeviceReportData selectTDeviceReportDataById(Long deviceReportDataId);
/**
* 查询设备监控列表
*
* @param tDeviceReportData 设备监控
* @return 设备监控集合
*/
public List<TDeviceReportData> selectTDeviceReportDataList(TDeviceReportData tDeviceReportData);
/**
* 新增设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
public int insertTDeviceReportData(TDeviceReportData tDeviceReportData);
/**
* 修改设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
public int updateTDeviceReportData(TDeviceReportData tDeviceReportData);
/**
* 批量删除设备监控
*
* @param deviceReportDataIds 需要删除的设备监控ID
* @return 结果
*/
public int deleteTDeviceReportDataByIds(Long[] deviceReportDataIds);
/**
* 删除设备监控信息
*
* @param deviceReportDataId 设备监控ID
* @return 结果
*/
public int deleteTDeviceReportDataById(Long deviceReportDataId);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDeviceReportDataMapper;
import com.zehong.system.domain.TDeviceReportData;
import com.zehong.system.service.ITDeviceReportDataService;
/**
* 设备监控Service业务层处理
*
* @author zehong
* @date 2021-08-09
*/
@Service
public class TDeviceReportDataServiceImpl implements ITDeviceReportDataService
{
@Autowired
private TDeviceReportDataMapper tDeviceReportDataMapper;
/**
* 查询设备监控
*
* @param deviceReportDataId 设备监控ID
* @return 设备监控
*/
@Override
public TDeviceReportData selectTDeviceReportDataById(Long deviceReportDataId)
{
return tDeviceReportDataMapper.selectTDeviceReportDataById(deviceReportDataId);
}
/**
* 查询设备监控列表
*
* @param tDeviceReportData 设备监控
* @return 设备监控
*/
@Override
public List<TDeviceReportData> selectTDeviceReportDataList(TDeviceReportData tDeviceReportData)
{
return tDeviceReportDataMapper.selectTDeviceReportDataList(tDeviceReportData);
}
/**
* 新增设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
@Override
public int insertTDeviceReportData(TDeviceReportData tDeviceReportData)
{
tDeviceReportData.setCreateTime(DateUtils.getNowDate());
return tDeviceReportDataMapper.insertTDeviceReportData(tDeviceReportData);
}
/**
* 修改设备监控
*
* @param tDeviceReportData 设备监控
* @return 结果
*/
@Override
public int updateTDeviceReportData(TDeviceReportData tDeviceReportData)
{
tDeviceReportData.setUpdateTime(DateUtils.getNowDate());
return tDeviceReportDataMapper.updateTDeviceReportData(tDeviceReportData);
}
/**
* 批量删除设备监控
*
* @param deviceReportDataIds 需要删除的设备监控ID
* @return 结果
*/
@Override
public int deleteTDeviceReportDataByIds(Long[] deviceReportDataIds)
{
return tDeviceReportDataMapper.deleteTDeviceReportDataByIds(deviceReportDataIds);
}
/**
* 删除设备监控信息
*
* @param deviceReportDataId 设备监控ID
* @return 结果
*/
@Override
public int deleteTDeviceReportDataById(Long deviceReportDataId)
{
return tDeviceReportDataMapper.deleteTDeviceReportDataById(deviceReportDataId);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TDeviceReportDataMapper">
<resultMap type="TDeviceReportData" id="TDeviceReportDataResult">
<result property="deviceReportDataId" column="device_report_data_id" />
<result property="deviceNum" column="device_num" />
<result property="standardConditionAccumulation" column="standard_condition_accumulation" />
<result property="workingConditionAccumulation" column="working_condition_accumulation" />
<result property="residualQuantity" column="residual_quantity" />
<result property="standardConditionFlow" column="standard_condition_flow" />
<result property="workingConditionFlow" column="working_condition_flow" />
<result property="temperature" column="temperature" />
<result property="pressure" column="pressure" />
<result property="reportTime" column="report_time" />
<result property="communicationStatus" column="communication_status" />
<result property="deviceStatus" column="device_status" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTDeviceReportDataVo">
select device_report_data_id, device_num, standard_condition_accumulation, working_condition_accumulation, residual_quantity, standard_condition_flow, working_condition_flow, temperature, pressure, report_time, communication_status, device_status, create_time, update_time from t_device_report_data
</sql>
<select id="selectTDeviceReportDataList" parameterType="TDeviceReportData" resultMap="TDeviceReportDataResult">
<include refid="selectTDeviceReportDataVo"/>
<where>
<if test="deviceNum != null "> and device_num = #{deviceNum}</if>
<if test="standardConditionAccumulation != null "> and standard_condition_accumulation = #{standardConditionAccumulation}</if>
<if test="workingConditionAccumulation != null "> and working_condition_accumulation = #{workingConditionAccumulation}</if>
<if test="residualQuantity != null "> and residual_quantity = #{residualQuantity}</if>
<if test="standardConditionFlow != null "> and standard_condition_flow = #{standardConditionFlow}</if>
<if test="workingConditionFlow != null "> and working_condition_flow = #{workingConditionFlow}</if>
<if test="temperature != null "> and temperature = #{temperature}</if>
<if test="pressure != null "> and pressure = #{pressure}</if>
<if test="reportTime != null "> and report_time = #{reportTime}</if>
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
<if test="deviceStatus != null and deviceStatus != ''"> and device_status = #{deviceStatus}</if>
</where>
</select>
<select id="selectTDeviceReportDataById" parameterType="Long" resultMap="TDeviceReportDataResult">
<include refid="selectTDeviceReportDataVo"/>
where device_report_data_id = #{deviceReportDataId}
</select>
<insert id="insertTDeviceReportData" parameterType="TDeviceReportData" useGeneratedKeys="true" keyProperty="deviceReportDataId">
insert into t_device_report_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceNum != null">device_num,</if>
<if test="standardConditionAccumulation != null">standard_condition_accumulation,</if>
<if test="workingConditionAccumulation != null">working_condition_accumulation,</if>
<if test="residualQuantity != null">residual_quantity,</if>
<if test="standardConditionFlow != null">standard_condition_flow,</if>
<if test="workingConditionFlow != null">working_condition_flow,</if>
<if test="temperature != null">temperature,</if>
<if test="pressure != null">pressure,</if>
<if test="reportTime != null">report_time,</if>
<if test="communicationStatus != null">communication_status,</if>
<if test="deviceStatus != null">device_status,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceNum != null">#{deviceNum},</if>
<if test="standardConditionAccumulation != null">#{standardConditionAccumulation},</if>
<if test="workingConditionAccumulation != null">#{workingConditionAccumulation},</if>
<if test="residualQuantity != null">#{residualQuantity},</if>
<if test="standardConditionFlow != null">#{standardConditionFlow},</if>
<if test="workingConditionFlow != null">#{workingConditionFlow},</if>
<if test="temperature != null">#{temperature},</if>
<if test="pressure != null">#{pressure},</if>
<if test="reportTime != null">#{reportTime},</if>
<if test="communicationStatus != null">#{communicationStatus},</if>
<if test="deviceStatus != null">#{deviceStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTDeviceReportData" parameterType="TDeviceReportData">
update t_device_report_data
<trim prefix="SET" suffixOverrides=",">
<if test="deviceNum != null">device_num = #{deviceNum},</if>
<if test="standardConditionAccumulation != null">standard_condition_accumulation = #{standardConditionAccumulation},</if>
<if test="workingConditionAccumulation != null">working_condition_accumulation = #{workingConditionAccumulation},</if>
<if test="residualQuantity != null">residual_quantity = #{residualQuantity},</if>
<if test="standardConditionFlow != null">standard_condition_flow = #{standardConditionFlow},</if>
<if test="workingConditionFlow != null">working_condition_flow = #{workingConditionFlow},</if>
<if test="temperature != null">temperature = #{temperature},</if>
<if test="pressure != null">pressure = #{pressure},</if>
<if test="reportTime != null">report_time = #{reportTime},</if>
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where device_report_data_id = #{deviceReportDataId}
</update>
<delete id="deleteTDeviceReportDataById" parameterType="Long">
delete from t_device_report_data where device_report_data_id = #{deviceReportDataId}
</delete>
<delete id="deleteTDeviceReportDataByIds" parameterType="String">
delete from t_device_report_data where device_report_data_id in
<foreach item="deviceReportDataId" collection="array" open="(" separator="," close=")">
#{deviceReportDataId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询设备监控列表
export function listData(query) {
return request({
url: '/dataMonitoring/reportData/list',
method: 'get',
params: query
})
}
// 查询设备监控实时列表
export function realtimeData(query) {
return request({
url: '/dataMonitoring/reportData/realtimeList',
method: 'get',
params: query
})
}
// 查询设备监控详细
export function getData(deviceReportDataId) {
return request({
url: '/dataMonitoring/reportData/' + deviceReportDataId,
method: 'get'
})
}
// 新增设备监控
export function addData(data) {
return request({
url: '/dataMonitoring/data',
method: 'post',
data: data
})
}
// 修改设备监控
export function updateData(data) {
return request({
url: '/dataMonitoring/data',
method: 'put',
data: data
})
}
// 删除设备监控
export function delData(deviceReportDataId) {
return request({
url: '/dataMonitoring/reportData/' + deviceReportDataId,
method: 'delete'
})
}
// 导出设备监控
export function exportData(query) {
return request({
url: '/dataMonitoring/reportData/export',
method: 'get',
params: query
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备id" prop="deviceNum">
<el-input
v-model="queryParams.deviceNum"
placeholder="请输入设备id"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标况累计量" prop="standardConditionAccumulation">
<el-input
v-model="queryParams.standardConditionAccumulation"
placeholder="请输入标况累计量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工况累计量" prop="workingConditionAccumulation">
<el-input
v-model="queryParams.workingConditionAccumulation"
placeholder="请输入工况累计量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="剩余量" prop="residualQuantity">
<el-input
v-model="queryParams.residualQuantity"
placeholder="请输入剩余量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标况流量" prop="standardConditionFlow">
<el-input
v-model="queryParams.standardConditionFlow"
placeholder="请输入标况流量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工况流量" prop="workingConditionFlow">
<el-input
v-model="queryParams.workingConditionFlow"
placeholder="请输入工况流量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="温度" prop="temperature">
<el-input
v-model="queryParams.temperature"
placeholder="请输入温度"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="压力" prop="pressure">
<el-input
v-model="queryParams.pressure"
placeholder="请输入压力"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="上报时间" prop="reportTime">
<el-date-picker clearable size="small"
v-model="queryParams.reportTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择上报时间">
</el-date-picker>
</el-form-item>
<el-form-item label="通讯状态" prop="communicationStatus">
<el-select v-model="queryParams.communicationStatus" placeholder="请选择通讯状态" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="设备状态" prop="deviceStatus">
<el-select v-model="queryParams.deviceStatus" placeholder="请选择设备状态" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</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="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:data:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:data:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:data:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:data:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="设备上报id" align="center" prop="deviceReportDataId" />
<el-table-column label="设备id" align="center" prop="deviceNum" />
<el-table-column label="标况累计量" align="center" prop="standardConditionAccumulation" />
<el-table-column label="工况累计量" align="center" prop="workingConditionAccumulation" />
<el-table-column label="剩余量" align="center" prop="residualQuantity" />
<el-table-column label="标况流量" align="center" prop="standardConditionFlow" />
<el-table-column label="工况流量" align="center" prop="workingConditionFlow" />
<el-table-column label="温度" align="center" prop="temperature" />
<el-table-column label="压力" align="center" prop="pressure" />
<el-table-column label="上报时间" align="center" prop="reportTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.reportTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="通讯状态" align="center" prop="communicationStatus" />
<el-table-column label="设备状态" align="center" prop="deviceStatus" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:data:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:data:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改设备监控对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备id" prop="deviceNum">
<el-input v-model="form.deviceNum" placeholder="请输入设备id" />
</el-form-item>
<el-form-item label="标况累计量" prop="standardConditionAccumulation">
<el-input v-model="form.standardConditionAccumulation" placeholder="请输入标况累计量" />
</el-form-item>
<el-form-item label="工况累计量" prop="workingConditionAccumulation">
<el-input v-model="form.workingConditionAccumulation" placeholder="请输入工况累计量" />
</el-form-item>
<el-form-item label="剩余量" prop="residualQuantity">
<el-input v-model="form.residualQuantity" placeholder="请输入剩余量" />
</el-form-item>
<el-form-item label="标况流量" prop="standardConditionFlow">
<el-input v-model="form.standardConditionFlow" placeholder="请输入标况流量" />
</el-form-item>
<el-form-item label="工况流量" prop="workingConditionFlow">
<el-input v-model="form.workingConditionFlow" placeholder="请输入工况流量" />
</el-form-item>
<el-form-item label="温度" prop="temperature">
<el-input v-model="form.temperature" placeholder="请输入温度" />
</el-form-item>
<el-form-item label="压力" prop="pressure">
<el-input v-model="form.pressure" placeholder="请输入压力" />
</el-form-item>
<el-form-item label="上报时间" prop="reportTime">
<el-date-picker clearable size="small"
v-model="form.reportTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择上报时间">
</el-date-picker>
</el-form-item>
<el-form-item label="通讯状态">
<el-radio-group v-model="form.communicationStatus">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="设备状态">
<el-radio-group v-model="form.deviceStatus">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { realtimeData, getData, delData, addData, updateData, exportData } from "@/api/dataMonitoring/reportData";
export default {
name: "Data",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 设备监控表格数据
dataList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
deviceNum: null,
standardConditionAccumulation: null,
workingConditionAccumulation: null,
residualQuantity: null,
standardConditionFlow: null,
workingConditionFlow: null,
temperature: null,
pressure: null,
reportTime: null,
communicationStatus: null,
deviceStatus: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询设备监控列表 */
getList() {
this.loading = true;
realtimeData(this.queryParams).then(response => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
deviceReportDataId: null,
deviceNum: null,
standardConditionAccumulation: null,
workingConditionAccumulation: null,
residualQuantity: null,
standardConditionFlow: null,
workingConditionFlow: null,
temperature: null,
pressure: null,
reportTime: null,
communicationStatus: "0",
deviceStatus: "0",
createTime: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.deviceReportDataId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加设备监控";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const deviceReportDataId = row.deviceReportDataId || this.ids
getData(deviceReportDataId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改设备监控";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.deviceReportDataId != null) {
updateData(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addData(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const deviceReportDataIds = row.deviceReportDataId || this.ids;
this.$confirm('是否确认删除设备监控编号为"' + deviceReportDataIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delData(deviceReportDataIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有设备监控数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportData(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="设备id" prop="deviceNum">
<el-input
v-model="queryParams.deviceNum"
placeholder="请输入设备id"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标况累计量" prop="standardConditionAccumulation">
<el-input
v-model="queryParams.standardConditionAccumulation"
placeholder="请输入标况累计量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工况累计量" prop="workingConditionAccumulation">
<el-input
v-model="queryParams.workingConditionAccumulation"
placeholder="请输入工况累计量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="剩余量" prop="residualQuantity">
<el-input
v-model="queryParams.residualQuantity"
placeholder="请输入剩余量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标况流量" prop="standardConditionFlow">
<el-input
v-model="queryParams.standardConditionFlow"
placeholder="请输入标况流量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工况流量" prop="workingConditionFlow">
<el-input
v-model="queryParams.workingConditionFlow"
placeholder="请输入工况流量"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="温度" prop="temperature">
<el-input
v-model="queryParams.temperature"
placeholder="请输入温度"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="压力" prop="pressure">
<el-input
v-model="queryParams.pressure"
placeholder="请输入压力"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="上报时间" prop="reportTime">
<el-date-picker clearable size="small"
v-model="queryParams.reportTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择上报时间">
</el-date-picker>
</el-form-item>
<el-form-item label="通讯状态" prop="communicationStatus">
<el-select v-model="queryParams.communicationStatus" placeholder="请选择通讯状态" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="设备状态" prop="deviceStatus">
<el-select v-model="queryParams.deviceStatus" placeholder="请选择设备状态" clearable size="small">
<el-option label="请选择字典生成" value="" />
</el-select>
</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="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:data:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:data:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:data:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:data:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="设备上报id" align="center" prop="deviceReportDataId" />
<el-table-column label="设备id" align="center" prop="deviceNum" />
<el-table-column label="标况累计量" align="center" prop="standardConditionAccumulation" />
<el-table-column label="工况累计量" align="center" prop="workingConditionAccumulation" />
<el-table-column label="剩余量" align="center" prop="residualQuantity" />
<el-table-column label="标况流量" align="center" prop="standardConditionFlow" />
<el-table-column label="工况流量" align="center" prop="workingConditionFlow" />
<el-table-column label="温度" align="center" prop="temperature" />
<el-table-column label="压力" align="center" prop="pressure" />
<el-table-column label="上报时间" align="center" prop="reportTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.reportTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="通讯状态" align="center" prop="communicationStatus" />
<el-table-column label="设备状态" align="center" prop="deviceStatus" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:data:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:data:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改设备监控对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="设备id" prop="deviceNum">
<el-input v-model="form.deviceNum" placeholder="请输入设备id" />
</el-form-item>
<el-form-item label="标况累计量" prop="standardConditionAccumulation">
<el-input v-model="form.standardConditionAccumulation" placeholder="请输入标况累计量" />
</el-form-item>
<el-form-item label="工况累计量" prop="workingConditionAccumulation">
<el-input v-model="form.workingConditionAccumulation" placeholder="请输入工况累计量" />
</el-form-item>
<el-form-item label="剩余量" prop="residualQuantity">
<el-input v-model="form.residualQuantity" placeholder="请输入剩余量" />
</el-form-item>
<el-form-item label="标况流量" prop="standardConditionFlow">
<el-input v-model="form.standardConditionFlow" placeholder="请输入标况流量" />
</el-form-item>
<el-form-item label="工况流量" prop="workingConditionFlow">
<el-input v-model="form.workingConditionFlow" placeholder="请输入工况流量" />
</el-form-item>
<el-form-item label="温度" prop="temperature">
<el-input v-model="form.temperature" placeholder="请输入温度" />
</el-form-item>
<el-form-item label="压力" prop="pressure">
<el-input v-model="form.pressure" placeholder="请输入压力" />
</el-form-item>
<el-form-item label="上报时间" prop="reportTime">
<el-date-picker clearable size="small"
v-model="form.reportTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择上报时间">
</el-date-picker>
</el-form-item>
<el-form-item label="通讯状态">
<el-radio-group v-model="form.communicationStatus">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="设备状态">
<el-radio-group v-model="form.deviceStatus">
<el-radio label="1">请选择字典生成</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listData, getData, delData, addData, updateData, exportData } from "@/api/dataMonitoring/reportData";
export default {
name: "Data",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 设备监控表格数据
dataList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
deviceNum: null,
standardConditionAccumulation: null,
workingConditionAccumulation: null,
residualQuantity: null,
standardConditionFlow: null,
workingConditionFlow: null,
temperature: null,
pressure: null,
reportTime: null,
communicationStatus: null,
deviceStatus: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询设备监控列表 */
getList() {
this.loading = true;
listData(this.queryParams).then(response => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
deviceReportDataId: null,
deviceNum: null,
standardConditionAccumulation: null,
workingConditionAccumulation: null,
residualQuantity: null,
standardConditionFlow: null,
workingConditionFlow: null,
temperature: null,
pressure: null,
reportTime: null,
communicationStatus: "0",
deviceStatus: "0",
createTime: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.deviceReportDataId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加设备监控";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const deviceReportDataId = row.deviceReportDataId || this.ids
getData(deviceReportDataId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改设备监控";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.deviceReportDataId != null) {
updateData(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addData(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const deviceReportDataIds = row.deviceReportDataId || this.ids;
this.$confirm('是否确认删除设备监控编号为"' + deviceReportDataIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delData(deviceReportDataIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有设备监控数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportData(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment