提交代码

dev_xd
姜玉琦 2025-04-05 12:44:01 +08:00
parent 28904c6768
commit 0183f4e6fd
30 changed files with 1072 additions and 385 deletions

View File

@ -0,0 +1,14 @@
package com.yanzhu.common.core.constant;
/**
*
*
* @author ruoyi
*/
public class ApiConstants {
/**
* IOTHOST&&
*/
public static final String IOT_SD_HOST = "https://api.e.v1.i-sada.net";
}

View File

@ -7,15 +7,17 @@ package com.yanzhu.common.core.enums;
*/
public enum IsDelEnums {
NO(0L, "有效"),
YES(1L, "删除");
NO(0L, "0","有效"),
YES(1L, "1", "删除");
private final Long code;
private final String codeStr;
private final String info;
IsDelEnums(Long code, String info)
IsDelEnums(Long code, String codeStr, String info)
{
this.code = code;
this.codeStr = codeStr;
this.info = info;
}
@ -28,4 +30,8 @@ public enum IsDelEnums {
{
return info;
}
public String getCodeStr() {
return codeStr;
}
}

View File

@ -19,13 +19,19 @@ public class DevIotConfig extends BaseEntity
private Long id;
/** 公司主键 */
@Excel(name = "公司主键")
private Long comId;
/** 公司名称 */
@Excel(name = "公司名称")
private String comName;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 通信账号 */
@Excel(name = "通信账号")
private String signalName;
@ -106,6 +112,22 @@ public class DevIotConfig extends BaseEntity
return isDel;
}
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -23,13 +23,19 @@ public class DevIotConfigPoint extends BaseEntity
private Long cfgId;
/** 公司主键 */
@Excel(name = "公司主键")
private Long comId;
/** 公司名称 */
@Excel(name = "公司名称")
private String comName;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
@ -236,6 +242,22 @@ public class DevIotConfigPoint extends BaseEntity
return isDel;
}
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -27,13 +27,19 @@ public class DevIotDatas extends BaseEntity
private Long pointId;
/** 公司主键 */
@Excel(name = "公司主键")
private Long comId;
/** 公司名称 */
@Excel(name = "公司名称")
private String comName;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
@ -444,6 +450,22 @@ public class DevIotDatas extends BaseEntity
return frequencyC;
}
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -27,13 +27,19 @@ public class DevIotWarning extends BaseEntity
private Long pointId;
/** 公司主键 */
@Excel(name = "公司主键")
private Long comId;
/** 公司名称 */
@Excel(name = "公司名称")
private String comName;
/** 项目主键 */
@Excel(name = "项目主键")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
@ -119,6 +125,22 @@ public class DevIotWarning extends BaseEntity
return warningContent;
}
public String getComName() {
return comName;
}
public void setComName(String comName) {
this.comName = comName;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -7,7 +7,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="DevIotConfig" id="DevIotConfigResult">
<result property="id" column="id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="signalName" column="signal_name" />
<result property="signalCode" column="signal_code" />
<result property="factoryName" column="factory_name" />
@ -20,24 +22,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDevIotConfigVo">
select id, com_id, project_id, signal_name, signal_code, factory_name, is_del, create_by, create_time, update_by, update_time, remark from dev_iot_config
select dic.id, dic.com_id, dic.project_id, sd.dept_name as com_name, pi.project_name, dic.signal_name, dic.signal_code, dic.factory_name, dic.is_del, dic.create_by, dic.create_time, dic.update_by, dic.update_time, dic.remark from dev_iot_config dic
left join pro_project_info pi on pi.id = dic.project_id
left join sys_dept sd on sd.dept_id = dic.com_id
</sql>
<select id="selectDevIotConfigList" parameterType="DevIotConfig" resultMap="DevIotConfigResult">
<include refid="selectDevIotConfigVo"/>
<where>
<if test="comId != null "> and com_id = #{comId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="signalName != null and signalName != ''"> and signal_name like concat('%', #{signalName}, '%')</if>
<if test="signalCode != null and signalCode != ''"> and signal_code = #{signalCode}</if>
<if test="factoryName != null and factoryName != ''"> and factory_name like concat('%', #{factoryName}, '%')</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="comId != null "> and dic.com_id = #{comId}</if>
<if test="projectId != null "> and dic.project_id = #{projectId}</if>
<if test="activeComId != null "> and dic.com_id = #{activeComId}</if>
<if test="activeProjectId != null "> and dic.project_id = #{activeProjectId}</if>
<if test="signalName != null and signalName != ''"> and dic.signal_name = #{signalName}</if>
<if test="signalCode != null and signalCode != ''"> and dic.signal_code = #{signalCode}</if>
<if test="factoryName != null and factoryName != ''"> and dic.factory_name = #{factoryName}</if>
<if test="isDel != null and isDel != ''"> and dic.is_del = #{isDel}</if>
and dic.is_del != '2'
</where>
order by dic.id desc
</select>
<select id="selectDevIotConfigById" parameterType="Long" resultMap="DevIotConfigResult">
<include refid="selectDevIotConfigVo"/>
where id = #{id}
where dic.id = #{id}
</select>
<insert id="insertDevIotConfig" parameterType="DevIotConfig" useGeneratedKeys="true" keyProperty="id">
@ -88,14 +96,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteDevIotConfigById" parameterType="Long">
delete from dev_iot_config where id = #{id}
</delete>
<update id="deleteDevIotConfigById" parameterType="Long">
update dev_iot_config set is_del = '2' where id = #{id}
</update>
<delete id="deleteDevIotConfigByIds" parameterType="String">
delete from dev_iot_config where id in
<update id="deleteDevIotConfigByIds" parameterType="String">
update dev_iot_config set is_del = '2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
</mapper>

View File

@ -8,7 +8,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" />
<result property="cfgId" column="cfg_id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="deviceSn" column="device_sn" />
<result property="deviceName" column="device_name" />
<result property="factoryName" column="factory_name" />
@ -30,26 +32,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDevIotConfigPointVo">
select id, cfg_id, com_id, project_id, device_sn, device_name, factory_name, contact_person, contact_person_phone, levels, leakage_current, rated_temperature, short_circuit_current, rated_current, rated_voltage, online_status, is_del, create_by, create_time, update_by, update_time, remark from dev_iot_config_point
select dicp.id, dicp.cfg_id, dicp.com_id, dicp.project_id, sd.dept_name as com_name, pi.project_name, dicp.device_sn, dicp.device_name, dicp.factory_name, dicp.contact_person, dicp.contact_person_phone, dicp.levels, dicp.leakage_current, dicp.rated_temperature,
dicp.short_circuit_current, dicp.rated_current, dicp.rated_voltage, dicp.online_status, dicp.is_del, dicp.create_by, dicp.create_time, dicp.update_by, dicp.update_time, dicp.remark from dev_iot_config_point dicp
left join pro_project_info pi on pi.id = dicp.project_id
left join sys_dept sd on sd.dept_id = dicp.com_id
</sql>
<select id="selectDevIotConfigPointList" parameterType="DevIotConfigPoint" resultMap="DevIotConfigPointResult">
<include refid="selectDevIotConfigPointVo"/>
<where>
<if test="cfgId != null "> and cfg_id = #{cfgId}</if>
<if test="comId != null "> and com_id = #{comId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and device_sn = #{deviceSn}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="factoryName != null and factoryName != ''"> and factory_name like concat('%', #{factoryName}, '%')</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="cfgId != null "> and dicp.cfg_id = #{cfgId}</if>
<if test="comId != null "> and dicp.com_id = #{comId}</if>
<if test="projectId != null "> and dicp.project_id = #{projectId}</if>
<if test="activeComId != null "> and dicp.com_id = #{activeComId}</if>
<if test="activeProjectId != null "> and dicp.project_id = #{activeProjectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and dicp.device_sn = #{deviceSn}</if>
<if test="deviceName != null and deviceName != ''"> and dicp.device_name like concat('%', #{deviceName}, '%')</if>
<if test="factoryName != null and factoryName != ''"> and dicp.factory_name = #{factoryName}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and dicp.online_status = #{onlineStatus}</if>
<if test="isDel != null and isDel != ''"> and dicp.is_del = #{isDel}</if>
and dicp.is_del != '2'
</where>
order by dicp.id desc
</select>
<select id="selectDevIotConfigPointById" parameterType="Long" resultMap="DevIotConfigPointResult">
<include refid="selectDevIotConfigPointVo"/>
where id = #{id}
where dicp.id = #{id}
</select>
<insert id="insertDevIotConfigPoint" parameterType="DevIotConfigPoint" useGeneratedKeys="true" keyProperty="id">
@ -130,14 +139,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteDevIotConfigPointById" parameterType="Long">
delete from dev_iot_config_point where id = #{id}
</delete>
<update id="deleteDevIotConfigPointById" parameterType="Long">
update dev_iot_config_point set is_del = '2' where id = #{id}
</update>
<delete id="deleteDevIotConfigPointByIds" parameterType="String">
delete from dev_iot_config_point where id in
<update id="deleteDevIotConfigPointByIds" parameterType="String">
update dev_iot_config_point set is_del = '2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
</mapper>

View File

@ -9,7 +9,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="cfgId" column="cfg_id" />
<result property="pointId" column="point_id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="deviceSn" column="device_sn" />
<result property="switchesAc" column="switches_ac" />
<result property="switchesSwitch" column="switches_switch" />
@ -42,24 +44,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDevIotDatasVo">
select id, cfg_id, point_id, com_id, project_id, device_sn, switches_ac, switches_switch, switches_switches, switches_switchStatus, temperature, leakage, voltage_a, voltage_b, voltage_c, voltage_ab, voltage_bc, voltage_ca, current_a, current_b, current_c, power_a, power_b, power_c, energy_a, energy_b, energy_c, factor_a, factor_b, factor_c, frequency_a, frequency_b, frequency_c, create_time from dev_iot_datas
select did.id, did.cfg_id, did.point_id, did.com_id, did.project_id, sd.dept_name as com_name, pi.project_name, did.device_sn, did.switches_ac, did.switches_switch, did.switches_switches, did.switches_switchStatus, did.temperature, did.leakage, did.voltage_a, did.voltage_b, did.voltage_c, did.voltage_ab, did.voltage_bc, did.voltage_ca, did.current_a, did.current_b, did.current_c, did.power_a, power_b, power_c,
did.energy_a, did.energy_b, did.energy_c, did.factor_a, did.factor_b, did.factor_c, did.frequency_a, did.frequency_b, did.frequency_c, did.create_time from dev_iot_datas did
left join pro_project_info pi on pi.id = did.project_id
left join sys_dept sd on sd.dept_id = did.com_id
</sql>
<select id="selectDevIotDatasList" parameterType="DevIotDatas" resultMap="DevIotDatasResult">
<include refid="selectDevIotDatasVo"/>
<where>
<if test="cfgId != null "> and cfg_id = #{cfgId}</if>
<if test="pointId != null "> and point_id = #{pointId}</if>
<if test="comId != null "> and com_id = #{comId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and device_sn = #{deviceSn}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<if test="cfgId != null "> and did.cfg_id = #{cfgId}</if>
<if test="pointId != null "> and did.point_id = #{pointId}</if>
<if test="comId != null "> and did.com_id = #{comId}</if>
<if test="projectId != null "> and did.project_id = #{projectId}</if>
<if test="activeComId != null "> and did.com_id = #{activeComId}</if>
<if test="activeProjectId != null "> and did.project_id = #{activeProjectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and did.device_sn = #{deviceSn}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and did.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
order by did.id desc
</select>
<select id="selectDevIotDatasById" parameterType="Long" resultMap="DevIotDatasResult">
<include refid="selectDevIotDatasVo"/>
where id = #{id}
where did.id = #{id}
</select>
<insert id="insertDevIotDatas" parameterType="DevIotDatas" useGeneratedKeys="true" keyProperty="id">

View File

@ -9,7 +9,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="cfgId" column="cfg_id" />
<result property="pointId" column="point_id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="deviceSn" column="device_sn" />
<result property="warningType" column="warning_type" />
<result property="warningContent" column="warning_content" />
@ -17,25 +19,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDevIotWarningVo">
select id, cfg_id, point_id, com_id, project_id, device_sn, warning_type, warning_content, create_time from dev_iot_warning
select diw.id, diw.cfg_id, diw.point_id, diw.com_id, diw.project_id, sd.dept_name as com_name, pi.project_name, diw.device_sn, diw.warning_type, diw.warning_content, diw.create_time from dev_iot_warning diw
left join pro_project_info pi on pi.id = diw.project_id
left join sys_dept sd on sd.dept_id = diw.com_id
</sql>
<select id="selectDevIotWarningList" parameterType="DevIotWarning" resultMap="DevIotWarningResult">
<include refid="selectDevIotWarningVo"/>
<where>
<if test="cfgId != null "> and cfg_id = #{cfgId}</if>
<if test="pointId != null "> and point_id = #{pointId}</if>
<if test="comId != null "> and com_id = #{comId}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and device_sn = #{deviceSn}</if>
<if test="warningType != null and warningType != ''"> and warning_type = #{warningType}</if>
<if test="warningContent != null and warningContent != ''"> and warning_content = #{warningContent}</if>
<if test="cfgId != null "> and diw.cfg_id = #{cfgId}</if>
<if test="pointId != null "> and diw.point_id = #{pointId}</if>
<if test="comId != null "> and diw.com_id = #{comId}</if>
<if test="projectId != null "> and diw.project_id = #{projectId}</if>
<if test="activeComId != null "> and diw.com_id = #{activeComId}</if>
<if test="activeProjectId != null "> and diw.project_id = #{activeProjectId}</if>
<if test="deviceSn != null and deviceSn != ''"> and diw.device_sn = #{deviceSn}</if>
<if test="warningType != null and warningType != ''"> and diw.warning_type = #{warningType}</if>
<if test="warningContent != null and warningContent != ''"> and diw.warning_content = #{warningContent}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and diw.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
order by diw.id desc
</select>
<select id="selectDevIotWarningById" parameterType="Long" resultMap="DevIotWarningResult">
<include refid="selectDevIotWarningVo"/>
where id = #{id}
where diw.id = #{id}
</select>
<insert id="insertDevIotWarning" parameterType="DevIotWarning" useGeneratedKeys="true" keyProperty="id">

View File

@ -3,6 +3,7 @@ package com.yanzhu.job.task;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.yanzhu.common.core.constant.ApiConstants;
import com.yanzhu.common.core.text.Convert;
import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.core.utils.http.HttpUtils;
@ -13,7 +14,6 @@ import com.yanzhu.job.service.IDevIotService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.util.*;
@ -35,12 +35,8 @@ public class SadaHzDataTask {
private static final Logger log = LoggerFactory.getLogger(SadaHzDataTask.class);
/**
* IOTHOST&&
*
*/
public static final String SD_HOST = "https://api.e.v1.i-sada.net";
public static String SD_TOKEN = "";
public void getIotConfigPoint() {
List<Map<String,Object>> configs = devIotService.selectDevIotConfigList();
if(configs.size()>0){
@ -51,13 +47,18 @@ public class SadaHzDataTask {
String signalCode = Convert.toStr(configMap.get("signal_code"));
String projectName = Convert.toStr(configMap.get("project_name"));
String projectHashId = getSaDaProjectHashIds(signalName,signalCode,projectName);
// 根据项目主键,查询设备信息
findSaDaBoxByProjectHashId(configMap,projectHashId);
if(StringUtils.isNotEmpty(projectHashId)){
// 根据项目主键,查询设备信息
findSaDaBoxByProjectHashId(configMap,projectHashId);
}
}
}
}
}
/**
* /
*/
public void getIotPowerDatas() {
DevIotConfigPoint pointQuery = new DevIotConfigPoint();
pointQuery.setIsDel("0");
@ -67,7 +68,7 @@ public class SadaHzDataTask {
// 判断是萨达设备
if(StringUtils.eqObj(configPoint.getFactoryName(),"SD")){
if(StringUtils.isNotEmpty(configPoint.getDeviceSn())){
String resStr = HttpUtils.sendGet(SD_HOST + "/metric/box/"+configPoint.getDeviceSn());
String resStr = HttpUtils.sendGet(ApiConstants.IOT_SD_HOST + "/metric/box/"+configPoint.getDeviceSn());
JSONObject result = JSONObject.parseObject(resStr).getJSONObject("result");
// 开关检测数据
JSONObject switches = result.getJSONObject("switches");
@ -168,14 +169,20 @@ public class SadaHzDataTask {
}
}
/**
* HashIds
* @param signalName
* @param signalCode
* @param proName
* @return
*/
private static String getSaDaProjectHashIds(String signalName, String signalCode, String proName){
try {
Map<String, Object> params = new HashMap<>();
params.put("username",signalName);
params.put("password",signalCode);
String resStr = HttpUtils.sendPost(SD_HOST+"/v2/api-token-auth", JSON.toJSONString(params));
String resStr = HttpUtils.sendPost(ApiConstants.IOT_SD_HOST+"/v2/api-token-auth", JSON.toJSONString(params));
JSONObject result = JSONObject.parseObject(resStr).getJSONObject("result");
SD_TOKEN = result.getString("token");
JSONObject accountJson = result.getJSONObject("account");
if(StringUtils.isNotEmpty(accountJson.getString("canViewProjects"))){
JSONArray canProjects = accountJson.getJSONArray("canViewProjects");
@ -200,10 +207,15 @@ public class SadaHzDataTask {
return null;
}
/**
*
* @param devIotConfig
* @param proHashId
*/
private void findSaDaBoxByProjectHashId(Map<String,Object> configMap, String proHashId){
try {
Long cfgId = Convert.toLong(configMap.get("id"));
String resStr = HttpUtils.sendGet(SD_HOST+"/box/project/"+proHashId);
String resStr = HttpUtils.sendGet(ApiConstants.IOT_SD_HOST+"/box/project/"+proHashId);
JSONArray result = JSONObject.parseObject(resStr).getJSONArray("result");
if(result.size()>0){
DevIotConfigPoint pointQuery = new DevIotConfigPoint();

View File

@ -1,5 +1,13 @@
package com.yanzhu.manage.controller.device;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.yanzhu.common.core.constant.ApiConstants;
import com.yanzhu.common.core.enums.IsDelEnums;
import com.yanzhu.common.core.text.Convert;
import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.core.utils.http.HttpUtils;
import com.yanzhu.common.core.utils.poi.ExcelUtil;
import com.yanzhu.common.core.web.controller.BaseController;
import com.yanzhu.common.core.web.domain.AjaxResult;
@ -8,12 +16,17 @@ import com.yanzhu.common.log.annotation.Log;
import com.yanzhu.common.log.enums.BusinessType;
import com.yanzhu.common.security.annotation.RequiresPermissions;
import com.yanzhu.device.domain.DevIotConfig;
import com.yanzhu.device.domain.DevIotConfigPoint;
import com.yanzhu.manage.service.IDevIotConfigPointService;
import com.yanzhu.manage.service.IDevIotConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Controller
@ -28,6 +41,9 @@ public class DevIotConfigController extends BaseController
@Autowired
private IDevIotConfigService devIotConfigService;
@Autowired
private IDevIotConfigPointService devIotConfigPointService;
/**
*
*/
@ -71,7 +87,12 @@ public class DevIotConfigController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody DevIotConfig devIotConfig)
{
return toAjax(devIotConfigService.insertDevIotConfig(devIotConfig));
int res = devIotConfigService.insertDevIotConfig(devIotConfig);
if(res>0){
return success(devIotConfig);
}else{
return error();
}
}
/**
@ -95,4 +116,114 @@ public class DevIotConfigController extends BaseController
{
return toAjax(devIotConfigService.deleteDevIotConfigByIds(ids));
}
/**
*
* @return
*/
@RequiresPermissions("manage:iotConfig:query")
@GetMapping(value = "/findIotConfigPoint/{id}")
public AjaxResult findIotConfigPoint(@PathVariable("id") Long id) {
DevIotConfig devIotConfig = devIotConfigService.selectDevIotConfigById(id);
String projectHashId = getSaDaProjectHashIds(devIotConfig.getSignalName(),devIotConfig.getSignalCode(), devIotConfig.getProjectName());
if(StringUtils.isNotEmpty(projectHashId)){
devIotConfig.setIsDel(IsDelEnums.NO.getCodeStr());
devIotConfigService.updateDevIotConfig(devIotConfig);
// 根据项目主键,查询设备信息
findSaDaBoxByProjectHashId(devIotConfig,projectHashId);
return success();
}else{
return error();
}
}
/**
* HashIds
* @param signalName
* @param signalCode
* @param proName
* @return
*/
private static String getSaDaProjectHashIds(String signalName, String signalCode, String proName){
try {
Map<String, Object> params = new HashMap<>();
params.put("username",signalName);
params.put("password",signalCode);
String resStr = HttpUtils.sendPost(ApiConstants.IOT_SD_HOST+"/v2/api-token-auth", JSON.toJSONString(params));
JSONObject result = JSONObject.parseObject(resStr).getJSONObject("result");
JSONObject accountJson = result.getJSONObject("account");
if(StringUtils.isNotEmpty(accountJson.getString("canViewProjects"))){
JSONArray canProjects = accountJson.getJSONArray("canViewProjects");
if(canProjects.size()>0){
// 使用 forEach 和 Lambda 遍历
for(Object item:canProjects){
JSONObject obj = (JSONObject) item;
if(StringUtils.eqObj(obj.getString("name"),proName)){
return obj.getString("hashId");
}
}
return accountJson.getJSONObject("currentProject").getString("hashId");
}else{
return accountJson.getJSONObject("currentProject").getString("hashId");
}
}else{
return accountJson.getJSONObject("currentProject").getString("hashId");
}
}catch (Exception e){
e.printStackTrace();
}
return null;
}
/**
*
* @param devIotConfig
* @param proHashId
*/
private void findSaDaBoxByProjectHashId(DevIotConfig devIotConfig, String proHashId){
try {
String resStr = HttpUtils.sendGet(ApiConstants.IOT_SD_HOST+"/box/project/"+proHashId);
JSONArray result = JSONObject.parseObject(resStr).getJSONArray("result");
if(result.size()>0){
DevIotConfigPoint pointQuery = new DevIotConfigPoint();
pointQuery.setCfgId(devIotConfig.getId());
List<DevIotConfigPoint> pointList = devIotConfigPointService.selectDevIotConfigPointList(pointQuery);
result.forEach(item -> {
JSONObject obj = (JSONObject) item;
List<DevIotConfigPoint> pointItems = pointList.stream().filter(point -> StringUtils.eqObj(point.getDeviceSn(),obj.getString("hashId"))).collect(Collectors.toList());
if(pointItems.size()>0){
DevIotConfigPoint devIotConfigPoint = pointItems.get(0);
devIotConfigPoint.setDeviceName(obj.getString("name"));
devIotConfigPoint.setFactoryName(devIotConfig.getFactoryName());
devIotConfigPoint.setLevels(obj.getString("level"));
devIotConfigPoint.setLeakageCurrent(obj.getString("leakageCurrent"));
devIotConfigPoint.setRatedTemperature(obj.getString("ratedTemperature"));
devIotConfigPoint.setShortCircuitCurrent(obj.getString("shortCircuitCurrent"));
devIotConfigPoint.setRatedCurrent(obj.getString("ratedCurrent"));
devIotConfigPoint.setRatedVoltage(obj.getString("ratedVoltage"));
devIotConfigPoint.setOnlineStatus(obj.getJSONObject("device").getString("onlineStatus"));
devIotConfigPointService.updateDevIotConfigPoint(devIotConfigPoint);
}else{
DevIotConfigPoint devIotConfigPoint = new DevIotConfigPoint();
devIotConfigPoint.setCfgId(devIotConfig.getId());
devIotConfigPoint.setComId(devIotConfig.getComId());
devIotConfigPoint.setProjectId(devIotConfig.getProjectId());
devIotConfigPoint.setDeviceSn(obj.getString("hashId"));
devIotConfigPoint.setDeviceName(obj.getString("name"));
devIotConfigPoint.setFactoryName(devIotConfig.getFactoryName());
devIotConfigPoint.setLevels(obj.getString("level"));
devIotConfigPoint.setLeakageCurrent(obj.getString("leakageCurrent"));
devIotConfigPoint.setRatedTemperature(obj.getString("ratedTemperature"));
devIotConfigPoint.setShortCircuitCurrent(obj.getString("shortCircuitCurrent"));
devIotConfigPoint.setRatedCurrent(obj.getString("ratedCurrent"));
devIotConfigPoint.setRatedVoltage(obj.getString("ratedVoltage"));
devIotConfigPoint.setOnlineStatus(obj.getJSONObject("device").getString("onlineStatus"));
devIotConfigPointService.insertDevIotConfigPoint(devIotConfigPoint);
}
});
}
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@ -3,6 +3,7 @@ package com.yanzhu.manage.service.impl;
import java.util.List;
import com.yanzhu.common.core.context.SecurityContextHolder;
import com.yanzhu.common.core.utils.DateUtils;
import com.yanzhu.common.security.utils.SecurityUtils;
import com.yanzhu.device.domain.DevIotConfigPoint;
import com.yanzhu.device.mapper.DevIotConfigPointMapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -42,6 +43,8 @@ public class DevIotConfigPointServiceImpl implements IDevIotConfigPointService
@Override
public List<DevIotConfigPoint> selectDevIotConfigPointList(DevIotConfigPoint devIotConfigPoint)
{
devIotConfigPoint.setActiveComId(SecurityUtils.getLoginUser().getSysUser().getActiveComId());
devIotConfigPoint.setActiveProjectId(SecurityUtils.getLoginUser().getSysUser().getActiveProjectId());
return devIotConfigPointMapper.selectDevIotConfigPointList(devIotConfigPoint);
}

View File

@ -2,7 +2,10 @@ package com.yanzhu.manage.service.impl;
import java.util.List;
import com.yanzhu.common.core.context.SecurityContextHolder;
import com.yanzhu.common.core.exception.ServiceException;
import com.yanzhu.common.core.utils.DateUtils;
import com.yanzhu.common.core.utils.StringUtils;
import com.yanzhu.common.security.utils.SecurityUtils;
import com.yanzhu.device.domain.DevIotConfig;
import com.yanzhu.device.mapper.DevIotConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -42,6 +45,8 @@ public class DevIotConfigServiceImpl implements IDevIotConfigService
@Override
public List<DevIotConfig> selectDevIotConfigList(DevIotConfig devIotConfig)
{
devIotConfig.setActiveComId(SecurityUtils.getLoginUser().getSysUser().getActiveComId());
devIotConfig.setActiveProjectId(SecurityUtils.getLoginUser().getSysUser().getActiveProjectId());
return devIotConfigMapper.selectDevIotConfigList(devIotConfig);
}
@ -54,6 +59,16 @@ public class DevIotConfigServiceImpl implements IDevIotConfigService
@Override
public int insertDevIotConfig(DevIotConfig devIotConfig)
{
// 判断设备是否重复
DevIotConfig configQuery = new DevIotConfig();
configQuery.setProjectId(devIotConfig.getProjectId());
configQuery.setSignalName(devIotConfig.getSignalName());
configQuery.setSignalCode(devIotConfig.getSignalCode());
List<DevIotConfig> list = devIotConfigMapper.selectDevIotConfigList(configQuery);
if(list.size()>0){
throw new ServiceException("配置信息重复添加!");
}
devIotConfig.setIsDel("99");
devIotConfig.setCreateBy(SecurityContextHolder.getUserName());
devIotConfig.setCreateTime(DateUtils.getNowDate());
return devIotConfigMapper.insertDevIotConfig(devIotConfig);
@ -68,6 +83,17 @@ public class DevIotConfigServiceImpl implements IDevIotConfigService
@Override
public int updateDevIotConfig(DevIotConfig devIotConfig)
{
// 判断设备是否重复
if(StringUtils.isNotEmpty(devIotConfig.getSignalName()) && StringUtils.isNotEmpty(devIotConfig.getSignalCode())){
DevIotConfig configQuery = new DevIotConfig();
configQuery.setProjectId(devIotConfig.getProjectId());
configQuery.setSignalName(devIotConfig.getSignalName());
configQuery.setSignalCode(devIotConfig.getSignalCode());
List<DevIotConfig> list = devIotConfigMapper.selectDevIotConfigList(configQuery);
if(list.size()>0 && list.get(0).getId()!=devIotConfig.getId()){
throw new ServiceException("配置信息重复添加!");
}
}
devIotConfig.setUpdateBy(SecurityContextHolder.getUserName());
devIotConfig.setUpdateTime(DateUtils.getNowDate());
return devIotConfigMapper.updateDevIotConfig(devIotConfig);

View File

@ -2,6 +2,7 @@ package com.yanzhu.manage.service.impl;
import java.util.List;
import com.yanzhu.common.core.utils.DateUtils;
import com.yanzhu.common.security.utils.SecurityUtils;
import com.yanzhu.device.domain.DevIotDatas;
import com.yanzhu.device.mapper.DevIotDatasMapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,6 +42,8 @@ public class DevIotDatasServiceImpl implements IDevIotDatasService
@Override
public List<DevIotDatas> selectDevIotDatasList(DevIotDatas devIotDatas)
{
devIotDatas.setActiveComId(SecurityUtils.getLoginUser().getSysUser().getActiveComId());
devIotDatas.setActiveProjectId(SecurityUtils.getLoginUser().getSysUser().getActiveProjectId());
return devIotDatasMapper.selectDevIotDatasList(devIotDatas);
}

View File

@ -2,6 +2,7 @@ package com.yanzhu.manage.service.impl;
import java.util.List;
import com.yanzhu.common.core.utils.DateUtils;
import com.yanzhu.common.security.utils.SecurityUtils;
import com.yanzhu.device.domain.DevIotWarning;
import com.yanzhu.device.mapper.DevIotWarningMapper;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,6 +42,8 @@ public class DevIotWarningServiceImpl implements IDevIotWarningService
@Override
public List<DevIotWarning> selectDevIotWarningList(DevIotWarning devIotWarning)
{
devIotWarning.setActiveComId(SecurityUtils.getLoginUser().getSysUser().getActiveComId());
devIotWarning.setActiveProjectId(SecurityUtils.getLoginUser().getSysUser().getActiveProjectId());
return devIotWarningMapper.selectDevIotWarningList(devIotWarning);
}

View File

@ -70,4 +70,32 @@ onMounted(() => {
.command{
cursor: pointer;
}
.el-dialog__body{
max-height: 720px !important;
overflow-y: scroll !important;
.el-form{
margin-right: 15px !important;
}
}
/* 自定义垂直滚动条 */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background-color: #FFF3EAEE !important;
}
::-webkit-scrollbar-thumb {
background-color: #FF990088 !important;
border-radius: 8px !important;
}
::-webkit-scrollbar-thumb:hover {
background-color: #FF9900EE !important;
}
.anchorBL{
display:none !important;
}
</style>

View File

@ -17,6 +17,14 @@ export function getIotConfig(id) {
})
}
// 配电箱配的点位信息
export function findIotConfigPoint(id) {
return request({
url: '/manage/iotConfig/findIotConfigPoint/' + id,
method: 'get'
})
}
// 新增配电箱配置
export function addIotConfig(data) {
return request({

View File

@ -3,7 +3,7 @@
<el-button type="primary" plain :icon="OfficeBuilding" @click="showProList">{{userStore.currentPrjId?userStore.currentProName:''}}</el-button>
<!--选择项目-->
<el-dialog v-model="dialogVisible" title="选择切换项目" width="800" modal-class="CurrentProjectDlg">
<el-dialog v-model="dialogVisible" title="选择切换项目" width="800" append-to-body>
<el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px">
<el-form-item label="项目名称" prop="projectName">
<el-input
@ -169,18 +169,4 @@ function initPage() {
}
initPage();
</script>
<style lang="scss">
.CurrentProjectDlg{
.el-dialog__body{
margin-top: -30px;
padding-bottom: 50px;
.pagination-container{
margin-top: 0px;
.el-pagination{
margin-right: 22px;
}
}
}
}
</style>
</script>

View File

@ -1,9 +1,11 @@
import hasRole from './permission/hasRole'
import hasPermi from './permission/hasPermi'
import notHasPermi from './permission/notHasPermi'
import copyText from './common/copyText'
export default function directive(app){
app.directive('hasRole', hasRole)
app.directive('hasPermi', hasPermi)
app.directive('notHasPermi', notHasPermi)
app.directive('copyText', copyText)
}

View File

@ -0,0 +1,28 @@
/**
* v-hasPermi 操作权限处理
* Copyright (c) 2019 ruoyi
*/
import useUserStore from '@/store/modules/user'
export default {
mounted(el, binding, vnode) {
const { value } = binding
const all_permission = "*:*:*";
const permissions = useUserStore().permissions
if (value && value instanceof Array && value.length > 0) {
const permissionFlag = value
const hasPermissions = permissions.some(permission => {
return !(all_permission === permission || permissionFlag.includes(permission))
})
if (!hasPermissions) {
el.parentNode && el.parentNode.removeChild(el)
}
} else {
throw new Error(`请设置操作权限标签值`)
}
}
}

View File

@ -29,6 +29,10 @@ export default {
hasPermi(permission) {
return authPermission(permission);
},
// 验证用户是否不具备某权限
notHasPermi(permission) {
return !authPermission(permission);
},
// 验证用户是否含有指定权限,只需包含其中一个
hasPermiOr(permissions) {
return permissions.some(item => {

View File

@ -1,6 +1,12 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryRef"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="项目名称" prop="projectName" v-if="!userStore.currentPrjId">
<el-input
v-model="queryParams.projectName"
@ -10,7 +16,11 @@
/>
</el-form-item>
<el-form-item label="设备厂商" prop="factoryName">
<el-select v-model="queryParams.factoryName" placeholder="请选择设备厂商" clearable>
<el-select
v-model="queryParams.factoryName"
placeholder="请选择设备厂商"
clearable
>
<el-option
v-for="dict in iot_factory_type"
:key="dict.value"
@ -33,7 +43,8 @@
icon="Plus"
@click="handleAdd"
v-hasPermi="['manage:iotConfig:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -43,7 +54,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['manage:iotConfig:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -53,7 +65,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['manage:iotConfig:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -62,29 +75,116 @@
icon="Download"
@click="handleExport"
v-hasPermi="['manage:iotConfig:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Refresh"
:disabled="single"
@click="handleRefreshPoint"
v-hasPermi="['manage:iotConfig:edit']"
>刷新设备</el-button
>
</el-col>
<right-toolbar
v-model:showSearch="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="iotConfigList" @selection-change="handleSelectionChange">
<el-alert title="配置说明" type="success">
<template #default>
<div>1新增的配置自动刷新设备</div>
<div>2修改配置后手动刷新设备或等待设备心跳后更新点位</div>
<div>3初始化失败的配置常见原因为通信账号通信密码不匹配</div>
</template>
</el-alert>
<el-table
v-loading="loading"
:data="iotConfigList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="所属公司" align="center" prop="comName" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="通信账号" align="center" prop="signalName" />
<el-table-column label="通信密码" align="center" prop="signalCode" />
<el-table-column label="设备厂商" align="center" prop="factoryName" />
<el-table-column label="数据状态" align="center" prop="isDel" />
<el-table-column label="操作" align="center" width="" class-name="small-padding fixed-width">
<el-table-column label="设备厂商" align="center" prop="factoryName" width="120">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:iotConfig:edit']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:iotConfig:remove']"></el-button>
<dict-tag :options="iot_factory_type" :value="scope.row.factoryName" />
</template>
</el-table-column>
<el-table-column
label="是否启用"
align="center"
prop="isDel"
width="120"
v-hasPermi="['manage:iotConfig:edit']"
>
<template #default="scope">
<el-tooltip
v-if="scope.row.isDel != '99'"
:content="scope.row.isDel == '0' ? '启用' : '停用'"
placement="top"
>
<el-switch
active-value="0"
inactive-value="1"
v-model="scope.row.isDel"
@change="setStatus($event, scope.row)"
/>
</el-tooltip>
<el-button v-else type="danger" link disabled>初始化失败</el-button>
</template>
</el-table-column>
<el-table-column
label="是否启用"
align="center"
prop="isDel"
width="120"
v-notHasPermi="['manage:iotConfig:edit']"
>
<template #default="scope">
<dict-tag
v-if="scope.row.isDel != '99'"
:options="sys_normal_disable"
:value="scope.row.isDel"
/>
<el-button v-else type="danger" link disabled>初始化失败</el-button>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
link
type="primary"
icon="Edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['manage:iotConfig:edit']"
>修改</el-button
>
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['manage:iotConfig:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@ -92,28 +192,30 @@
/>
<!-- 添加或修改配电箱配置对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form ref="iotConfigRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="公司主键" prop="comId">
<el-input v-model="form.comId" placeholder="请输入公司主键" />
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
<el-form-item label="项目名称" v-if="form.projectId">
<el-tag effect="plain">{{ form.projectName }}</el-tag>
</el-form-item>
<el-form-item label="通信账号" prop="signalName">
<el-input v-model="form.signalName" placeholder="请输入通信账号" />
<el-input v-model="form.signalName" placeholder="请输入通信账号" maxlength="64" show-word-limit/>
</el-form-item>
<el-form-item label="通信密码" prop="signalCode">
<el-input v-model="form.signalCode" placeholder="请输入通信密码" />
<el-input v-model="form.signalCode" placeholder="请输入通信密码" maxlength="64" show-word-limit/>
</el-form-item>
<el-form-item label="厂家名称" prop="factoryName">
<el-input v-model="form.factoryName" placeholder="请输入厂家名称" />
</el-form-item>
<el-form-item label="数据状态" prop="isDel">
<el-input v-model="form.isDel" placeholder="请输入数据状态" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
<el-form-item label="设备厂商" prop="factoryName">
<el-select
v-model="form.factoryName"
placeholder="请选择设备厂商"
style="width: 100%"
>
<el-option
v-for="dict in iot_factory_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
@ -127,13 +229,23 @@
</template>
<script setup name="IotConfig">
import { listIotConfig, getIotConfig, delIotConfig, addIotConfig, updateIotConfig } from "@/api/device/iotConfig";
import useUserStore from '@/store/modules/user'
import {
listIotConfig,
getIotConfig,
delIotConfig,
addIotConfig,
updateIotConfig,
findIotConfigPoint,
} from "@/api/device/iotConfig";
import useUserStore from "@/store/modules/user";
const { proxy } = getCurrentInstance();
const { iot_factory_type } = proxy.useDict('iot_factory_type');
const { sys_normal_disable, iot_factory_type } = proxy.useDict(
"sys_normal_disable",
"iot_factory_type"
);
const userStore = useUserStore()
const userStore = useUserStore();
const iotConfigList = ref([]);
const open = ref(false);
const loading = ref(true);
@ -157,7 +269,10 @@ const data = reactive({
isDel: null,
},
rules: {
}
signalName: [{ required: true, message: "通信账号不能为空", trigger: "blur" }],
signalCode: [{ required: true, message: "通信密码不能为空", trigger: "blur" }],
factoryName: [{ required: true, message: "设备厂商不能为空", trigger: "change" }],
},
});
const { queryParams, form, rules } = toRefs(data);
@ -165,7 +280,7 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询配电箱配置列表 */
function getList() {
loading.value = true;
listIotConfig(queryParams.value).then(response => {
listIotConfig(queryParams.value).then((response) => {
iotConfigList.value = response.rows;
total.value = response.total;
loading.value = false;
@ -192,7 +307,7 @@ function reset() {
createTime: null,
updateBy: null,
updateTime: null,
remark: null
remark: null,
};
proxy.resetForm("iotConfigRef");
}
@ -211,23 +326,31 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
if (!userStore.currentPrjId) {
proxy.$modal.msgWarning("请切换到项目数据!!!");
return false;
}
reset();
open.value = true;
form.value.comId = userStore.currentComId;
form.value.comName = userStore.currentComName;
form.value.projectId = userStore.currentPrjId;
form.value.projectName = userStore.currentProName;
title.value = "添加配电箱配置";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getIotConfig(_id).then(response => {
const _id = row.id || ids.value;
getIotConfig(_id).then((response) => {
form.value = response.data;
open.value = true;
title.value = "修改配电箱配置";
@ -236,41 +359,86 @@ function handleUpdate(row) {
/** 提交按钮 */
function submitForm() {
proxy.$refs["iotConfigRef"].validate(valid => {
proxy.$refs["iotConfigRef"].validate((valid) => {
if (valid) {
if (form.value.id != null) {
updateIotConfig(form.value).then(response => {
updateIotConfig(form.value).then((response) => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addIotConfig(form.value).then(response => {
addIotConfig(form.value).then((response) => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
getIotConfigPoint(response.data.id);
});
}
}
});
}
/** 状态滑块控制 */
function setStatus(val, row) {
proxy.$modal
.confirm(`是否确认${val == "0" ? "启用" : "停用"}当前数据项?`)
.then(function () {
let _data = { id: row.id, isDel: val };
return updateIotConfig(_data);
})
.then(() => {
getList();
proxy.$modal.msgSuccess("修改成功");
})
.catch(() => {
//
if (val == "0") {
row.isDel = "1";
} else {
row.isDel = "0";
}
});
}
/** 配电箱配的点位 */
function getIotConfigPoint(id) {
findIotConfigPoint(id).then((res) => {
getList();
if (res.code == 200) {
proxy.$modal.msgSuccess("初始化配置点位成功!!!");
}
});
}
/** 刷新点位操作 */
function handleRefreshPoint() {
getIotConfigPoint(ids.value);
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除配电箱配置编号为"' + _ids + '"的数据项?').then(function() {
return delIotConfig(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
proxy.$modal
.confirm('是否确认删除配电箱配置编号为"' + _ids + '"的数据项?')
.then(function () {
return delIotConfig(_ids);
})
.then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('manage/iotConfig/export', {
...queryParams.value
}, `iotConfig_${new Date().getTime()}.xlsx`)
proxy.download(
"manage/iotConfig/export",
{
...queryParams.value,
},
`iotConfig_${new Date().getTime()}.xlsx`
);
}
getList();

View File

@ -1,6 +1,12 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryRef"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="项目名称" prop="projectName" v-if="!userStore.currentPrjId">
<el-input
v-model="queryParams.projectName"
@ -9,26 +15,10 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="公司主键" prop="comId">
<el-input
v-model="queryParams.comId"
placeholder="请输入公司主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input
v-model="queryParams.projectId"
placeholder="请输入项目主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备序列号" prop="deviceSn">
<el-form-item label="设备编号" prop="deviceSn">
<el-input
v-model="queryParams.deviceSn"
placeholder="请输入设备序列号"
placeholder="请输入设备编号"
clearable
@keyup.enter="handleQuery"
/>
@ -41,21 +31,19 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="厂家名称" prop="factoryName">
<el-input
<el-form-item label="设备厂商" prop="factoryName">
<el-select
v-model="queryParams.factoryName"
placeholder="请输入厂家名称"
placeholder="请选择设备厂商"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="数据状态" prop="isDel">
<el-input
v-model="queryParams.isDel"
placeholder="请输入数据状态"
clearable
@keyup.enter="handleQuery"
/>
>
<el-option
v-for="dict in iot_factory_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
@ -71,7 +59,8 @@
icon="Plus"
@click="handleAdd"
v-hasPermi="['manage:iotConfigPoint:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -81,7 +70,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['manage:iotConfigPoint:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -91,7 +81,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['manage:iotConfigPoint:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
@ -100,41 +91,121 @@
icon="Download"
@click="handleExport"
v-hasPermi="['manage:iotConfigPoint:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
v-model:showSearch="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="iotConfigPointList" @selection-change="handleSelectionChange">
<el-alert title="配置点位说明" type="success">
<template #default>
<div>1配电箱点位依赖于配电箱配置</div>
<div>2手动新增的设备可能获取不到数据</div>
<div>3配电箱点位每小时获取设备心跳获取不到心跳则设备自动离线</div>
</template>
</el-alert>
<el-table
v-loading="loading"
:data="iotConfigPointList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="配置主键" align="center" prop="cfgId" />
<el-table-column label="公司主键" align="center" prop="comId" />
<el-table-column label="项目主键" align="center" prop="projectId" />
<el-table-column label="设备序列号" align="center" prop="deviceSn" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="厂家名称" align="center" prop="factoryName" />
<el-table-column label="联系人" align="center" prop="contactPerson" />
<el-table-column label="联系人电话" align="center" prop="contactPersonPhone" />
<el-table-column label="配电箱等级" align="center" prop="levels" />
<el-table-column label="漏电电流" align="center" prop="leakageCurrent" />
<el-table-column label="额定温度" align="center" prop="ratedTemperature" />
<el-table-column label="短路电流" align="center" prop="shortCircuitCurrent" />
<el-table-column label="额定电流" align="center" prop="ratedCurrent" />
<el-table-column label="额定电压" align="center" prop="ratedVoltage" />
<el-table-column label="在线状态" align="center" prop="onlineStatus" />
<el-table-column label="数据状态" align="center" prop="isDel" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="设备编号" align="center" prop="deviceSn" />
<el-table-column label="设备名称" align="center" prop="deviceName" width="100" />
<el-table-column label="设备厂商" align="center" prop="factoryName" width="88">
<template #default="scope">
<dict-tag :options="iot_factory_type" :value="scope.row.factoryName" />
</template>
</el-table-column>
<el-table-column label="联系人" align="center" prop="contactPerson" width="120">
<template #default="scope">
<div>{{ scope.row.contactPerson }}</div>
<div>{{ scope.row.contactPersonPhone }}</div>
</template>
</el-table-column>
<el-table-column label="配电箱等级" align="center" prop="levels" width="120" />
<el-table-column label="漏电电流" align="center" prop="leakageCurrent" width="88" />
<el-table-column
label="额定温度"
align="center"
prop="ratedTemperature"
width="88"
/>
<el-table-column
label="短路电流"
align="center"
prop="shortCircuitCurrent"
width="88"
/>
<el-table-column label="额定电流" align="center" prop="ratedCurrent" width="88" />
<el-table-column label="额定电压" align="center" prop="ratedVoltage" width="88" />
<el-table-column label="设备状态" align="center" prop="onlineStatus" width="88">
<template #default="scope">
<dict-tag :options="iot_online_status" :value="scope.row.onlineStatus" />
</template>
</el-table-column>
<el-table-column
label="是否启用"
align="center"
prop="isDel"
width="100"
v-hasPermi="['manage:iotConfig:edit']"
>
<template #default="scope">
<el-tooltip :content="scope.row.isDel == '0' ? '启用' : '停用'" placement="top">
<el-switch
active-value="0"
inactive-value="1"
v-model="scope.row.isDel"
@change="setStatus($event, scope.row)"
/>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
label="是否启用"
align="center"
prop="isDel"
width="100"
v-notHasPermi="['manage:iotConfig:edit']"
>
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.isDel" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="130">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:iotConfigPoint:edit']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:iotConfigPoint:remove']"></el-button>
<el-button
link
type="primary"
icon="Edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['manage:iotConfigPoint:edit']"
>修改</el-button
>
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['manage:iotConfigPoint:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@ -142,55 +213,124 @@
/>
<!-- 添加或修改配电箱配置对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="iotConfigPointRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="配置主键" prop="cfgId">
<el-input v-model="form.cfgId" placeholder="请输入配置主键" />
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
<el-form ref="iotConfigPointRef" :model="form" :rules="rules" label-width="100px">
<el-form-item label="项目名称" v-if="form.projectId">
<el-tag effect="plain">{{ form.projectName }}</el-tag>
</el-form-item>
<el-form-item label="公司主键" prop="comId">
<el-input v-model="form.comId" placeholder="请输入公司主键" />
<el-form-item label="所属配置" prop="cfgId">
<el-select
v-model="form.cfgId"
placeholder="请选择所属配置"
style="width: 100%"
>
<el-option
v-for="cfg in cfgList"
:key="cfg.id"
:label="cfg.signalName"
:value="cfg.id"
/>
</el-select>
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
</el-form-item>
<el-form-item label="设备序列号" prop="deviceSn">
<el-input v-model="form.deviceSn" placeholder="请输入设备序列号" />
<el-form-item label="设备编号" prop="deviceSn">
<el-input
v-model="form.deviceSn"
placeholder="请输入设备编号"
maxlength="32"
show-word-limit
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
<el-input
v-model="form.deviceName"
placeholder="请输入设备名称"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="厂家名称" prop="factoryName">
<el-input v-model="form.factoryName" placeholder="请输入厂家名称" />
<el-form-item label="设备厂商" prop="factoryName">
<el-select
v-model="form.factoryName"
placeholder="请选择设备厂商"
style="width: 100%"
>
<el-option
v-for="dict in iot_factory_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="联系人" prop="contactPerson">
<el-input v-model="form.contactPerson" placeholder="请输入联系人" />
<el-input
v-model="form.contactPerson"
placeholder="请输入联系人"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="联系人电话" prop="contactPersonPhone">
<el-input v-model="form.contactPersonPhone" placeholder="请输入联系人电话" />
<el-input
v-model="form.contactPersonPhone"
placeholder="请输入联系人电话"
maxlength="11"
show-word-limit
/>
</el-form-item>
<el-form-item label="配电箱等级" prop="levels">
<el-input v-model="form.levels" placeholder="请输入配电箱等级" />
<el-select
v-model="form.levels"
placeholder="请选择配电箱等级"
style="width: 100%"
>
<el-option
v-for="dict in dev_iot_levels"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="漏电电流" prop="leakageCurrent">
<el-input v-model="form.leakageCurrent" placeholder="请输入漏电电流" />
<el-input
v-model="form.leakageCurrent"
placeholder="请输入漏电电流"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="额定温度" prop="ratedTemperature">
<el-input v-model="form.ratedTemperature" placeholder="请输入额定温度" />
<el-input
v-model="form.ratedTemperature"
placeholder="请输入额定温度"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="短路电流" prop="shortCircuitCurrent">
<el-input v-model="form.shortCircuitCurrent" placeholder="请输入短路电流" />
<el-input
v-model="form.shortCircuitCurrent"
placeholder="请输入短路电流"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="额定电流" prop="ratedCurrent">
<el-input v-model="form.ratedCurrent" placeholder="请输入额定电流" />
<el-input
v-model="form.ratedCurrent"
placeholder="请输入额定电流"
maxlength="16"
show-word-limit
/>
</el-form-item>
<el-form-item label="额定电压" prop="ratedVoltage">
<el-input v-model="form.ratedVoltage" placeholder="请输入额定电压" />
</el-form-item>
<el-form-item label="数据状态" prop="isDel">
<el-input v-model="form.isDel" placeholder="请输入数据状态" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
<el-input
v-model="form.ratedVoltage"
placeholder="请输入额定电压"
maxlength="16"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
@ -204,13 +344,30 @@
</template>
<script setup name="IotConfigPoint">
import { listIotConfigPoint, getIotConfigPoint, delIotConfigPoint, addIotConfigPoint, updateIotConfigPoint } from "@/api/device/iotConfigPoint";
import useUserStore from '@/store/modules/user'
import { listIotConfig } from "@/api/device/iotConfig";
import {
listIotConfigPoint,
getIotConfigPoint,
delIotConfigPoint,
addIotConfigPoint,
updateIotConfigPoint,
} from "@/api/device/iotConfigPoint";
import useUserStore from "@/store/modules/user";
const { proxy } = getCurrentInstance();
const { iot_factory_type } = proxy.useDict('iot_factory_type');
const {
sys_normal_disable,
iot_factory_type,
dev_iot_levels,
iot_online_status,
} = proxy.useDict(
"sys_normal_disable",
"iot_factory_type",
"dev_iot_levels",
"iot_online_status"
);
const userStore = useUserStore()
const userStore = useUserStore();
const iotConfigPointList = ref([]);
const open = ref(false);
const loading = ref(true);
@ -220,6 +377,7 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const cfgList = ref([]);
const data = reactive({
form: {},
@ -236,7 +394,23 @@ const data = reactive({
isDel: null,
},
rules: {
}
cfgId: [{ required: true, message: "所属配置不能为空", trigger: "change" }],
deviceSn: [{ required: true, message: "设备编号不能为空", trigger: "blur" }],
deviceName: [{ required: true, message: "设备名称不能为空", trigger: "blur" }],
factoryName: [{ required: true, message: "设备厂商不能为空", trigger: "change" }],
contactPerson: [{ required: false, message: "联系人不能为空", trigger: "blur" }],
contactPersonPhone: [
{ required: false, message: "联系人电话不能为空", trigger: "blur" },
],
levels: [{ required: true, message: "配电箱等级不能为空", trigger: "change" }],
leakageCurrent: [{ required: true, message: "漏电电流不能为空", trigger: "blur" }],
ratedTemperature: [{ required: true, message: "额定温度不能为空", trigger: "blur" }],
shortCircuitCurrent: [
{ required: true, message: "短路电流不能为空", trigger: "blur" },
],
ratedCurrent: [{ required: true, message: "额定电流不能为空", trigger: "blur" }],
ratedVoltage: [{ required: true, message: "额定电压不能为空", trigger: "blur" }],
},
});
const { queryParams, form, rules } = toRefs(data);
@ -244,7 +418,7 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询配电箱配置列表 */
function getList() {
loading.value = true;
listIotConfigPoint(queryParams.value).then(response => {
listIotConfigPoint(queryParams.value).then((response) => {
iotConfigPointList.value = response.rows;
total.value = response.total;
loading.value = false;
@ -281,7 +455,7 @@ function reset() {
createTime: null,
updateBy: null,
updateTime: null,
remark: null
remark: null,
};
proxy.resetForm("iotConfigPointRef");
}
@ -300,41 +474,49 @@ function resetQuery() {
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
if (!userStore.currentPrjId) {
proxy.$modal.msgWarning("请切换到项目数据!!!");
return false;
}
reset();
open.value = true;
title.value = "添加配电箱配置";
form.value.comId = userStore.currentComId;
form.value.comName = userStore.currentComName;
form.value.projectId = userStore.currentPrjId;
form.value.projectName = userStore.currentProName;
title.value = "添加配电箱点位";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getIotConfigPoint(_id).then(response => {
const _id = row.id || ids.value;
getIotConfigPoint(_id).then((response) => {
form.value = response.data;
open.value = true;
title.value = "修改配电箱配置";
title.value = "修改配电箱点位";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["iotConfigPointRef"].validate(valid => {
proxy.$refs["iotConfigPointRef"].validate((valid) => {
if (valid) {
if (form.value.id != null) {
updateIotConfigPoint(form.value).then(response => {
updateIotConfigPoint(form.value).then((response) => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addIotConfigPoint(form.value).then(response => {
addIotConfigPoint(form.value).then((response) => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
@ -344,23 +526,62 @@ function submitForm() {
});
}
/** 状态滑块控制 */
function setStatus(val, row) {
proxy.$modal
.confirm(`是否确认${val == "0" ? "启用" : "停用"}当前数据项?`)
.then(function () {
let _data = { id: row.id, isDel: val };
return updateIotConfigPoint(_data);
})
.then(() => {
getList();
proxy.$modal.msgSuccess("修改成功");
})
.catch(() => {
//
if (val == "0") {
row.isDel = "1";
} else {
row.isDel = "0";
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除配电箱配置编号为"' + _ids + '"的数据项?').then(function() {
return delIotConfigPoint(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
proxy.$modal
.confirm('是否确认删除配电箱配置编号为"' + _ids + '"的数据项?')
.then(function () {
return delIotConfigPoint(_ids);
})
.then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('manage/iotConfigPoint/export', {
...queryParams.value
}, `iotConfigPoint_${new Date().getTime()}.xlsx`)
proxy.download(
"manage/iotConfigPoint/export",
{
...queryParams.value,
},
`iotConfigPoint_${new Date().getTime()}.xlsx`
);
}
/** 初始化 */
function init() {
let _param = { pageNum: 1, pageSize: 10 };
listIotConfig(_param).then((res) => {
cfgList.value = res.rows;
});
}
init();
getList();
</script>

View File

@ -9,39 +9,15 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="点位主键" prop="pointId">
<el-input
v-model="queryParams.pointId"
placeholder="请输入点位主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="公司主键" prop="comId">
<el-input
v-model="queryParams.comId"
placeholder="请输入公司主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input
v-model="queryParams.projectId"
placeholder="请输入项目主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备序列号" prop="deviceSn">
<el-form-item label="设备编号" prop="deviceSn">
<el-input
v-model="queryParams.deviceSn"
placeholder="请输入设备序列号"
placeholder="请输入设备编号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间" style="width: 308px">
<el-form-item label="上报时间" style="width: 308px">
<el-date-picker
v-model="daterangeCreateTime"
value-format="YYYY-MM-DD"
@ -57,7 +33,7 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-row v-if="false" :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
@ -99,44 +75,31 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="iotDatasList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="配置主键" align="center" prop="cfgId" />
<el-table-column label="点位主键" align="center" prop="pointId" />
<el-table-column label="公司主键" align="center" prop="comId" />
<el-table-column label="项目主键" align="center" prop="projectId" />
<el-table-column label="设备序列号" align="center" prop="deviceSn" />
<el-table-column label="开关位_交流" align="center" prop="switchesAc" />
<el-table-column label="开关位" align="center" prop="switchesSwitch" />
<el-table-column label="开关位状态" align="center" prop="switchesSwitches" />
<el-table-column label="开关位安装状态" align="center" prop="switchesSwitchstatus" />
<el-table-column label="温度检测数据" align="center" prop="temperature" />
<el-table-column label="漏电检测数据" align="center" prop="leakage" />
<el-table-column label="A相电压" align="center" prop="voltageA" />
<el-table-column label="B相电压" align="center" prop="voltageB" />
<el-table-column label="C相电压" align="center" prop="voltageC" />
<el-table-column label="A相与B相之间的电压" align="center" prop="voltageAb" />
<el-table-column label="B相与C相之间的电压" align="center" prop="voltageBc" />
<el-table-column label="C相与A相之间的电压" align="center" prop="voltageCa" />
<el-table-column label="A相电流" align="center" prop="currentA" />
<el-table-column label="B相电流" align="center" prop="currentB" />
<el-table-column label="C相电流" align="center" prop="currentC" />
<el-table-column label="A相功率" align="center" prop="powerA" />
<el-table-column label="B相功率" align="center" prop="powerB" />
<el-table-column label="C相功率" align="center" prop="powerC" />
<el-table-column label="A相累计能量" align="center" prop="energyA" />
<el-table-column label="B相累计能量" align="center" prop="energyB" />
<el-table-column label="C相累计能量" align="center" prop="energyC" />
<el-table-column label="A相功率因数" align="center" prop="factorA" />
<el-table-column label="B相功率因数" align="center" prop="factorB" />
<el-table-column label="C相功率因数" align="center" prop="factorC" />
<el-table-column label="A相频率" align="center" prop="frequencyA" />
<el-table-column label="B相频率" align="center" prop="frequencyB" />
<el-table-column label="C相频率" align="center" prop="frequencyC" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table v-loading="loading" :data="iotDatasList">
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="设备编号" align="center" prop="deviceSn" width="88"/>
<el-table-column label="实时温度" align="center" prop="temperature" width="88"/>
<el-table-column label="漏电监测" align="center" prop="leakage" width="88"/>
<el-table-column label="A相电压" align="center" prop="voltageA" width="100" />
<el-table-column label="B相电压" align="center" prop="voltageB" width="100" />
<el-table-column label="C相电压" align="center" prop="voltageC" width="100" />
<el-table-column label="A相电流" align="center" prop="currentA" width="98" />
<el-table-column label="B相电流" align="center" prop="currentB" width="98" />
<el-table-column label="C相电流" align="center" prop="currentC" width="98" />
<el-table-column label="A相功率" align="center" prop="powerA" width="88" />
<el-table-column label="B相功率" align="center" prop="powerB" width="88" />
<el-table-column label="C相功率" align="center" prop="powerC" width="88" />
<el-table-column label="A相频率" align="center" prop="frequencyA" width="88" v-if="false"/>
<el-table-column label="B相频率" align="center" prop="frequencyB" width="88" v-if="false"/>
<el-table-column label="C相频率" align="center" prop="frequencyC" width="88" v-if="false"/>
<el-table-column label="上报时间" align="center" prop="createTime" width="150">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:iotDatas:edit']"></el-button>
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}") }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width">
<template #default="scope">
<el-button v-if="false" link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:iotDatas:edit']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:iotDatas:remove']"></el-button>
</template>
</el-table-column>

View File

@ -9,45 +9,31 @@
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="点位主键" prop="pointId">
<el-input
v-model="queryParams.pointId"
placeholder="请输入点位主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="公司主键" prop="comId">
<el-input
v-model="queryParams.comId"
placeholder="请输入公司主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="项目主键" prop="projectId">
<el-input
v-model="queryParams.projectId"
placeholder="请输入项目主键"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="设备序列号" prop="deviceSn">
<el-form-item label="设备编号" prop="deviceSn">
<el-input
v-model="queryParams.deviceSn"
placeholder="请输入设备序列号"
placeholder="请输入设备编号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="预警时间" style="width: 308px">
<el-date-picker
v-model="daterangeCreateTime"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-row v-if="false" :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
@ -89,19 +75,15 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="iotWarningList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="配置主键" align="center" prop="cfgId" />
<el-table-column label="点位主键" align="center" prop="pointId" />
<el-table-column label="公司主键" align="center" prop="comId" />
<el-table-column label="项目主键" align="center" prop="projectId" />
<el-table-column label="设备序列号" align="center" prop="deviceSn" />
<el-table v-loading="loading" :data="iotWarningList">
<el-table-column label="预警编号" align="center" prop="id" width="88"/>
<el-table-column label="项目名称" align="center" prop="projectName" />
<el-table-column label="设备编号" align="center" prop="deviceSn" width="100"/>
<el-table-column label="预警类型" align="center" prop="warningType" />
<el-table-column label="预警内容" align="center" prop="warningContent" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:iotWarning:edit']"></el-button>
<el-button v-if="false" link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:iotWarning:edit']"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:iotWarning:remove']"></el-button>
</template>
</el-table-column>
@ -163,6 +145,7 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const daterangeCreateTime = ref([]);
const data = reactive({
form: {},
@ -186,6 +169,11 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询配电箱预警列表 */
function getList() {
loading.value = true;
queryParams.value.params = {};
if (null != daterangeCreateTime && '' != daterangeCreateTime) {
queryParams.value.params["beginCreateTime"] = daterangeCreateTime.value[0];
queryParams.value.params["endCreateTime"] = daterangeCreateTime.value[1];
}
listIotWarning(queryParams.value).then(response => {
iotWarningList.value = response.rows;
total.value = response.total;
@ -217,6 +205,7 @@ function reset() {
/** 搜索按钮操作 */
function handleQuery() {
daterangeCreateTime.value = [];
queryParams.value.pageNum = 1;
getList();
}

View File

@ -156,7 +156,7 @@
/>
<!-- 添加或修改用户试卷对话框 -->
<el-dialog :title="title" v-model="open" width="880px" append-to-body modal-class="busExamUserDlg">
<el-dialog :title="title" v-model="open" width="880px" append-to-body>
<el-row class="task_panel">
<el-col :span="6">
<el-statistic class="statistic_div">
@ -468,13 +468,6 @@ getList();
color: #409eff;
font-weight: 800;
}
.busExamUserDlg{
.el-dialog__body{
margin-top: -25px;
overflow: auto;
max-height: 680px;
}
}
.task_panel {
text-align: center;
margin-bottom: 20px;

View File

@ -543,12 +543,6 @@ getList();
margin:2px 3px;
}
}
.bus-training-video-dlg{
.el-dialog__body{
overflow: auto;
max-height: 680px;
}
}
.bus-training-video-index{
.fitem-craft-type{
.el-select{

View File

@ -206,7 +206,6 @@
v-model="open"
width="680px"
append-to-body
modal-class="SubdeptsDlg"
>
<el-form
ref="proProjectInfoSubdeptsRef"
@ -742,11 +741,4 @@ getList();
color: #409eff;
font-weight: 800;
}
.SubdeptsDlg {
.el-dialog__body {
overflow: auto;
max-height: 680px;
}
}
</style>

View File

@ -152,7 +152,7 @@
</el-dialog>
<!-- 添加或修改单位班组对话框 -->
<el-dialog :title="leaderTitle" v-model="leaderOpen" width="680px" append-to-body modal-class="SubdeptsGroupDlg">
<el-dialog :title="leaderTitle" v-model="leaderOpen" width="680px" append-to-body>
<el-form ref="proProjectInfoSubdeptsGroupRef" :model="leaderForm" :rules="leaderRules" label-width="88px">
<el-form-item label="项目名称">
<el-tag effect="plain">{{ leaderForm.projectName }}</el-tag>
@ -428,12 +428,4 @@ getList();
color: #409eff;
font-weight: 800;
}
.SubdeptsDlg {
.el-dialog__body {
margin-top: -25px;
overflow: auto;
max-height: 680px;
}
}
</style>