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

设备监测

parent 6b87fec3
...@@ -62,7 +62,7 @@ spring: ...@@ -62,7 +62,7 @@ spring:
# 端口,默认为6379 # 端口,默认为6379
port: 6379 port: 6379
# 数据库索引 # 数据库索引
database: 4 database: 0
# 密码 # 密码
password: password:
# 连接超时时间 # 连接超时时间
......
package com.zehong.system.domain; package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; 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.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import java.math.BigDecimal; import com.zehong.common.core.domain.BaseEntity;
import java.util.Date;
/** /**
* 报警器报警记录对象 t_gas_alarm * 报警器报警记录对象 t_gas_alarm
* *
* @author zehong * @author zehong
* @date 2024-09-10 * @date 2026-04-16
*/ */
public class TGasAlarm extends BaseEntity public class TGasAlarm {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /** $column.columnComment */
...@@ -27,53 +24,43 @@ public class TGasAlarm extends BaseEntity ...@@ -27,53 +24,43 @@ public class TGasAlarm extends BaseEntity
private String number; private String number;
/** 设备状态 */ /** 设备状态 */
@Excel(name = "设备状态") @Excel(name = "设备状态",dictType = "t_device_status")
private Integer reportStatus; private Integer reportStatus;
/** 安装位置 */
@Excel(name = "安装位置")
private String position;
/** $column.columnComment */ /** $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") @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date starttime; private Date starttime;
/** $column.columnComment */ /** $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") @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date endtime; private Date endtime;
/** $column.columnComment */ /** $column.columnComment */
@Excel(name = "上报数值") @Excel(name = "上报参数")
private String nd; private String params;
/** $column.columnComment */ /** 本次报警状态,0是已结束,1是报警中,2是报警中离线 */
private String paramsData; @Excel(name = "本次报警状态",dictType = "t_gas_alarm_status")
/** 报警状态 */
@Excel(name = "报警状态",dictType = "t_gas_alarm_status\n")
private Integer status; private Integer status;
/** 类型 */ /** 报警原因,0是未处置,1是误报,2是真实报警,9是其他原因 */
@Excel(name = "类型",dictType = "t_gas_alarm_type")
private Integer type;
/** 报警原因 */
@Excel(name = "报警原因",dictType = "t_gas_alarm_reason") @Excel(name = "报警原因",dictType = "t_gas_alarm_reason")
private Integer reason; private Integer reason;
/** $column.columnComment */ /** $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; private Date createdAt;
/** $column.columnComment */ /** $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 Date updatedAt;
private BigDecimal longitude; @Excel(name="处置结果")
private String remark;
private BigDecimal latitude;
public void setId(Long id) public void setId(Long id)
{ {
...@@ -102,15 +89,6 @@ public class TGasAlarm extends BaseEntity ...@@ -102,15 +89,6 @@ public class TGasAlarm extends BaseEntity
{ {
return reportStatus; return reportStatus;
} }
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public void setStarttime(Date starttime) public void setStarttime(Date starttime)
{ {
this.starttime = starttime; this.starttime = starttime;
...@@ -129,24 +107,15 @@ public class TGasAlarm extends BaseEntity ...@@ -129,24 +107,15 @@ public class TGasAlarm extends BaseEntity
{ {
return endtime; 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; return params;
}
public String getParamsData() {
return paramsData;
}
public void setParamsData(String paramsData) {
this.paramsData = paramsData;
} }
public void setStatus(Integer status) public void setStatus(Integer status)
{ {
this.status = status; this.status = status;
...@@ -156,15 +125,6 @@ public class TGasAlarm extends BaseEntity ...@@ -156,15 +125,6 @@ public class TGasAlarm extends BaseEntity
{ {
return status; 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; this.reason = reason;
...@@ -193,20 +153,12 @@ public class TGasAlarm extends BaseEntity ...@@ -193,20 +153,12 @@ public class TGasAlarm extends BaseEntity
return updatedAt; return updatedAt;
} }
public BigDecimal getLongitude() { public String getRemark() {
return longitude; return remark;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public BigDecimal getLatitude() {
return latitude;
} }
public void setLatitude(BigDecimal latitude) { public void setRemark(String remark) {
this.latitude = latitude; this.remark = remark;
} }
@Override @Override
...@@ -217,12 +169,9 @@ public class TGasAlarm extends BaseEntity ...@@ -217,12 +169,9 @@ public class TGasAlarm extends BaseEntity
.append("reportStatus", getReportStatus()) .append("reportStatus", getReportStatus())
.append("starttime", getStarttime()) .append("starttime", getStarttime())
.append("endtime", getEndtime()) .append("endtime", getEndtime())
.append("nd", getNd())
.append("params", getParams()) .append("params", getParams())
.append("status", getStatus()) .append("status", getStatus())
.append("type", getType())
.append("reason", getReason()) .append("reason", getReason())
.append("remark", getRemark())
.append("createdAt", getCreatedAt()) .append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt()) .append("updatedAt", getUpdatedAt())
.toString(); .toString();
......
...@@ -12,7 +12,7 @@ import com.zehong.common.core.domain.BaseEntity; ...@@ -12,7 +12,7 @@ import com.zehong.common.core.domain.BaseEntity;
* 监测设备数据对象 t_gas_data * 监测设备数据对象 t_gas_data
* *
* @author zehong * @author zehong
* @date 2024-03-02 * @date 2026-04-16
*/ */
public class TGasData extends BaseEntity public class TGasData extends BaseEntity
{ {
...@@ -25,59 +25,44 @@ public class TGasData extends BaseEntity ...@@ -25,59 +25,44 @@ public class TGasData extends BaseEntity
@Excel(name = "设备编号") @Excel(name = "设备编号")
private String number; 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 = "安装位置") @Excel(name = "安装位置")
private String position; private String position;
/** 高报 */ /** ccid */
@Excel(name = "高报") @Excel(name = "ccid")
private Long highAlarm; private String ccid;
/** 高高报 */
@Excel(name = "高高报")
private Long highHighAlarm;
/** 低报 */
@Excel(name = "低报")
private Long lowAlarm;
/** 低低报 */
@Excel(name = "低低报")
private Long lowLowAlarm;
/** 量程 */ /** imei */
@Excel(name = "量程") @Excel(name = "imei")
private String range; private String imei;
/** 单位 */ /** 联系人 */
@Excel(name = "单位") //@Excel(name = "联系人")
private String unit; private String contacts;
/** 位号 */
@Excel(name = "位号")
private String tag;
/** $column.columnComment */ /** $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") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdAt; private Date createdAt;
/** $column.columnComment */
@Excel(name = "经度") @Excel(name = "经度")
private BigDecimal longitude; private BigDecimal longitude;
/** $column.columnComment */
@Excel(name = "纬度") @Excel(name = "纬度")
private BigDecimal latitude; private BigDecimal latitude;
private String contacts;
@Excel(name = "联系人")
private String contactsName;
private String contactsTel;
/**上报状态*/ /**上报状态*/
private String reportStatus; private String reportStatus;
...@@ -96,95 +81,95 @@ public class TGasData extends BaseEntity ...@@ -96,95 +81,95 @@ public class TGasData extends BaseEntity
{ {
return id; 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() { public String getReportStatus() {
...@@ -211,68 +196,21 @@ public class TGasData extends BaseEntity ...@@ -211,68 +196,21 @@ public class TGasData extends BaseEntity
this.reportTime = reportTime; 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 @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("company", getCompany())
.append("type", getType())
.append("number", getNumber()) .append("number", getNumber())
.append("position", getPosition()) .append("position", getPosition())
.append("highAlarm", getHighAlarm()) .append("ccid", getCcid())
.append("highHighAlarm", getHighHighAlarm()) .append("imei", getImei())
.append("lowAlarm", getLowAlarm()) .append("remark", getRemark())
.append("lowLowAlarm", getLowLowAlarm()) .append("contacts", getContacts())
.append("range", getRange())
.append("unit", getUnit())
.append("tag", getTag())
.append("createdAt", getCreatedAt()) .append("createdAt", getCreatedAt())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.toString(); .toString();
} }
} }
...@@ -74,31 +74,15 @@ public class TGasAlarmServiceImpl implements ITGasAlarmService ...@@ -74,31 +74,15 @@ public class TGasAlarmServiceImpl implements ITGasAlarmService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateTGasAlarm(TGasAlarm tGasAlarm) public int updateTGasAlarm(TGasAlarm tGasAlarm) {
{
if(2 == tGasAlarm.getType()){
tGasAlarm.setEndtime(new Date());
tGasAlarm.setStatus(0);
}
int i = tGasAlarmMapper.updateTGasAlarm(tGasAlarm); int i = tGasAlarmMapper.updateTGasAlarm(tGasAlarm);
if(i >0 && null != tGasAlarm.getReason() && !StringUtils.isEmpty(tGasAlarm.getRemark())){ 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())); JSONObject alarmInfo = redisCache.getCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()));
if(null != alarmInfo){ if(null != alarmInfo){
alarmInfo.put("reason",tGasAlarm.getReason()); alarmInfo.put("reason",tGasAlarm.getReason());
redisCache.setCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()),alarmInfo); redisCache.setCacheMapValue("gas_warning",String.valueOf(tGasAlarm.getId()),alarmInfo);
} }
} }
}
return i; return i;
} }
......
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zehong.common.core.redis.RedisCache; import com.zehong.common.core.redis.RedisCache;
import com.zehong.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TGasDataMapper; import com.zehong.system.mapper.TGasDataMapper;
...@@ -33,9 +34,17 @@ public class TGasDataServiceImpl implements ITGasDataService ...@@ -33,9 +34,17 @@ public class TGasDataServiceImpl implements ITGasDataService
* @return 监测设备数据 * @return 监测设备数据
*/ */
@Override @Override
public TGasData selectTGasDataById(Long id) public TGasData selectTGasDataById(Long id) {
{ TGasData data = tGasDataMapper.selectTGasDataById(id);
return 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 ...@@ -51,7 +60,7 @@ public class TGasDataServiceImpl implements ITGasDataService
JSONObject gasData = redisCache.getCacheMapValue("devices_report",item.getNumber()); JSONObject gasData = redisCache.getCacheMapValue("devices_report",item.getNumber());
if(null != gasData){ if(null != gasData){
item.setReportStatus(gasData.getString("status")); item.setReportStatus(gasData.getString("status"));
item.setReportParam(gasData.getString("value") + item.getUnit()); item.setReportParam(gasData.getString("values"));
item.setReportTime(gasData.getString("time")); item.setReportTime(gasData.getString("time"));
} }
}); });
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TGasAlarmMapper"> <mapper namespace="com.zehong.system.mapper.TGasAlarmMapper">
<resultMap type="TGasAlarm" id="TGasAlarmResult"> <resultMap type="TGasAlarm" id="TGasAlarmResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="number" column="number" /> <result property="number" column="number" />
<result property="reportStatus" column="report_status" /> <result property="reportStatus" column="report_status" />
<result property="position" column="position" />
<result property="starttime" column="starttime" /> <result property="starttime" column="starttime" />
<result property="endtime" column="endtime" /> <result property="endtime" column="endtime" />
<result property="nd" column="nd" /> <result property="params" column="params" />
<result property="paramsData" column="params" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="type" column="type" />
<result property="reason" column="reason" /> <result property="reason" column="reason" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at" />
...@@ -22,42 +19,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -22,42 +19,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectTGasAlarmVo"> <sql id="selectTGasAlarmVo">
SELECT select id, number, report_status, starttime, endtime, params, status, reason, remark, created_at, updated_at from t_gas_alarm
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
</sql> </sql>
<select id="selectTGasAlarmList" parameterType="TGasAlarm" resultMap="TGasAlarmResult"> <select id="selectTGasAlarmList" parameterType="TGasAlarm" resultMap="TGasAlarmResult">
<include refid="selectTGasAlarmVo"/> <include refid="selectTGasAlarmVo"/>
<where> <where>
<if test="number != null and number != ''"> and alarm.number like concat('%', #{number}, '%')</if> <if test="number != null and number != ''"> and number like concat('%', #{number}, '%')</if>
<if test="status != null "> and alarm.status = #{status}</if> <if test="reportStatus != null "> and report_status = #{reportStatus}</if>
<if test="type != null "> and alarm.type = #{type}</if> <if test="starttime != null "> and starttime = #{starttime}</if>
<if test="reason != null "> and alarm.reason = #{reason}</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> </where>
order by alarm.starttime desc
</select> </select>
<select id="selectTGasAlarmById" parameterType="Long" resultMap="TGasAlarmResult"> <select id="selectTGasAlarmById" parameterType="Long" resultMap="TGasAlarmResult">
<include refid="selectTGasAlarmVo"/> <include refid="selectTGasAlarmVo"/>
where alarm.id = #{id} where id = #{id}
</select> </select>
<insert id="insertTGasAlarm" parameterType="TGasAlarm" useGeneratedKeys="true" keyProperty="id"> <insert id="insertTGasAlarm" parameterType="TGasAlarm" useGeneratedKeys="true" keyProperty="id">
...@@ -65,13 +47,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -65,13 +47,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="number != null">number,</if> <if test="number != null">number,</if>
<if test="reportStatus != null">report_status,</if> <if test="reportStatus != null">report_status,</if>
<if test="position != null">`position`,</if>
<if test="starttime != null">starttime,</if> <if test="starttime != null">starttime,</if>
<if test="endtime != null">endtime,</if> <if test="endtime != null">endtime,</if>
<if test="nd != null">nd,</if> <if test="params != null">params,</if>
<if test="paramsData != null">params,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="type != null">type,</if>
<if test="reason != null">reason,</if> <if test="reason != null">reason,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
...@@ -80,13 +59,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -80,13 +59,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="number != null">#{number},</if> <if test="number != null">#{number},</if>
<if test="reportStatus != null">#{reportStatus},</if> <if test="reportStatus != null">#{reportStatus},</if>
<if test="position != null">#{position},</if>
<if test="starttime != null">#{starttime},</if> <if test="starttime != null">#{starttime},</if>
<if test="endtime != null">#{endtime},</if> <if test="endtime != null">#{endtime},</if>
<if test="nd != null">#{nd},</if> <if test="params != null">#{params},</if>
<if test="paramsData != null">#{paramsData},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="type != null">#{type},</if>
<if test="reason != null">#{reason},</if> <if test="reason != null">#{reason},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
...@@ -99,13 +75,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -99,13 +75,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="number != null">number = #{number},</if> <if test="number != null">number = #{number},</if>
<if test="reportStatus != null">report_status = #{reportStatus},</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="starttime != null">starttime = #{starttime},</if>
<if test="endtime != null">endtime = #{endtime},</if> <if test="endtime != null">endtime = #{endtime},</if>
<if test="nd != null">nd = #{nd},</if> <if test="params != null">params = #{params},</if>
<if test="paramsData != null">params = #{paramsData},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="type != null">type = #{type},</if>
<if test="reason != null">reason = #{reason},</if> <if test="reason != null">reason = #{reason},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> <if test="createdAt != null">created_at = #{createdAt},</if>
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TGasDataMapper"> <mapper namespace="com.zehong.system.mapper.TGasDataMapper">
<resultMap type="TGasData" id="TGasDataResult"> <resultMap type="TGasData" id="TGasDataResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="number" column="number" /> <result property="company" column="company" />
<result property="type" column="type" /> <result property="type" column="type" />
<result property="number" column="number" />
<result property="position" column="position" /> <result property="position" column="position" />
<result property="highAlarm" column="high_alarm" /> <result property="ccid" column="ccid" />
<result property="highHighAlarm" column="high_high_alarm" /> <result property="imei" column="imei" />
<result property="lowAlarm" column="low_alarm" /> <result property="remark" column="remark" />
<result property="lowLowAlarm" column="low_low_alarm" /> <result property="contacts" column="contacts" />
<result property="range" column="range" />
<result property="unit" column="unit" />
<result property="tag" column="tag" />
<result property="createdAt" column="created_at" /> <result property="createdAt" column="created_at" />
<result property="longitude" column="longitude" /> <result property="longitude" column="longitude" />
<result property="latitude" column="latitude" /> <result property="latitude" column="latitude" />
<result property="contacts" column="contacts" />
</resultMap> </resultMap>
<sql id="selectTGasDataVo"> <sql id="selectTGasDataVo">
SELECT select id, company, type, number, position, ccid, imei, remark, contacts, created_at, longitude, latitude from t_gas_data
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
</sql> </sql>
<select id="selectTGasDataList" parameterType="TGasData" resultMap="TGasDataResult"> <select id="selectTGasDataList" parameterType="TGasData" resultMap="TGasDataResult">
<include refid="selectTGasDataVo"/> <include refid="selectTGasDataVo"/>
<where> <where>
<if test="number != null and number != ''"> and number like concat('%', #{number}, '%')</if> <if test="company != null "> and company = #{company}</if>
<if test="type != null "> and type = #{type}</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="position != null and position != ''"> and position like concat('%', #{position}, '%')</if>
<if test="highAlarm != null "> and high_alarm = #{highAlarm}</if> <if test="ccid != null and ccid != ''"> and ccid = #{ccid}</if>
<if test="highHighAlarm != null "> and high_high_alarm = #{highHighAlarm}</if> <if test="imei != null and imei != ''"> and imei = #{imei}</if>
<if test="lowAlarm != null "> and low_alarm = #{lowAlarm}</if> <if test="contacts != null and contacts != ''"> and contacts = #{contacts}</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="createdAt != null "> and created_at = #{createdAt}</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> </where>
</select> </select>
...@@ -70,56 +47,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -70,56 +47,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertTGasData" parameterType="TGasData" useGeneratedKeys="true" keyProperty="id"> <insert id="insertTGasData" parameterType="TGasData" useGeneratedKeys="true" keyProperty="id">
insert into t_gas_data insert into t_gas_data
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="number != null">number,</if> <if test="company != null">company,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="number != null">number,</if>
<if test="position != null">position,</if> <if test="position != null">position,</if>
<if test="highAlarm != null">high_alarm,</if> <if test="ccid != null">ccid,</if>
<if test="highHighAlarm != null">high_high_alarm,</if> <if test="imei != null">imei,</if>
<if test="lowAlarm != null">low_alarm,</if> <if test="remark != null">remark,</if>
<if test="lowLowAlarm != null">low_low_alarm,</if> <if test="contacts != null">contacts,</if>
<if test="range != null">range,</if>
<if test="unit != null">unit,</if>
<if test="tag != null">tag,</if>
<if test="createdAt != null">created_at,</if> <if test="createdAt != null">created_at,</if>
<if test="longitude != null">longitude,</if> <if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if> <if test="latitude != null">latitude,</if>
<if test="contacts != null">contacts,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <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="type != null">#{type},</if>
<if test="number != null">#{number},</if>
<if test="position != null">#{position},</if> <if test="position != null">#{position},</if>
<if test="highAlarm != null">#{highAlarm},</if> <if test="ccid != null">#{ccid},</if>
<if test="highHighAlarm != null">#{highHighAlarm},</if> <if test="imei != null">#{imei},</if>
<if test="lowAlarm != null">#{lowAlarm},</if> <if test="remark != null">#{remark},</if>
<if test="lowLowAlarm != null">#{lowLowAlarm},</if> <if test="contacts != null">#{contacts},</if>
<if test="range != null">#{range},</if>
<if test="unit != null">#{unit},</if>
<if test="tag != null">#{tag},</if>
<if test="createdAt != null">#{createdAt},</if> <if test="createdAt != null">#{createdAt},</if>
<if test="longitude != null">#{longitude},</if> <if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if> <if test="latitude != null">#{latitude},</if>
<if test="contacts != null">#{contacts},</if>
</trim> </trim>
</insert> </insert>
<update id="updateTGasData" parameterType="TGasData"> <update id="updateTGasData" parameterType="TGasData">
update t_gas_data update t_gas_data
<trim prefix="SET" suffixOverrides=","> <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="type != null">type = #{type},</if>
<if test="number != null">number = #{number},</if>
<if test="position != null">position = #{position},</if> <if test="position != null">position = #{position},</if>
<if test="highAlarm != null">high_alarm = #{highAlarm},</if> <if test="ccid != null">ccid = #{ccid},</if>
<if test="highHighAlarm != null">high_high_alarm = #{highHighAlarm},</if> <if test="imei != null">imei = #{imei},</if>
<if test="lowAlarm != null">low_alarm = #{lowAlarm},</if> <if test="remark != null">remark = #{remark},</if>
<if test="lowLowAlarm != null">low_low_alarm = #{lowLowAlarm},</if> <if test="contacts != null">contacts = #{contacts},</if>
<if test="range != null">range = #{range},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="tag != null">tag = #{tag},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> <if test="createdAt != null">created_at = #{createdAt},</if>
<if test="longitude != null">longitude = #{longitude},</if> <if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if> <if test="latitude != null">latitude = #{latitude},</if>
<if test="contacts != null">contacts = #{contacts},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
...@@ -11,17 +11,11 @@ ...@@ -11,17 +11,11 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="设备状态"> <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> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </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-col :span="12">
<el-form-item label="报警开始时间"> <el-form-item label="报警开始时间">
...@@ -38,8 +32,8 @@ ...@@ -38,8 +32,8 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上报数值"> <el-form-item label="上报参数">
<span v-if="detailInfo.nd">{{ detailInfo.nd }}</span> <span v-if="detailInfo.params">{{ detailInfo.params }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -50,15 +44,9 @@ ...@@ -50,15 +44,9 @@
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </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-col :span="12">
<el-form-item label="处置类型"> <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> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
......
...@@ -20,16 +20,6 @@ ...@@ -20,16 +20,6 @@
/> />
</el-select> </el-select>
</el-form-item> </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-form-item label="处置类型" prop="reason">
<el-select v-model="queryParams.reason" placeholder="请选择处置类型" clearable size="small"> <el-select v-model="queryParams.reason" placeholder="请选择处置类型" clearable size="small">
<el-option <el-option
...@@ -97,7 +87,6 @@ ...@@ -97,7 +87,6 @@
<!--<el-table-column type="selection" width="55" align="center" />--> <!--<el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="设备编号" align="center" prop="number" /> <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="reportStatus" :formatter="deviceStatusFormat"/>
<el-table-column label="安装位置" align="center" prop="position" :show-overflow-tooltip="true"/>
<el-table-column label="报警开始时间" align="center" prop="starttime"> <el-table-column label="报警开始时间" align="center" prop="starttime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <span>{{ parseTime(scope.row.starttime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
...@@ -109,9 +98,8 @@ ...@@ -109,9 +98,8 @@
<span v-else>-</span> <span v-else>-</span>
</template> </template>
</el-table-column> </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="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" prop="reason" :formatter="reasonFormat" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -326,6 +314,7 @@ export default { ...@@ -326,6 +314,7 @@ export default {
}, },
// 报警原因字典翻译 // 报警原因字典翻译
reasonFormat(row, column) { reasonFormat(row, column) {
console.log("=======",row)
const reason = this.selectDictLabel(this.reasonOptions, row.reason); const reason = this.selectDictLabel(this.reasonOptions, row.reason);
return reason ? reason : '-'; return reason ? reason : '-';
}, },
......
...@@ -11,74 +11,46 @@ ...@@ -11,74 +11,46 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="所属厂家"> <el-form-item label="设备类型">
<span v-if="detailInfo.type">{{ $parent.typeFormat(detailInfo) }}</span> <span v-if="detailInfo.type">{{ detailInfo.type }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="位号"> <el-form-item label="所属厂家">
<span>{{ detailInfo.tag }}</span> <span v-if="detailInfo.company">{{ $parent.companyFormat(detailInfo) }}</span>
<span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="12">
<el-form-item label="安装位置"> <el-form-item label="安装位置">
<span>{{ detailInfo.position }}</span> <span>{{ detailInfo.position }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="高报"> <el-form-item label="上报状态">
<span v-if="detailInfo.highAlarm">{{ detailInfo.highAlarm }}</span> <span v-if="detailInfo.reportStatus">{{ $parent.deviceStatusFormat(detailInfo) }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="高高报"> <el-form-item label="上报时间">
<span v-if="detailInfo.highHighAlarm">{{ detailInfo.highHighAlarm }}</span> <span v-if="detailInfo.reportTime">{{ detailInfo.reportTime }}</span>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="24">
<el-form-item label="低报"> <el-form-item label="上报参数">
<span v-if="detailInfo.lowAlarm">{{ detailInfo.lowAlarm }}</span> <span v-if="detailInfo.reportParam">{{ detailInfo.reportParam }}</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>
<span v-else>-</span> <span v-else>-</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-col> </el-col>
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="所属厂家" prop="type"> <el-form-item label="所属厂家" prop="company">
<el-select v-model="queryParams.type" placeholder="请选择所属厂家" clearable size="small"> <el-select v-model="queryParams.company" placeholder="请选择所属厂家" clearable size="small">
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
:key="dict.dictValue" :key="dict.dictValue"
...@@ -22,16 +22,6 @@ ...@@ -22,16 +22,6 @@
</el-select> </el-select>
</el-form-item> </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-form-item label="安装位置" prop="position">
<el-input <el-input
v-model="queryParams.position" v-model="queryParams.position"
...@@ -48,7 +38,7 @@ ...@@ -48,7 +38,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <!--<el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
...@@ -56,7 +46,7 @@ ...@@ -56,7 +46,7 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['gas:data:add']" v-hasPermi="['system:data:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
...@@ -67,7 +57,7 @@ ...@@ -67,7 +57,7 @@
size="mini" size="mini"
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['gas:data:edit']" v-hasPermi="['system:data:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
...@@ -78,7 +68,7 @@ ...@@ -78,7 +68,7 @@
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['gas:data:remove']" v-hasPermi="['system:data:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
...@@ -89,17 +79,17 @@ ...@@ -89,17 +79,17 @@
size="mini" size="mini"
:loading="exportLoading" :loading="exportLoading"
@click="handleExport" @click="handleExport"
v-hasPermi="['gas:data:export']" v-hasPermi="['system:data:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <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 v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="设备编号" align="center" prop="number" /> <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="type" />
<el-table-column label="位号" align="center" prop="tag" :show-overflow-tooltip="true"/> <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="position" :show-overflow-tooltip="true" width="300"/>
<el-table-column label="上报状态" align="center" prop="reportStatus"> <el-table-column label="上报状态" align="center" prop="reportStatus">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -117,7 +107,7 @@ ...@@ -117,7 +107,7 @@
<span v-else >{{ deviceStatusFormat(scope.row) }}</span> <span v-else >{{ deviceStatusFormat(scope.row) }}</span>
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<span v-if="scope.row.reportParam">{{scope.row.reportParam}}</span> <span v-if="scope.row.reportParam">{{scope.row.reportParam}}</span>
<span v-else></span> <span v-else></span>
...@@ -137,20 +127,20 @@ ...@@ -137,20 +127,20 @@
icon="el-icon-document" icon="el-icon-document"
@click="handleDetail(scope.row)" @click="handleDetail(scope.row)"
>详情</el-button> >详情</el-button>
<el-button <!--<el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['gas:data:edit']" v-hasPermi="['system:data:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['gas:data:remove']" v-hasPermi="['system:data:remove']"
>删除</el-button> >删除</el-button>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -164,117 +154,43 @@ ...@@ -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-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="设备编号" prop="number"> <el-form-item label="设备编号" prop="number">
<el-input v-model="form.number" placeholder="请输入设备编号" /> <el-input v-model="form.number" placeholder="请输入设备编号" />
</el-form-item> </el-form-item>
</el-col> <el-form-item label="安装位置" prop="position">
<el-col :span="12"> <el-input v-model="form.position" placeholder="请输入安装位置" />
<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-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="高报" prop="highAlarm"> <el-form-item label="高报" prop="highAlarm">
<el-input v-model="form.highAlarm" placeholder="请输入高报" /> <el-input v-model="form.highAlarm" placeholder="请输入高报" />
</el-form-item> </el-form-item>
</el-col> <el-form-item label="高高报" prop="highHighAlarm">
</el-row> <el-input v-model="form.highHighAlarm" placeholder="请输入高高报" />
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="低报" prop="lowAlarm"> <el-form-item label="低报" prop="lowAlarm">
<el-input v-model="form.lowAlarm" placeholder="请输入低报" /> <el-input v-model="form.lowAlarm" placeholder="请输入低报" />
</el-form-item> </el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="低低报" prop="lowLowAlarm"> <el-form-item label="低低报" prop="lowLowAlarm">
<el-input v-model="form.lowLowAlarm" placeholder="请输入低低报" /> <el-input v-model="form.lowLowAlarm" placeholder="请输入低低报" />
</el-form-item> </el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="量程" prop="range"> <el-form-item label="量程" prop="range">
<el-input v-model="form.range" placeholder="请输入量程" /> <el-input v-model="form.range" placeholder="请输入量程" />
</el-form-item> </el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unit"> <el-form-item label="单位" prop="unit">
<el-input v-model="form.unit" placeholder="请输入单位" /> <el-input v-model="form.unit" placeholder="请输入单位" />
</el-form-item> </el-form-item>
</el-col> <el-form-item label="位号" prop="tag">
</el-row> <el-input v-model="form.tag" placeholder="请输入位号" />
<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-form-item>
</el-col> <el-form-item label="位号" prop="createdAt">
</el-row> <el-date-picker clearable size="small"
v-model="form.createdAt"
<el-row> type="date"
<el-col :span="24"> value-format="yyyy-MM-dd"
<el-form-item label="联系人" prop="contacts"> placeholder="选择位号">
<el-select </el-date-picker>
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-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
...@@ -285,29 +201,16 @@ ...@@ -285,29 +201,16 @@
<!-- 详情 --> <!-- 详情 -->
<DetailInfo ref="detailInfo"/> <DetailInfo ref="detailInfo"/>
<!-- 地图 -->
<GetPos
:dialogVisible.sync="dialogTableVisibles"
:devicePos="devicePos"
@close="dialogcancelFun"
@getPath="getPath"
style="z-index: 3000"
ref="getPos"
/>
</div> </div>
</template> </template>
<script> <script>
import { listData, getData, delData, addData, updateData, exportData } from "@/api/gasdata/data"; import { listData, getData, delData, addData, updateData, exportData } from "@/api/gasdata/data";
import DetailInfo from "./components/DetailInfo"; import DetailInfo from "./components/DetailInfo";
import GetPos from '@/components/GetPos'; export default {
import { userInfoList } from "@/api/system/user";
export default {
name: "Data", name: "Data",
components: { components: {
DetailInfo, DetailInfo
GetPos,
}, },
data() { data() {
return { return {
...@@ -317,7 +220,6 @@ export default { ...@@ -317,7 +220,6 @@ export default {
exportLoading: false, exportLoading: false,
// 选中数组 // 选中数组
ids: [], ids: [],
numbers: [],
// 非单个禁用 // 非单个禁用
single: true, single: true,
// 非多个禁用 // 非多个禁用
...@@ -336,41 +238,17 @@ export default { ...@@ -336,41 +238,17 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
company: null,
number: null, number: null,
position: null, position: null,
highAlarm: null,
highHighAlarm: null,
lowAlarm: null,
lowLowAlarm: null,
range: null,
unit: null,
tag: null,
createdAt: null
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { 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: [], deviceStatus: [],
typeOptions: [], typeOptions: []
dialogTableVisibles: false,
devicePos: [],
userList: [],
//联系人数组
contacts: []
}; };
}, },
created() { created() {
...@@ -396,10 +274,10 @@ export default { ...@@ -396,10 +274,10 @@ export default {
const deviceStatus = this.selectDictLabel(this.deviceStatus, row.reportStatus); const deviceStatus = this.selectDictLabel(this.deviceStatus, row.reportStatus);
return deviceStatus ? deviceStatus : "-"; return deviceStatus ? deviceStatus : "-";
}, },
//所属厂家 1泽宏,2安博汇,3费加罗 //所属厂家 1如阳科技,2海康威视
typeFormat(row, column) { companyFormat(row, column) {
const type = this.selectDictLabel(this.typeOptions, row.type); const company = this.selectDictLabel(this.typeOptions, row.company);
return type ? type : "-"; return company ? company : "-";
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
...@@ -421,8 +299,6 @@ export default { ...@@ -421,8 +299,6 @@ export default {
tag: null, tag: null,
createdAt: null createdAt: null
}; };
this.devicePos = [];
this.contacts = [];
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
...@@ -437,15 +313,13 @@ export default { ...@@ -437,15 +313,13 @@ export default {
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id); this.ids = selection.map(item => item.id)
this.numbers = selection.map(item => item.number);
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.getUserInfo();
this.open = true; this.open = true;
this.title = "添加监测设备数据"; this.title = "添加监测设备数据";
}, },
...@@ -455,13 +329,6 @@ export default { ...@@ -455,13 +329,6 @@ export default {
const id = row.id || this.ids const id = row.id || this.ids
getData(id).then(response => { getData(id).then(response => {
this.form = response.data; 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();
this.open = true; this.open = true;
this.title = "修改监测设备数据"; this.title = "修改监测设备数据";
}); });
...@@ -489,8 +356,7 @@ export default { ...@@ -489,8 +356,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
const numbers = row.number || this.numbers; this.$confirm('是否确认删除监测设备数据编号为"' + ids + '"的数据项?', "警告", {
this.$confirm('是否确认删除监测设备数据编号为"' + numbers + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
...@@ -519,38 +385,7 @@ export default { ...@@ -519,38 +385,7 @@ export default {
/**详情*/ /**详情*/
handleDetail(row){ handleDetail(row){
this.$refs.detailInfo.openDetail(row.id); 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(",");
} }
} }
}; };
</script> </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