170 lines
7.0 KiB
Plaintext
170 lines
7.0 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
|
|||
|
|
<%@ page import="com.sipai.entity.base.ServerObject" %>
|
|||
|
|
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security" %>
|
|||
|
|
<%@page import="com.sipai.entity.enums.ModbusDataTypeEnum" %>
|
|||
|
|
<style type="text/css">
|
|||
|
|
.select2-container .select2-selection--single {
|
|||
|
|
height: 34px;
|
|||
|
|
line-height: 34px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.select2-selection__arrow {
|
|||
|
|
margin-top: 3px;
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subForm_pointAdd").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm_pointAdd").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/work/pointModbus/dosave.do", $("#subForm_pointAdd").serialize(), function (result) {
|
|||
|
|
if (result.code == 1) {
|
|||
|
|
// showAlert('s','保存成功');
|
|||
|
|
closeModal("subdivPointAdd")
|
|||
|
|
$("#point_table").bootstrapTable('refresh');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', result.msg);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#subForm_pointAdd").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '名称不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
address: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '寄存器地址不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
regusterType: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '寄存器类型为必选项'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
slaveId: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '从站id不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
pointType: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '数据类型为必选项'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
status: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '是否启用为必选项'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
function initType() {
|
|||
|
|
$.post(ext.contextPath + '/enums/getEnumsList.do', {enumName: 'ModbusTypeEnum'}, function (data) {
|
|||
|
|
var res = eval('(' + data + ')');
|
|||
|
|
for (var s = 0; s < res.length; s++) {
|
|||
|
|
console.log(res[s].text)
|
|||
|
|
document.getElementById("pointType").options.add(new Option(res[s].text, res[s].id));
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function initRegisterType() {
|
|||
|
|
$.post(ext.contextPath + '/enums/getEnumsList.do', {enumName: 'ModbusRegisterTypeEnum'}, function (data) {
|
|||
|
|
var res = eval('(' + data + ')');
|
|||
|
|
for (var s = 0; s < res.length; s++) {
|
|||
|
|
document.getElementById("regusterType").options.add(new Option(res[s].text, res[s].id));
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$(function () {
|
|||
|
|
initType();
|
|||
|
|
initRegisterType();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
<div class="modal fade" id="subdivPointAdd">
|
|||
|
|
<div class="modal-dialog" style="width: 900px">
|
|||
|
|
<div class="modal-content">
|
|||
|
|
<div class="modal-header">
|
|||
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|||
|
|
<span aria-hidden="true">×</span></button>
|
|||
|
|
<h4 class="modal-title">新增配置</h4>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-body">
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal " id="subForm_pointAdd">
|
|||
|
|
<input id="pId" name="pId" type="hidden" value="${pId}"/>
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<div id="menu4SelectDiv"></div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">地址名称*</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="name" name="name" autocomplete="off"
|
|||
|
|
placeholder="地址名称">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">寄存器地址*</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="address" name="address" autocomplete="off"
|
|||
|
|
placeholder="寄存器地址">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">寄存器类型*</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id="regusterType" name="regusterType" class="form-control select2">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">从站Id*</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="number" class="form-control" id="slaveId" name="slaveId" autocomplete="off" value="1"
|
|||
|
|
placeholder="从站Id">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">数据类型*</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id="pointType" name="pointType" class="form-control select2">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">是否启用*</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id="status" name="status" class="form-control select2">
|
|||
|
|
<option value="1" selected>启用</option>
|
|||
|
|
<option value="0">禁用</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-default " data-dismiss="modal">关闭</button>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="dosave()" id="btn_save">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|