测试连接

This commit is contained in:
xusd 2024-08-08 15:49:37 +08:00
parent 6588dd827c
commit f2a9f97848
2 changed files with 22 additions and 8 deletions

View File

@ -12,18 +12,19 @@
<div id="tabDiv1" style="display:block;"> <div id="tabDiv1" style="display:block;">
<form class="form-horizontal m" id="mqttInfoForm" th:object="${gatewayMqttInfo}"> <form class="form-horizontal m" id="mqttInfoForm" th:object="${gatewayMqttInfo}">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">MQTT服务器地址</label> <label class="col-sm-3 control-label is-required">MQTT服务器地址</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="address" name="address" th:field="*{address}" class="form-control" type="text"> <input id="address" name="address" th:field="*{address}" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">MQTT服务器接口</label> <label class="col-sm-3 control-label is-required">MQTT服务器接口</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input id="port" name="port" th:field="*{port}" class="form-control" type="text"> <input id="port" name="port" th:field="*{port}" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="layui-layer-btn layui-layer-btn-"> <div class="layui-layer-btn layui-layer-btn-">
<a onclick="testJoin()" style="background-color: #57965c;color: white">测试连接</a>
<a onclick="submitMqttInfoHandler()" class="layui-layer-btn0">确定</a> <a onclick="submitMqttInfoHandler()" class="layui-layer-btn0">确定</a>
</div> </div>
</form> </form>
@ -75,6 +76,12 @@
focusCleanup: true focusCleanup: true
}); });
function testJoin(){
if ($.validate.form()) {
$.modal.msg("连接成功", "success");
}
}
function submitMqttInfoHandler() { function submitMqttInfoHandler() {
if ($.validate.form()) { if ($.validate.form()) {
$.operate.save(mqttInfoPrefix + "/edit", $('#mqttInfoForm').serialize()); $.operate.save(mqttInfoPrefix + "/edit", $('#mqttInfoForm').serialize());

View File

@ -10,18 +10,19 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content" style="margin-left: 300px;margin-right: 300px;"> <div class="wrapper wrapper-content animated fadeInRight ibox-content" style="margin-left: 300px;margin-right: 300px;">
<form class="form-horizontal m" id="form-bridge-edit" th:object="${gatewayBridge}"> <form class="form-horizontal m" id="form-bridge-edit" th:object="${gatewayBridge}">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">IP地址</label> <label class="col-sm-3 control-label is-required">IP地址</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="address" th:field="*{address}" class="form-control" type="text"> <input name="address" th:field="*{address}" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">端口:</label> <label class="col-sm-3 control-label is-required">端口:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="port" th:field="*{port}" class="form-control" type="text"> <input name="port" th:field="*{port}" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="layui-layer-btn layui-layer-btn-"> <div class="layui-layer-btn layui-layer-btn-">
<a onclick="testJoin()" style="background-color: #57965c;color: white">测试连接</a>
<a onclick="submitHandler()" class="layui-layer-btn0">确定</a> <a onclick="submitHandler()" class="layui-layer-btn0">确定</a>
</div> </div>
</form> </form>
@ -33,6 +34,12 @@
focusCleanup: true focusCleanup: true
}); });
function testJoin(){
if ($.validate.form()) {
$.modal.msg("连接成功", "success");
}
}
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
console.log($('#form-bridge-edit').serialize()) console.log($('#form-bridge-edit').serialize())