LoRa Packet Forwarder 代码提交
This commit is contained in:
parent
28d7284999
commit
868ba69dba
1
pom.xml
1
pom.xml
@ -231,6 +231,7 @@
|
||||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</module>
|
||||
<module>ruoyi-radius</module>
|
||||
<module>ruoyi-gateway</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
@ -87,6 +87,11 @@
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-radius</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-gateway</artifactId>
|
||||
<version>4.6.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
47
ruoyi-gateway/pom.xml
Normal file
47
ruoyi-gateway/pom.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>4.6.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ruoyi-gateway</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- 通用工具 -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
<!-- 核心模块 -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.4.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,52 @@
|
||||
package com.ruoyi.gateway.lora.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.gateway.lora.domain.GatewayAgreement;
|
||||
import com.ruoyi.gateway.lora.service.IGatewayAgreementService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author xusd
|
||||
* @Date 2024/7/24 11:52
|
||||
**/
|
||||
@Controller
|
||||
@RequestMapping("/lora/agreement")
|
||||
public class AgreementController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IGatewayAgreementService gatewayAgreementService;
|
||||
|
||||
private String prefix = "lora/agreement";
|
||||
|
||||
@RequiresPermissions("lora:agreement:view")
|
||||
@GetMapping()
|
||||
public String agreement(ModelMap mmap) {
|
||||
GatewayAgreement gatewayAgreement = gatewayAgreementService.selectGatewayAgreementById(null);
|
||||
if (Objects.isNull(gatewayAgreement)){
|
||||
gatewayAgreement = new GatewayAgreement();
|
||||
}
|
||||
mmap.put("gatewayAgreement", gatewayAgreement);
|
||||
return prefix + "/agreement";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存
|
||||
*/
|
||||
@RequiresPermissions("system:agreement:edit")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult edit(GatewayAgreement gatewayAgreement) {
|
||||
return toAjax(gatewayAgreementService.updateGatewayAgreement(gatewayAgreement));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
package com.ruoyi.gateway.lora.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author xusd
|
||||
* @Date 2024/7/29 10:40
|
||||
**/
|
||||
@Data
|
||||
public class GatewayAgreement extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
private String agreementType;
|
||||
|
||||
/** mqtt 服务器地址 */
|
||||
@Excel(name = "mqtt 服务器地址")
|
||||
private String mqttAddress;
|
||||
|
||||
/** mqtt 服务器端口 */
|
||||
@Excel(name = "mqtt 服务器端口")
|
||||
private String mqttPort;
|
||||
|
||||
/** mqtt 客户端标识符 */
|
||||
@Excel(name = "mqtt 客户端标识符")
|
||||
private String mqttFlag;
|
||||
|
||||
/** mqtt 用户名 */
|
||||
@Excel(name = "mqtt 用户名")
|
||||
private String mqttUser;
|
||||
|
||||
/** mqtt 密码 */
|
||||
@Excel(name = "mqtt 密码")
|
||||
private String mqttPassword;
|
||||
|
||||
/** mqtt 清理会话 */
|
||||
@Excel(name = "mqtt 清理会话")
|
||||
private String mqttClean;
|
||||
|
||||
/** mqtt 遗嘱消息 */
|
||||
@Excel(name = "mqtt 遗嘱消息")
|
||||
private String mqttDieMsg;
|
||||
|
||||
/** mqtt 保持活动 */
|
||||
@Excel(name = "mqtt 保持活动")
|
||||
private String mqttKeep;
|
||||
|
||||
/** mqtt 心跳时间 */
|
||||
@Excel(name = "mqtt 心跳时间")
|
||||
private String mqttHeartbeat;
|
||||
|
||||
/** mqtt 主题 */
|
||||
@Excel(name = "mqtt 主题")
|
||||
private String mqttTopic;
|
||||
|
||||
/** socket Domain(协议族) */
|
||||
@Excel(name = "socket Domain", readConverterExp = "协=议族")
|
||||
private String socketDomain;
|
||||
|
||||
/** socket Type(套接字类型) */
|
||||
@Excel(name = "socket Type", readConverterExp = "套=接字类型")
|
||||
private String socketType;
|
||||
|
||||
/** socket Protocol(协议) */
|
||||
@Excel(name = "socket Protocol", readConverterExp = "协=议")
|
||||
private String socketProtocol;
|
||||
|
||||
/** socket Address(地址) */
|
||||
@Excel(name = "socket Address", readConverterExp = "地=址")
|
||||
private String socketAddress;
|
||||
|
||||
/** Modbus RTU 串口号 */
|
||||
@Excel(name = "Modbus RTU 串口号")
|
||||
private String rtuSerialPort;
|
||||
|
||||
/** Modbus RTU 波特率 */
|
||||
@Excel(name = "Modbus RTU 波特率")
|
||||
private String rtuBaud;
|
||||
|
||||
/** Modbus RTU 数据位 */
|
||||
@Excel(name = "Modbus RTU 数据位")
|
||||
private String rtuDataBits;
|
||||
|
||||
/** Modbus RTU 校验位 */
|
||||
@Excel(name = "Modbus RTU 校验位")
|
||||
private String rtuCheckBit;
|
||||
|
||||
/** Modbus RTU 停止位 */
|
||||
@Excel(name = "Modbus RTU 停止位")
|
||||
private String rtuStopBit;
|
||||
|
||||
/** Modbus TCP IP地址 */
|
||||
@Excel(name = "Modbus TCP IP地址")
|
||||
private String tcpAddress;
|
||||
|
||||
/** Modbus TCP 端口 */
|
||||
@Excel(name = "Modbus TCP 端口")
|
||||
private String tcpPort;
|
||||
|
||||
/** Modbus TCP 连接超时时间 */
|
||||
@Excel(name = "Modbus TCP 连接超时时间")
|
||||
private String tcpConnectionTimeout;
|
||||
|
||||
/** Modbus TCP 读取超时时间 */
|
||||
@Excel(name = "Modbus TCP 读取超时时间")
|
||||
private String tcpReadTimeout;
|
||||
|
||||
/** Modbus TCP 最大连接数 */
|
||||
@Excel(name = "Modbus TCP 最大连接数")
|
||||
private String tcpMaxConnection;
|
||||
|
||||
/** Modbus TCP 心跳间隔 */
|
||||
@Excel(name = "Modbus TCP 心跳间隔")
|
||||
private String tcpHeartbeatInterval;
|
||||
|
||||
/** Modbus TCP 数据包最大长度 */
|
||||
@Excel(name = "Modbus TCP 数据包最大长度")
|
||||
private String tcpMaxPpacket;
|
||||
|
||||
/** Modbus TCP 地址映射表 */
|
||||
@Excel(name = "Modbus TCP 地址映射表")
|
||||
private String tcpAddressMapping;
|
||||
|
||||
/** Fanuc IP地址 */
|
||||
@Excel(name = "Fanuc IP地址")
|
||||
private String fanucAddress;
|
||||
|
||||
/** Fanuc 子网掩码 */
|
||||
@Excel(name = "Fanuc 子网掩码")
|
||||
private String fanucMask;
|
||||
|
||||
/** Fanuc 网关地址 */
|
||||
@Excel(name = "Fanuc 网关地址")
|
||||
private String fanucGatewayAddress;
|
||||
|
||||
/** Fanuc DNS */
|
||||
@Excel(name = "Fanuc DNS")
|
||||
private String fanucDns;
|
||||
|
||||
/** Fanuc VLAN */
|
||||
@Excel(name = "Fanuc VLAN")
|
||||
private String fanucVlan;
|
||||
|
||||
/** Fanuc SNMP */
|
||||
@Excel(name = "Fanuc SNMP")
|
||||
private String fanucSnmp;
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.gateway.lora.mapper;
|
||||
|
||||
import com.ruoyi.gateway.lora.domain.GatewayAgreement;
|
||||
|
||||
/**
|
||||
* @Author xusd
|
||||
* @Date 2024/7/29 10:51
|
||||
**/
|
||||
public interface GatewayAgreementMapper {
|
||||
|
||||
GatewayAgreement selectGatewayAgreementById(Long id);
|
||||
|
||||
int updateGatewayAgreement(GatewayAgreement gatewayAgreement);
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.ruoyi.gateway.lora.service;
|
||||
|
||||
import com.ruoyi.gateway.lora.domain.GatewayAgreement;
|
||||
|
||||
/**
|
||||
* @Author xusd
|
||||
* @Date 2024/7/29 10:46
|
||||
**/
|
||||
public interface IGatewayAgreementService {
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param id id
|
||||
* @return com.ruoyi.gateway.lora.domain.GatewayAgreement
|
||||
*/
|
||||
GatewayAgreement selectGatewayAgreementById(Long id);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param gatewayAgreement 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
int updateGatewayAgreement(GatewayAgreement gatewayAgreement);
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.ruoyi.gateway.lora.service.impl;
|
||||
|
||||
import com.ruoyi.gateway.lora.domain.GatewayAgreement;
|
||||
import com.ruoyi.gateway.lora.mapper.GatewayAgreementMapper;
|
||||
import com.ruoyi.gateway.lora.service.IGatewayAgreementService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author xusd
|
||||
* @Date 2024/7/29 10:49
|
||||
**/
|
||||
@Service
|
||||
public class GatewayAgreementServiceImpl implements IGatewayAgreementService {
|
||||
|
||||
@Autowired
|
||||
private GatewayAgreementMapper gatewayAgreementMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public GatewayAgreement selectGatewayAgreementById(Long id) {
|
||||
return gatewayAgreementMapper.selectGatewayAgreementById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateGatewayAgreement(GatewayAgreement gatewayAgreement) {
|
||||
if("2".equals(gatewayAgreement.getMqttKeep())){
|
||||
gatewayAgreement.setMqttHeartbeat("0");
|
||||
}
|
||||
return gatewayAgreementMapper.updateGatewayAgreement(gatewayAgreement);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.gateway.lora.mapper.GatewayAgreementMapper">
|
||||
|
||||
<resultMap type="GatewayAgreement" id="GatewayAgreementResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="agreementType" column="agreement_type" />
|
||||
<result property="mqttAddress" column="mqtt_address" />
|
||||
<result property="mqttPort" column="mqtt_port" />
|
||||
<result property="mqttFlag" column="mqtt_flag" />
|
||||
<result property="mqttUser" column="mqtt_user" />
|
||||
<result property="mqttPassword" column="mqtt_password" />
|
||||
<result property="mqttClean" column="mqtt_clean" />
|
||||
<result property="mqttDieMsg" column="mqtt_die_msg" />
|
||||
<result property="mqttKeep" column="mqtt_keep" />
|
||||
<result property="mqttHeartbeat" column="mqtt_heartbeat" />
|
||||
<result property="mqttTopic" column="mqtt_topic" />
|
||||
<result property="socketDomain" column="socket_domain" />
|
||||
<result property="socketType" column="socket_type" />
|
||||
<result property="socketProtocol" column="socket_protocol" />
|
||||
<result property="socketAddress" column="socket_address" />
|
||||
<result property="rtuSerialPort" column="rtu_serial_port" />
|
||||
<result property="rtuBaud" column="rtu_baud" />
|
||||
<result property="rtuDataBits" column="rtu_data_bits" />
|
||||
<result property="rtuCheckBit" column="rtu_check_bit" />
|
||||
<result property="rtuStopBit" column="rtu_stop_bit" />
|
||||
<result property="tcpAddress" column="tcp_address" />
|
||||
<result property="tcpPort" column="tcp_port" />
|
||||
<result property="tcpConnectionTimeout" column="tcp_connection_timeout" />
|
||||
<result property="tcpReadTimeout" column="tcp_read_timeout" />
|
||||
<result property="tcpMaxConnection" column="tcp_max_connection" />
|
||||
<result property="tcpHeartbeatInterval" column="tcp_heartbeat_interval" />
|
||||
<result property="tcpMaxPpacket" column="tcp_max_ppacket" />
|
||||
<result property="tcpAddressMapping" column="tcp_address_mapping" />
|
||||
<result property="fanucAddress" column="fanuc_address" />
|
||||
<result property="fanucMask" column="fanuc_mask" />
|
||||
<result property="fanucGatewayAddress" column="fanuc_gateway_address" />
|
||||
<result property="fanucDns" column="fanuc_dns" />
|
||||
<result property="fanucVlan" column="fanuc_vlan" />
|
||||
<result property="fanucSnmp" column="fanuc_snmp" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGatewayAgreementVo">
|
||||
select id, agreement_type,mqtt_address, mqtt_port, mqtt_flag, mqtt_user, mqtt_password, mqtt_clean, mqtt_die_msg, mqtt_keep, mqtt_heartbeat, mqtt_topic, socket_domain, socket_type, socket_protocol, socket_address, rtu_serial_port, rtu_baud, rtu_data_bits, rtu_check_bit, rtu_stop_bit, tcp_address, tcp_port, tcp_connection_timeout, tcp_read_timeout, tcp_max_connection, tcp_heartbeat_interval, tcp_max_ppacket, tcp_address_mapping, fanuc_address, fanuc_mask, fanuc_gateway_address, fanuc_dns, fanuc_vlan, fanuc_snmp from gateway_agreement
|
||||
</sql>
|
||||
|
||||
<select id="selectGatewayAgreementById" parameterType="Long" resultMap="GatewayAgreementResult">
|
||||
<include refid="selectGatewayAgreementVo"/>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateGatewayAgreement" parameterType="GatewayAgreement">
|
||||
update gateway_agreement
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
agreement_type = #{agreementType},
|
||||
mqtt_address = #{mqttAddress},
|
||||
mqtt_port = #{mqttPort},
|
||||
mqtt_flag = #{mqttFlag},
|
||||
mqtt_user = #{mqttUser},
|
||||
mqtt_password = #{mqttPassword},
|
||||
mqtt_clean = #{mqttClean},
|
||||
mqtt_die_msg = #{mqttDieMsg},
|
||||
mqtt_keep = #{mqttKeep},
|
||||
mqtt_heartbeat = #{mqttHeartbeat},
|
||||
mqtt_topic = #{mqttTopic},
|
||||
socket_domain = #{socketDomain},
|
||||
socket_type = #{socketType},
|
||||
socket_protocol = #{socketProtocol},
|
||||
socket_address = #{socketAddress},
|
||||
rtu_serial_port = #{rtuSerialPort},
|
||||
rtu_baud = #{rtuBaud},
|
||||
rtu_data_bits = #{rtuDataBits},
|
||||
rtu_check_bit = #{rtuCheckBit},
|
||||
rtu_stop_bit = #{rtuStopBit},
|
||||
tcp_address = #{tcpAddress},
|
||||
tcp_port = #{tcpPort},
|
||||
tcp_connection_timeout = #{tcpConnectionTimeout},
|
||||
tcp_read_timeout = #{tcpReadTimeout},
|
||||
tcp_max_connection = #{tcpMaxConnection},
|
||||
tcp_heartbeat_interval = #{tcpHeartbeatInterval},
|
||||
tcp_max_ppacket = #{tcpMaxPpacket},
|
||||
tcp_address_mapping = #{tcpAddressMapping},
|
||||
fanuc_address = #{fanucAddress},
|
||||
fanuc_mask = #{fanucMask},
|
||||
fanuc_gateway_address = #{fanucGatewayAddress},
|
||||
fanuc_dns = #{fanucDns},
|
||||
fanuc_vlan = #{fanucVlan},
|
||||
fanuc_snmp = #{fanucSnmp},
|
||||
</trim>
|
||||
</update>
|
||||
</mapper>
|
@ -0,0 +1,370 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('套餐管理列表')"/>
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div style="border-bottom: darkgray 1px solid;margin: 20px 50px 0px;">
|
||||
<div style="width: 100px;height: 30px;background: darkgray;text-align: center;line-height: 30px;user-select: none;">基本设置</div>
|
||||
</div>
|
||||
<div style="margin-left: 300px;margin-right: 300px;">
|
||||
<form class="form-horizontal m" id="form" th:object="${gatewayAgreement}">
|
||||
<input name="id" th:field="*{id}" type="hidden">
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">协议:</label>-->
|
||||
<!-- <div class="col-sm-9">-->
|
||||
<!-- <select class="form-control" id="agreement" name="agreementType">-->
|
||||
<!-- <option value="1">MQTT</option>-->
|
||||
<!-- <option value="2">Socket</option>-->
|
||||
<!-- <option value="3">Modbus RTU</option>-->
|
||||
<!-- <option value="4">Modbus TCP</option>-->
|
||||
<!-- <option value="5">Fanuc</option>-->
|
||||
<!-- </select>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">协议类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="agreementType" id="agreement" class="form-control m-b" th:with="type=${@dict.getType('gateway_agreement')}">
|
||||
<option value="">请选择协议类型</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{agreementType}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="agreement1" style="display:block;">
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">mqtt</label>-->
|
||||
<!-- <div class="col-sm-9">-->
|
||||
<!-- <input type="text" name="" class="form-control"-->
|
||||
<!-- placeholder="https://blog.csdn.net/haizhu1983/article/details/134947602">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">服务器地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="mqttAddress" th:field="*{mqttAddress}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">服务器端口:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="mqttPort" th:field="*{mqttPort}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">客户端标识符:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="mqttFlag" th:field="*{mqttFlag}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">用户名:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="mqttUser" th:field="*{mqttUser}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">密码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="mqttPassword" th:field="*{mqttPassword}" class="form-control" type="password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">清理会话:</label>
|
||||
<!-- <div class="col-sm-8">-->
|
||||
<!-- <input name="mqttClean" th:field="*{mqttClean}" class="form-control" type="text">-->
|
||||
<!-- </div>-->
|
||||
<div class="col-sm-9">
|
||||
<label class="radio-box">
|
||||
<input type="radio" th:field="*{mqttClean}" value="1" name="mqttClean">是</label>
|
||||
<label class="radio-box">
|
||||
<input type="radio" th:field="*{mqttClean}" value="2" name="mqttClean">否</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">遗嘱消息:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="mqttDieMsg" class="form-control">[[*{mqttDieMsg}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">保持活动:</label>
|
||||
<!-- <div class="col-sm-8">-->
|
||||
<!-- <input name="mqttKeep" th:field="*{mqttKeep}" class="form-control" type="text">-->
|
||||
<!-- </div>-->
|
||||
<div class="col-sm-9">
|
||||
<label class="radio-box">
|
||||
<input type="radio" class="mqttKeep" th:field="*{mqttKeep}" id="mqttKeep1" value="1" name="mqttKeep">
|
||||
<label for='mqttKeep1'>是</label>
|
||||
</label>
|
||||
<label class="radio-box">
|
||||
<input type="radio" class="mqttKeep" th:field="*{mqttKeep}" id="mqttKeep2" value="2" name="mqttKeep">
|
||||
<label for='mqttKeep2'>否</label>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="mqttHeartbeat" style="display:none;">
|
||||
<label class="col-sm-3 control-label">心跳间隔:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="mqttHeartbeat" th:field="*{mqttHeartbeat}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">主题:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="mqttTopic" th:field="*{mqttTopic}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="agreement2" style="display:none;">
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">Socket</label>-->
|
||||
<!-- <div class="col-sm-9">-->
|
||||
<!-- <input type="text" name="" class="form-control"-->
|
||||
<!-- placeholder="https://blog.csdn.net/lsoxvxe/article/details/132308019">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">协议族:</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" name="socketDomain" th:with="type=${@dict.getType('socket_domain')}">
|
||||
<option value="">请选择协议族</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{socketDomain}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">套接字类型:</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" name="socketType" th:with="type=${@dict.getType('socket_type')}">
|
||||
<option value="">请选择套接字类型</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{socketType}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">协议:</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" name="socketProtocol" th:with="type=${@dict.getType('socket_protocol')}">
|
||||
<option value="">请选择协议</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{socketProtocol}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">地址:</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" th:field="*{socketAddress}" name="socketAddress" class="form-control" placeholder="请输入地址">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="agreement3" style="display:none;">
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">Modbus RTU:</label>-->
|
||||
<!-- <div class="col-sm-9">-->
|
||||
<!-- <input type="text" name="" class="form-control" placeholder="https://blog.csdn.net/qq_45031489/article/details/136646885?ops_request_misc=&request_id=&biz_id=102&utm_term=Modbus%20RTU%E5%8D%8F%E8%AE%AE%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-2-136646885.142^v100^pc_search_result_base2&spm=1018.2226.3001.4187">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">串口号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="rtuSerialPort" th:field="*{rtuSerialPort}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">波特率:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="rtuBaud" th:field="*{rtuBaud}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">数据位:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="rtuDataBits" th:field="*{rtuDataBits}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">校验位:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="rtuCheckBit" th:field="*{rtuCheckBit}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">停止位:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="rtuStopBit" th:field="*{rtuStopBit}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="agreement4" style="display:none;">
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">Modbus TCP:</label>-->
|
||||
<!-- <div class="col-sm-9">-->
|
||||
<!-- <input type="text" name="" class="form-control" placeholder="https://wenku.baidu.com/view/4bba47ebf6335a8102d276a20029bd64793e6273.html?_wkts_=1721956775192&bdQuery=Modbus+TCP%E5%8F%82%E6%95%B0">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">IP地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="tcpAddress" th:field="*{tcpAddress}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">端口:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="tcpPort" th:field="*{tcpPort}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">连接超时时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="tcpConnectionTimeout" th:field="*{tcpConnectionTimeout}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">读取超时时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="tcpReadTimeout" th:field="*{tcpReadTimeout}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">最大连接数:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="tcpMaxConnection" th:field="*{tcpMaxConnection}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">心跳间隔:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="tcpHeartbeatInterval" th:field="*{tcpHeartbeatInterval}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">数据包最大长度:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="tcpMaxPpacket" th:field="*{tcpMaxPpacket}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">地址映射表:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="tcpAddressMapping" th:field="*{tcpAddressMapping}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="agreement5" style="display:none;">
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="col-sm-3 control-label">Fanuc:</label>-->
|
||||
<!-- <div class="col-sm-9">-->
|
||||
<!-- <input type="text" name="" class="form-control" placeholder="https://wenku.baidu.com/view/d83ff1c5f221dd36a32d7375a417866fb84ac0c4.html?_wkts_=1722215355692&bdQuery=Fanuc%E5%8D%8F%E8%AE%AE%E9%85%8D%E7%BD%AE">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">IP地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="fanucAddress" th:field="*{fanucAddress}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">子网掩码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="fanucMask" th:field="*{fanucMask}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">网关地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="fanucGatewayAddress" th:field="*{fanucGatewayAddress}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">DNS:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="fanucDns" th:field="*{fanucDns}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">VLAN:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="fanucVlan" th:field="*{fanucVlan}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">SNMP:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="fanucSnmp" th:field="*{fanucSnmp}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-layer-btn layui-layer-btn-">
|
||||
<a onclick="submitHandler()" class="layui-layer-btn0">确定</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "lora/agreement";
|
||||
$("#form").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
var aggreement = document.getElementById('agreement').value;
|
||||
switch (aggreement) {
|
||||
case '1':
|
||||
$("#agreement2").empty();
|
||||
$("#agreement3").empty();
|
||||
$("#agreement4").empty();
|
||||
$("#agreement5").empty();
|
||||
break;
|
||||
case '2':
|
||||
$("#agreement1").empty();
|
||||
$("#agreement3").empty();
|
||||
$("#agreement4").empty();
|
||||
$("#agreement5").empty();
|
||||
break;
|
||||
case '3':
|
||||
$("#agreement1").empty();
|
||||
$("#agreement2").empty();
|
||||
$("#agreement4").empty();
|
||||
$("#agreement5").empty();
|
||||
break;
|
||||
case '4':
|
||||
$("#agreement1").empty();
|
||||
$("#agreement2").empty();
|
||||
$("#agreement3").empty();
|
||||
$("#agreement5").empty();
|
||||
break;
|
||||
case '5':
|
||||
$("#agreement1").empty();
|
||||
$("#agreement2").empty();
|
||||
$("#agreement3").empty();
|
||||
$("#agreement4").empty();
|
||||
break;
|
||||
}
|
||||
var form = $('#form').serialize();
|
||||
$.operate.save(prefix + "/edit", form);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
// DOM完全加载和解析完成后执行的代码
|
||||
cleanDiv()
|
||||
document.getElementById('agreement' + document.getElementById('agreement').value).style.display = 'block';
|
||||
});
|
||||
document.getElementById('agreement').addEventListener('change', function() {
|
||||
var selectedOption = this.value;
|
||||
cleanDiv()
|
||||
// Show the selected div
|
||||
document.getElementById('agreement' + selectedOption).style.display = 'block';
|
||||
});
|
||||
function cleanDiv(){
|
||||
document.getElementById('agreement1').style.display = 'none';
|
||||
document.getElementById('agreement2').style.display = 'none';
|
||||
document.getElementById('agreement3').style.display = 'none';
|
||||
document.getElementById('agreement4').style.display = 'none';
|
||||
document.getElementById('agreement5').style.display = 'none';
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user