Commit 81523b04 authored by 耿迪迪's avatar 耿迪迪

设备监测

parent 6b87fec3
......@@ -62,7 +62,7 @@ spring:
# 端口,默认为6379
port: 6379
# 数据库索引
database: 4
database: 0
# 密码
password:
# 连接超时时间
......
package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 报警器报警记录对象 t_gas_alarm
*
*
* @author zehong
* @date 2024-09-10
* @date 2026-04-16
*/
public class TGasAlarm extends BaseEntity
{
public class TGasAlarm {
private static final long serialVersionUID = 1L;
/** $column.columnComment */
......@@ -27,204 +24,156 @@ public class TGasAlarm extends BaseEntity
private String number;
/** 设备状态 */
@Excel(name = "设备状态")
@Excel(name = "设备状态",dictType = "t_device_status")
private Integer reportStatus;
/** 安装位置 */
@Excel(name = "安装位置")
private String position;
/** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date starttime;
/** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报警结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date endtime;
/** $column.columnComment */
@Excel(name = "上报数值")
private String nd;
@Excel(name = "上报参数")
private String params;
/** $column.columnComment */
private String paramsData;
/** 报警状态 */
@Excel(name = "报警状态",dictType = "t_gas_alarm_status\n")
/** 本次报警状态,0是已结束,1是报警中,2是报警中离线 */
@Excel(name = "本次报警状态",dictType = "t_gas_alarm_status")
private Integer status;
/** 类型 */
@Excel(name = "类型",dictType = "t_gas_alarm_type")
private Integer type;
/** 报警原因 */
/** 报警原因,0是未处置,1是误报,2是真实报警,9是其他原因 */
@Excel(name = "报警原因",dictType = "t_gas_alarm_reason")
private Integer reason;
/** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedAt;
private BigDecimal longitude;
@Excel(name="处置结果")
private String remark;
private BigDecimal latitude;
public void setId(Long id)
public void setId(Long id)
{
this.id = id;
}
public Long getId()
public Long getId()
{
return id;
}
public void setNumber(String number)
public void setNumber(String number)
{
this.number = number;
}
public String getNumber()
public String getNumber()
{
return number;
}
public void setReportStatus(Integer reportStatus)
public void setReportStatus(Integer reportStatus)
{
this.reportStatus = reportStatus;
}
public Integer getReportStatus()
public Integer getReportStatus()
{
return reportStatus;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public void setStarttime(Date starttime)
{
this.starttime = starttime;
}
public Date getStarttime()
public Date getStarttime()
{
return starttime;
}
public void setEndtime(Date endtime)
public void setEndtime(Date endtime)
{
this.endtime = endtime;
}
public Date getEndtime()
public Date getEndtime()
{
return endtime;
}
public void setNd(String nd)
public void setParams(String params)
{
this.nd = nd;
this.params = params;
}
public String getNd()
public String getParams()
{
return nd;
}
public String getParamsData() {
return paramsData;
return params;
}
public void setParamsData(String paramsData) {
this.paramsData = paramsData;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
public Integer getStatus()
{
return status;
}
public void setType(Integer type)
{
this.type = type;
}
public Integer getType()
{
return type;
}
public void setReason(Integer reason)
public void setReason(Integer reason)
{
this.reason = reason;
}
public Integer getReason()
public Integer getReason()
{
return reason;
}
public void setCreatedAt(Date createdAt)
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
public Date getUpdatedAt()
{
return updatedAt;
}
public BigDecimal getLongitude() {
return longitude;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public BigDecimal getLatitude() {
return latitude;
public String getRemark() {
return remark;
}
public void setLatitude(BigDecimal latitude) {
this.latitude = latitude;
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("number", getNumber())
.append("reportStatus", getReportStatus())
.append("starttime", getStarttime())
.append("endtime", getEndtime())
.append("nd", getNd())
.append("params", getParams())
.append("status", getStatus())
.append("type", getType())
.append("reason", getReason())
.append("remark", getRemark())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
.append("id", getId())
.append("number", getNumber())
.append("reportStatus", getReportStatus())
.append("starttime", getStarttime())
.append("endtime", getEndtime())
.append("params", getParams())
.append("status", getStatus())
.append("reason", getReason())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
}
}
......@@ -10,9 +10,9 @@ import com.zehong.common.core.domain.BaseEntity;
/**
* 监测设备数据对象 t_gas_data
*
*
* @author zehong
* @date 2024-03-02
* @date 2026-04-16
*/
public class TGasData extends BaseEntity
{
......@@ -25,59 +25,44 @@ public class TGasData extends BaseEntity
@Excel(name = "设备编号")
private String number;
@Excel(name = "所属厂家",dictType = "t_gas_alarm_type")
private Integer type;
/** 设备类型*/
@Excel(name = "设备类型")
private String type;
/** 所属厂家:1如阳科技,2海康威视 */
@Excel(name = "所属厂家",readConverterExp = "1=如阳科技,2=海康威视")
private Integer company;
/** 安装位置 */
@Excel(name = "安装位置")
private String position;
/** 高报 */
@Excel(name = "高报")
private Long highAlarm;
/** 高高报 */
@Excel(name = "高高报")
private Long highHighAlarm;
/** 低报 */
@Excel(name = "低报")
private Long lowAlarm;
/** 低低报 */
@Excel(name = "低低报")
private Long lowLowAlarm;
/** ccid */
@Excel(name = "ccid")
private String ccid;
/** 量程 */
@Excel(name = "量程")
private String range;
/** imei */
@Excel(name = "imei")
private String imei;
/** 单位 */
@Excel(name = "单位")
private String unit;
/** 位号 */
@Excel(name = "位号")
private String tag;
/** 联系人 */
//@Excel(name = "联系人")
private String contacts;
/** $column.columnComment */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/** $column.columnComment */
@Excel(name = "经度")
private BigDecimal longitude;
/** $column.columnComment */
@Excel(name = "纬度")
private BigDecimal latitude;
private String contacts;
@Excel(name = "联系人")
private String contactsName;
private String contactsTel;
/**上报状态*/
private String reportStatus;
......@@ -87,104 +72,104 @@ public class TGasData extends BaseEntity
/**上报时间*/
private String reportTime;
public void setId(Long id)
public void setId(Long id)
{
this.id = id;
}
public Long getId()
public Long getId()
{
return id;
}
public void setNumber(String number)
public void setCompany(Integer company)
{
this.number = number;
this.company = company;
}
public String getNumber()
public Integer getCompany()
{
return number;
return company;
}
public void setPosition(String position)
public void setType(String type)
{
this.position = position;
this.type = type;
}
public String getPosition()
public String getType()
{
return position;
return type;
}
public void setHighAlarm(Long highAlarm)
public void setNumber(String number)
{
this.highAlarm = highAlarm;
this.number = number;
}
public Long getHighAlarm()
public String getNumber()
{
return highAlarm;
return number;
}
public void setHighHighAlarm(Long highHighAlarm)
public void setPosition(String position)
{
this.highHighAlarm = highHighAlarm;
this.position = position;
}
public Long getHighHighAlarm()
public String getPosition()
{
return highHighAlarm;
return position;
}
public void setLowAlarm(Long lowAlarm)
public void setCcid(String ccid)
{
this.lowAlarm = lowAlarm;
this.ccid = ccid;
}
public Long getLowAlarm()
public String getCcid()
{
return lowAlarm;
return ccid;
}
public void setLowLowAlarm(Long lowLowAlarm)
public void setImei(String imei)
{
this.lowLowAlarm = lowLowAlarm;
this.imei = imei;
}
public Long getLowLowAlarm()
public String getImei()
{
return lowLowAlarm;
return imei;
}
public void setRange(String range)
public void setContacts(String contacts)
{
this.range = range;
this.contacts = contacts;
}
public String getRange()
public String getContacts()
{
return range;
return contacts;
}
public void setUnit(String unit)
public void setCreatedAt(Date createdAt)
{
this.unit = unit;
this.createdAt = createdAt;
}
public String getUnit()
public Date getCreatedAt()
{
return unit;
return createdAt;
}
public void setTag(String tag)
public void setLongitude(BigDecimal longitude)
{
this.tag = tag;
this.longitude = longitude;
}
public String getTag()
public BigDecimal getLongitude()
{
return tag;
return longitude;
}
public void setCreatedAt(Date createdAt)
public void setLatitude(BigDecimal latitude)
{
this.createdAt = createdAt;
this.latitude = latitude;
}
public Date getCreatedAt()
public BigDecimal getLatitude()
{
return createdAt;
return latitude;
}
public String getReportStatus() {
......@@ -211,68 +196,21 @@ public class TGasData extends BaseEntity
this.reportTime = reportTime;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public BigDecimal getLongitude() {
return longitude;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public BigDecimal getLatitude() {
return latitude;
}
public void setLatitude(BigDecimal latitude) {
this.latitude = latitude;
}
public String getContacts() {
return contacts;
}
public void setContacts(String contacts) {
this.contacts = contacts;
}
public String getContactsName() {
return contactsName;
}
public void setContactsName(String contactsName) {
this.contactsName = contactsName;
}
public String getContactsTel() {
return contactsTel;
}
public void setContactsTel(String contactsTel) {
this.contactsTel = contactsTel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("number", getNumber())
.append("position", getPosition())
.append("highAlarm", getHighAlarm())
.append("highHighAlarm", getHighHighAlarm())
.append("lowAlarm", getLowAlarm())
.append("lowLowAlarm", getLowLowAlarm())
.append("range", getRange())
.append("unit", getUnit())
.append("tag", getTag())
.append("createdAt", getCreatedAt())
.toString();
.append("id", getId())
.append("company", getCompany())
.append("type", getType())
.append("number", getNumber())
.append("position", getPosition())
.append("ccid", getCcid())
.append("imei", getImei())
.append("remark", getRemark())
.append("contacts", getContacts())
.append("createdAt", getCreatedAt())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.toString();
}
}
......@@ -74,29 +74,13 @@ public class TGasAlarmServiceImpl implements ITGasAlarmService
* @return 结果
*/
@Override
public int updateTGasAlarm(TGasAlarm tGasAlarm)
{
if(2 == tGasAlarm.getType()){
tGasAlarm.setEndtime(new Date());
tGasAlarm.setStatus(0);
}
public int updateTGasAlarm(TGasAlarm tGasAlarm) {
int i = tGasAlarmMapper.updateTGasAlarm(tGasAlarm);
if(i >0 && null != tGasAlarm.getReason() && !StringUtils.isEmpty(tGasAlarm.getRemark())){
//2为安博汇设备特殊处理
if(2 == tGasAlarm.getType()){
if(!StringUtils.isEmpty(tGasAlarm.getNumber())){
redisCache.redisTemplate.opsForHash().delete("alarm_id",tGasAlarm.getNumber());
if(null == redisCache.getCacheMapValue("alarm_id",tGasAlarm.getNumber())){
redisCache.redisTemplate.opsForHash().delete("gas_warning",String.valueOf(tGasAlarm.getId()));
}
}
}else{
JSONObject alarmInfo = redisCache.getCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()));
if(null != alarmInfo){
alarmInfo.put("reason",tGasAlarm.getReason());
redisCache.setCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()),alarmInfo);
}
JSONObject alarmInfo = redisCache.getCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()));
if(null != alarmInfo){
alarmInfo.put("reason",tGasAlarm.getReason());
redisCache.setCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()),alarmInfo);
}
}
return i;
......
......@@ -5,6 +5,7 @@ import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.core.redis.RedisCache;
import com.zehong.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TGasDataMapper;
......@@ -33,9 +34,17 @@ public class TGasDataServiceImpl implements ITGasDataService
* @return 监测设备数据
*/
@Override
public TGasData selectTGasDataById(Long id)
{
return tGasDataMapper.selectTGasDataById(id);
public TGasData selectTGasDataById(Long id) {
TGasData data = tGasDataMapper.selectTGasDataById(id);
if(StringUtils.isNotEmpty(data.getNumber())){
JSONObject gasData = redisCache.getCacheMapValue("devices_report",data.getNumber());
if(null != gasData){
data.setReportStatus(gasData.getString("status"));
data.setReportParam(gasData.getString("values"));
data.setReportTime(gasData.getString("time"));
}
}
return data;
}
/**
......@@ -51,7 +60,7 @@ public class TGasDataServiceImpl implements ITGasDataService
JSONObject gasData = redisCache.getCacheMapValue("devices_report",item.getNumber());
if(null != gasData){
item.setReportStatus(gasData.getString("status"));
item.setReportParam(gasData.getString("value") + item.getUnit());
item.setReportParam(gasData.getString("values"));
item.setReportTime(gasData.getString("time"));
}
});
......
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TGasAlarmMapper">
<resultMap type="TGasAlarm" id="TGasAlarmResult">
<result property="id" column="id" />
<result property="number" column="number" />
<result property="reportStatus" column="report_status" />
<result property="position" column="position" />
<result property="starttime" column="starttime" />
<result property="endtime" column="endtime" />
<result property="nd" column="nd" />
<result property="paramsData" column="params" />
<result property="params" column="params" />
<result property="status" column="status" />
<result property="type" column="type" />
<result property="reason" column="reason" />
<result property="remark" column="remark" />
<result property="createdAt" column="created_at" />
......@@ -22,76 +19,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTGasAlarmVo">
SELECT
alarm.id,
alarm.number,
alarm.report_status,
alarm.position,
alarm.starttime,
alarm.endtime,
alarm.nd,
alarm.params,
alarm.status,
alarm.type,
alarm.reason,
alarm.remark,
alarm.created_at,
alarm.updated_at,
gas.longitude,
gas.latitude
FROM
t_gas_alarm alarm
LEFT JOIN t_gas_data gas ON gas.number = alarm.number
select id, number, report_status, starttime, endtime, params, status, reason, remark, created_at, updated_at from t_gas_alarm
</sql>
<select id="selectTGasAlarmList" parameterType="TGasAlarm" resultMap="TGasAlarmResult">
<include refid="selectTGasAlarmVo"/>
<where>
<if test="number != null and number != ''"> and alarm.number like concat('%', #{number}, '%')</if>
<if test="status != null "> and alarm.status = #{status}</if>
<if test="type != null "> and alarm.type = #{type}</if>
<if test="reason != null "> and alarm.reason = #{reason}</if>
<where>
<if test="number != null and number != ''"> and number like concat('%', #{number}, '%')</if>
<if test="reportStatus != null "> and report_status = #{reportStatus}</if>
<if test="starttime != null "> and starttime = #{starttime}</if>
<if test="endtime != null "> and endtime = #{endtime}</if>
<if test="params != null and params != ''"> and params = #{params}</if>
<if test="status != null "> and status = #{status}</if>
<if test="reason != null "> and reason = #{reason}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where>
order by alarm.starttime desc
</select>
<select id="selectTGasAlarmById" parameterType="Long" resultMap="TGasAlarmResult">
<include refid="selectTGasAlarmVo"/>
where alarm.id = #{id}
where id = #{id}
</select>
<insert id="insertTGasAlarm" parameterType="TGasAlarm" useGeneratedKeys="true" keyProperty="id">
insert into t_gas_alarm
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="number != null">number,</if>
<if test="reportStatus != null">report_status,</if>
<if test="position != null">`position`,</if>
<if test="starttime != null">starttime,</if>
<if test="endtime != null">endtime,</if>
<if test="nd != null">nd,</if>
<if test="paramsData != null">params,</if>
<if test="params != null">params,</if>
<if test="status != null">status,</if>
<if test="type != null">type,</if>
<if test="reason != null">reason,</if>
<if test="remark != null">remark,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="number != null">#{number},</if>
<if test="reportStatus != null">#{reportStatus},</if>
<if test="position != null">#{position},</if>
<if test="starttime != null">#{starttime},</if>
<if test="endtime != null">#{endtime},</if>
<if test="nd != null">#{nd},</if>
<if test="paramsData != null">#{paramsData},</if>
<if test="params != null">#{params},</if>
<if test="status != null">#{status},</if>
<if test="type != null">#{type},</if>
<if test="reason != null">#{reason},</if>
<if test="remark != null">#{remark},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
</trim>
</trim>
</insert>
<update id="updateTGasAlarm" parameterType="TGasAlarm">
......@@ -99,13 +75,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="number != null">number = #{number},</if>
<if test="reportStatus != null">report_status = #{reportStatus},</if>
<if test="position != null">`position` = #{position},</if>
<if test="starttime != null">starttime = #{starttime},</if>
<if test="endtime != null">endtime = #{endtime},</if>
<if test="nd != null">nd = #{nd},</if>
<if test="paramsData != null">params = #{paramsData},</if>
<if test="params != null">params = #{params},</if>
<if test="status != null">status = #{status},</if>
<if test="type != null">type = #{type},</if>
<if test="reason != null">reason = #{reason},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
......@@ -119,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteTGasAlarmByIds" parameterType="String">
delete from t_gas_alarm where id in
delete from t_gas_alarm where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
......
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TGasDataMapper">
<resultMap type="TGasData" id="TGasDataResult">
<result property="id" column="id" />
<result property="number" column="number" />
<result property="company" column="company" />
<result property="type" column="type" />
<result property="number" column="number" />
<result property="position" column="position" />
<result property="highAlarm" column="high_alarm" />
<result property="highHighAlarm" column="high_high_alarm" />
<result property="lowAlarm" column="low_alarm" />
<result property="lowLowAlarm" column="low_low_alarm" />
<result property="range" column="range" />
<result property="unit" column="unit" />
<result property="tag" column="tag" />
<result property="ccid" column="ccid" />
<result property="imei" column="imei" />
<result property="remark" column="remark" />
<result property="contacts" column="contacts" />
<result property="createdAt" column="created_at" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="contacts" column="contacts" />
</resultMap>
<sql id="selectTGasDataVo">
SELECT
id,
number,
type,
position,
high_alarm,
high_high_alarm,
low_alarm,
low_low_alarm,
`range`,
unit,
tag,
created_at,
longitude,
latitude,
contacts,
(select GROUP_CONCAT(nick_name) from sys_user where find_in_set(user_id,contacts)) as contactsName,
(select GROUP_CONCAT(NULLIF(phonenumber, '')) from sys_user where find_in_set(user_id,contacts)) as contactsTel
FROM
t_gas_data
select id, company, type, number, position, ccid, imei, remark, contacts, created_at, longitude, latitude from t_gas_data
</sql>
<select id="selectTGasDataList" parameterType="TGasData" resultMap="TGasDataResult">
<include refid="selectTGasDataVo"/>
<where>
<if test="number != null and number != ''"> and number like concat('%', #{number}, '%')</if>
<where>
<if test="company != null "> and company = #{company}</if>
<if test="type != null "> and type = #{type}</if>
<if test="number != null and number != ''"> and number like concat('%', #{number}, '%')</if>
<if test="position != null and position != ''"> and position like concat('%', #{position}, '%')</if>
<if test="highAlarm != null "> and high_alarm = #{highAlarm}</if>
<if test="highHighAlarm != null "> and high_high_alarm = #{highHighAlarm}</if>
<if test="lowAlarm != null "> and low_alarm = #{lowAlarm}</if>
<if test="lowLowAlarm != null "> and low_low_alarm = #{lowLowAlarm}</if>
<if test="range != null and range != ''"> and range = #{range}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="tag != null and tag != ''"> and tag = #{tag}</if>
<if test="ccid != null and ccid != ''"> and ccid = #{ccid}</if>
<if test="imei != null and imei != ''"> and imei = #{imei}</if>
<if test="contacts != null and contacts != ''"> and contacts = #{contacts}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
</where>
</select>
<select id="selectTGasDataById" parameterType="Long" resultMap="TGasDataResult">
<include refid="selectTGasDataVo"/>
where id = #{id}
</select>
<insert id="insertTGasData" parameterType="TGasData" useGeneratedKeys="true" keyProperty="id">
insert into t_gas_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="number != null">number,</if>
<if test="company != null">company,</if>
<if test="type != null">type,</if>
<if test="number != null">number,</if>
<if test="position != null">position,</if>
<if test="highAlarm != null">high_alarm,</if>
<if test="highHighAlarm != null">high_high_alarm,</if>
<if test="lowAlarm != null">low_alarm,</if>
<if test="lowLowAlarm != null">low_low_alarm,</if>
<if test="range != null">range,</if>
<if test="unit != null">unit,</if>
<if test="tag != null">tag,</if>
<if test="ccid != null">ccid,</if>
<if test="imei != null">imei,</if>
<if test="remark != null">remark,</if>
<if test="contacts != null">contacts,</if>
<if test="createdAt != null">created_at,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="contacts != null">contacts,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="number != null">#{number},</if>
<if test="company != null">#{company},</if>
<if test="type != null">#{type},</if>
<if test="number != null">#{number},</if>
<if test="position != null">#{position},</if>
<if test="highAlarm != null">#{highAlarm},</if>
<if test="highHighAlarm != null">#{highHighAlarm},</if>
<if test="lowAlarm != null">#{lowAlarm},</if>
<if test="lowLowAlarm != null">#{lowLowAlarm},</if>
<if test="range != null">#{range},</if>
<if test="unit != null">#{unit},</if>
<if test="tag != null">#{tag},</if>
<if test="ccid != null">#{ccid},</if>
<if test="imei != null">#{imei},</if>
<if test="remark != null">#{remark},</if>
<if test="contacts != null">#{contacts},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="contacts != null">#{contacts},</if>
</trim>
</trim>
</insert>
<update id="updateTGasData" parameterType="TGasData">
update t_gas_data
<trim prefix="SET" suffixOverrides=",">
<if test="number != null">number = #{number},</if>
<if test="company != null">company = #{company},</if>
<if test="type != null">type = #{type},</if>
<if test="number != null">number = #{number},</if>
<if test="position != null">position = #{position},</if>
<if test="highAlarm != null">high_alarm = #{highAlarm},</if>
<if test="highHighAlarm != null">high_high_alarm = #{highHighAlarm},</if>
<if test="lowAlarm != null">low_alarm = #{lowAlarm},</if>
<if test="lowLowAlarm != null">low_low_alarm = #{lowLowAlarm},</if>
<if test="range != null">range = #{range},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="tag != null">tag = #{tag},</if>
<if test="ccid != null">ccid = #{ccid},</if>
<if test="imei != null">imei = #{imei},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="contacts != null">contacts = #{contacts},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="contacts != null">contacts = #{contacts},</if>
</trim>
where id = #{id}
</update>
......@@ -129,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteTGasDataByIds" parameterType="String">
delete from t_gas_data where id in
delete from t_gas_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
......
......@@ -11,17 +11,11 @@
<el-col :span="12">
<el-form-item label="设备状态">
<span v-if="detailInfo.reportStatus">{{ detailInfo.reportStatus }}</span>
<span v-if="detailInfo.reportStatus">{{ $parent.deviceStatusFormat(detailInfo) }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="安装位置">
<span v-if="detailInfo.position">{{ detailInfo.position }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报警开始时间">
......@@ -38,8 +32,8 @@
</el-col>
<el-col :span="12">
<el-form-item label="上报数值">
<span v-if="detailInfo.nd">{{ detailInfo.nd }}</span>
<el-form-item label="上报参数">
<span v-if="detailInfo.params">{{ detailInfo.params }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
......@@ -50,15 +44,9 @@
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属厂家">
<span v-if="detailInfo.type">{{ $parent.typeFormat(detailInfo) }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="处置类型">
<span v-if="detailInfo.reason">{{ $parent.reasonFormat(detailInfo) }}</span>
<span v-if="detailInfo.reason+ ''">{{ $parent.reasonFormat(detailInfo) }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
......
......@@ -20,16 +20,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="所属厂家" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择所属厂家" clearable size="small">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="处置类型" prop="reason">
<el-select v-model="queryParams.reason" placeholder="请选择处置类型" clearable size="small">
<el-option
......@@ -97,7 +87,6 @@
<!--<el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="设备编号" align="center" prop="number" />
<el-table-column label="设备状态" align="center" prop="reportStatus" :formatter="deviceStatusFormat"/>
<el-table-column label="安装位置" align="center" prop="position" :show-overflow-tooltip="true"/>
<el-table-column label="报警开始时间" align="center" prop="starttime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
......@@ -109,9 +98,8 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="上报数值" align="center" prop="nd" />
<el-table-column label="上报参数" align="center" prop="params" :show-overflow-tooltip="true"/>
<el-table-column label="报警状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="所属厂家" align="center" prop="type" :formatter="typeFormat" />
<el-table-column label="处置类型" align="center" prop="reason" :formatter="reasonFormat" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
......@@ -326,6 +314,7 @@ export default {
},
// 报警原因字典翻译
reasonFormat(row, column) {
console.log("=======",row)
const reason = this.selectDictLabel(this.reasonOptions, row.reason);
return reason ? reason : '-';
},
......
......@@ -11,74 +11,46 @@
</el-col>
<el-col :span="12">
<el-form-item label="所属厂家">
<span v-if="detailInfo.type">{{ $parent.typeFormat(detailInfo) }}</span>
<el-form-item label="设备类型">
<span v-if="detailInfo.type">{{ detailInfo.type }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="位号">
<span>{{ detailInfo.tag }}</span>
<el-form-item label="所属厂家">
<span v-if="detailInfo.company">{{ $parent.companyFormat(detailInfo) }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-col :span="12">
<el-form-item label="安装位置">
<span>{{ detailInfo.position }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="高报">
<span v-if="detailInfo.highAlarm">{{ detailInfo.highAlarm }}</span>
<el-form-item label="上报状态">
<span v-if="detailInfo.reportStatus">{{ $parent.deviceStatusFormat(detailInfo) }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="高高报">
<span v-if="detailInfo.highHighAlarm">{{ detailInfo.highHighAlarm }}</span>
<el-form-item label="上报时间">
<span v-if="detailInfo.reportTime">{{ detailInfo.reportTime }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="低报">
<span v-if="detailInfo.lowAlarm">{{ detailInfo.lowAlarm }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="低低报">
<span v-if="detailInfo.lowLowAlarm">{{ detailInfo.lowLowAlarm }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="量程">
<span v-if="detailInfo.range">{{ detailInfo.range }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位">
<span v-if="detailInfo.unit">{{ detailInfo.unit }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人">
<span v-if="detailInfo.contactsName">{{ detailInfo.contactsName }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="创建时间">
<span v-if="detailInfo.createdAt">{{ detailInfo.createdAt }}</span>
<el-col :span="24">
<el-form-item label="上报参数">
<span v-if="detailInfo.reportParam">{{ detailInfo.reportParam }}</span>
<span v-else>-</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-col>
......
......@@ -11,8 +11,8 @@
/>
</el-form-item>
<el-form-item label="所属厂家" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择所属厂家" clearable size="small">
<el-form-item label="所属厂家" prop="company">
<el-select v-model="queryParams.company" placeholder="请选择所属厂家" clearable size="small">
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
......@@ -22,16 +22,6 @@
</el-select>
</el-form-item>
<el-form-item label="位号" prop="tag">
<el-input
v-model="queryParams.tag"
placeholder="请输入位号"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="安装位置" prop="position">
<el-input
v-model="queryParams.position"
......@@ -48,7 +38,7 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!--<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
......@@ -56,7 +46,7 @@
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['gas:data:add']"
v-hasPermi="['system:data:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
......@@ -67,7 +57,7 @@
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['gas:data:edit']"
v-hasPermi="['system:data:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
......@@ -78,7 +68,7 @@
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['gas:data:remove']"
v-hasPermi="['system:data:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
......@@ -87,19 +77,19 @@
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['gas:data:export']"
v-hasPermi="['system:data:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</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="设备编号" align="center" prop="number" />
<el-table-column label="所属厂家" align="center" prop="type" :formatter="typeFormat" />
<el-table-column label="位号" align="center" prop="tag" :show-overflow-tooltip="true"/>
<el-table-column label="设备类型" align="center" prop="type" />
<el-table-column label="所属厂家" align="center" prop="company" :formatter="companyFormat" />
<el-table-column label="安装位置" align="center" prop="position" :show-overflow-tooltip="true" width="300"/>
<el-table-column label="上报状态" align="center" prop="reportStatus">
<template slot-scope="scope">
......@@ -117,7 +107,7 @@
<span v-else >{{ deviceStatusFormat(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="上报参数" align="center" prop="reportParam">
<el-table-column label="上报参数" align="center" prop="reportParam" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.reportParam">{{scope.row.reportParam}}</span>
<span v-else></span>
......@@ -137,20 +127,20 @@
icon="el-icon-document"
@click="handleDetail(scope.row)"
>详情</el-button>
<el-button
<!--<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['gas:data:edit']"
v-hasPermi="['system:data:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['gas:data:remove']"
>删除</el-button>
v-hasPermi="['system:data:remove']"
>删除</el-button>-->
</template>
</el-table-column>
</el-table>
......@@ -164,117 +154,43 @@
/>
<!-- 添加或修改监测设备数据对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body destroy-on-close :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="设备编号" prop="number">
<el-input v-model="form.number" placeholder="请输入设备编号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属厂家" prop="type">
<el-select
v-model="form.type"
placeholder="请选择所属厂家"
size="small"
style="width: 100%"
>
<el-option
v-for="dict in typeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="位号" prop="tag">
<el-input v-model="form.tag" placeholder="请输入位号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="高报" prop="highAlarm">
<el-input v-model="form.highAlarm" placeholder="请输入高报" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="低报" prop="lowAlarm">
<el-input v-model="form.lowAlarm" placeholder="请输入低报" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="低低报" prop="lowLowAlarm">
<el-input v-model="form.lowLowAlarm" placeholder="请输入低低报" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="量程" prop="range">
<el-input v-model="form.range" placeholder="请输入量程" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-input v-model="form.unit" placeholder="请输入单位" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="安装位置" prop="position">
<el-input v-model="form.position" placeholder="请输入安装位置" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="经纬度坐标" prop="longitude">
<el-col :span="8">
<el-input v-model="form.longitude" placeholder="请输入经度"/>
</el-col>
<el-col :span="8" style="margin-left: 20px">
<el-input v-model="form.latitude" placeholder="请输入纬度"/>
</el-col>
<el-col :span="4" style="margin-left: 30px">
<el-button type="primary" plain @click="MapdialogFun">选择经纬度</el-button>
</el-col>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="联系人" prop="contacts">
<el-select
v-model="contacts"
multiple
placeholder="请选择联系人"
style="width: 100%"
@change="changeContacts"
>
<el-option
v-for="user in userList"
:key="user.userId"
:label="user.nickName"
:value="user.userId"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<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="设备编号" prop="number">
<el-input v-model="form.number" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="安装位置" prop="position">
<el-input v-model="form.position" placeholder="请输入安装位置" />
</el-form-item>
<el-form-item label="高报" prop="highAlarm">
<el-input v-model="form.highAlarm" placeholder="请输入高报" />
</el-form-item>
<el-form-item label="高高报" prop="highHighAlarm">
<el-input v-model="form.highHighAlarm" placeholder="请输入高高报" />
</el-form-item>
<el-form-item label="低报" prop="lowAlarm">
<el-input v-model="form.lowAlarm" placeholder="请输入低报" />
</el-form-item>
<el-form-item label="低低报" prop="lowLowAlarm">
<el-input v-model="form.lowLowAlarm" placeholder="请输入低低报" />
</el-form-item>
<el-form-item label="量程" prop="range">
<el-input v-model="form.range" placeholder="请输入量程" />
</el-form-item>
<el-form-item label="单位" prop="unit">
<el-input v-model="form.unit" placeholder="请输入单位" />
</el-form-item>
<el-form-item label="位号" prop="tag">
<el-input v-model="form.tag" placeholder="请输入位号" />
</el-form-item>
<el-form-item label="位号" prop="createdAt">
<el-date-picker clearable size="small"
v-model="form.createdAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择位号">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
......@@ -285,212 +201,162 @@
<!-- 详情 -->
<DetailInfo ref="detailInfo"/>
<!-- 地图 -->
<GetPos
:dialogVisible.sync="dialogTableVisibles"
:devicePos="devicePos"
@close="dialogcancelFun"
@getPath="getPath"
style="z-index: 3000"
ref="getPos"
/>
</div>
</template>
<script>
import { listData, getData, delData, addData, updateData, exportData } from "@/api/gasdata/data";
import DetailInfo from "./components/DetailInfo";
import GetPos from '@/components/GetPos';
import { userInfoList } from "@/api/system/user";
export default {
name: "Data",
components: {
DetailInfo,
GetPos,
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
numbers: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 监测设备数据表格数据
dataList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
number: null,
position: null,
highAlarm: null,
highHighAlarm: null,
lowAlarm: null,
lowLowAlarm: null,
range: null,
unit: null,
tag: null,
createdAt: null
},
// 表单参数
form: {},
// 表单校验
rules: {
number: [
{ required: true, message: "设备编号不能为空", trigger: "blur" }
],
type: [
{ required: true, message: "所属厂家不能为空", trigger: "blur" }
],
longitude: [
{ required: true, message: "经纬度不能为空", trigger: "blur" }
],
contacts: [
{ required: true, message: "联系人不能为空", trigger: "blur" }
],
},
deviceStatus: [],
typeOptions: [],
dialogTableVisibles: false,
devicePos: [],
userList: [],
//联系人数组
contacts: []
};
},
created() {
this.getList();
this.getDicts("t_device_status").then(response => {
import { listData, getData, delData, addData, updateData, exportData } from "@/api/gasdata/data";
import DetailInfo from "./components/DetailInfo";
export default {
name: "Data",
components: {
DetailInfo
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 监测设备数据表格数据
dataList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
company: null,
number: null,
position: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
},
deviceStatus: [],
typeOptions: []
};
},
created() {
this.getList();
this.getDicts("t_device_status").then(response => {
this.deviceStatus = response.data;
});
this.getDicts("t_gas_alarm_type").then(response => {
this.getDicts("t_gas_alarm_type").then(response => {
this.typeOptions = response.data;
});
},
methods: {
/** 查询监测设备数据列表 */
getList() {
this.loading = true;
listData(this.queryParams).then(response => {
this.dataList = response.rows;
},
methods: {
/** 查询监测设备数据列表 */
getList() {
this.loading = true;
listData(this.queryParams).then(response => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
deviceStatusFormat(row, column) {
const deviceStatus = this.selectDictLabel(this.deviceStatus, row.reportStatus);
return deviceStatus ? deviceStatus : "-";
},
//所属厂家 1泽宏,2安博汇,3费加罗
typeFormat(row, column) {
const type = this.selectDictLabel(this.typeOptions, row.type);
return type ? type : "-";
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
number: null,
position: null,
highAlarm: null,
highHighAlarm: null,
lowAlarm: null,
lowLowAlarm: null,
range: null,
unit: null,
tag: null,
createdAt: null
};
this.devicePos = [];
this.contacts = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.numbers = selection.map(item => item.number);
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.getUserInfo();
this.open = true;
this.title = "添加监测设备数据";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getData(id).then(response => {
this.form = response.data;
if(this.form.longitude){
this.devicePos = [this.form.longitude,this.form.latitude];
}
if(this.form.contacts){
this.contacts = this.form.contacts.split(",");
}
this.getUserInfo();
},
deviceStatusFormat(row, column) {
const deviceStatus = this.selectDictLabel(this.deviceStatus, row.reportStatus);
return deviceStatus ? deviceStatus : "-";
},
//所属厂家 1如阳科技,2海康威视
companyFormat(row, column) {
const company = this.selectDictLabel(this.typeOptions, row.company);
return company ? company : "-";
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
number: null,
position: null,
highAlarm: null,
highHighAlarm: null,
lowAlarm: null,
lowLowAlarm: null,
range: null,
unit: null,
tag: null,
createdAt: 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.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加监测设备数据";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getData(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改监测设备数据";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateData(this.form).then(response => {
this.msgSuccess("修改成功");
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateData(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addData(this.form).then(response => {
this.msgSuccess("新增成功");
} else {
addData(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
const numbers = row.number || this.numbers;
this.$confirm('是否确认删除监测设备数据编号为"' + numbers + '"的数据项?', "警告", {
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除监测设备数据编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
......@@ -498,59 +364,28 @@ export default {
return delData(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有监测设备数据数据项?', "警告", {
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有监测设备数据数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportData(queryParams);
}).then(response => {
return exportData(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
/**详情*/
handleDetail(row){
this.$refs.detailInfo.openDetail(row.id);
},
/**
* 经纬度坐标方法
*/
MapdialogFun() {
this.dialogTableVisibles = true;
},
/**
* 地图关闭方法
*/
dialogcancelFun() {
this.dialogTableVisibles = false;
},
/**
* 经纬度 选择
* @param res
*/
getPath(res){
//确认选择经纬度
this.form.longitude = res[0];
this.form.latitude = res[1];
},
getUserInfo(){
userInfoList().then(res =>{
if(res.code == 200){
this.userList = res.data;
}
})
},
changeContacts(val){
this.form.contacts = val.join(",");
this.exportLoading = false;
}).catch(() => {});
},
/**详情*/
handleDetail(row){
this.$refs.detailInfo.openDetail(row.id);
}
}
}
};
};
</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