Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/work/modbusPointEdit.jsp
2026-01-16 14:13:44 +08:00

175 lines
7.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ 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_pointEdit").bootstrapValidator('validate');//提交验证
if ($("#subForm_pointEdit").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/work/pointModbus/doUpdate.do", $("#subForm_pointEdit").serialize(), function (result) {
if (result.code == 1) {
closeModal("subdivPointEdit")
$("#point_table").bootstrapTable('refresh');
} else {
showAlert('d', result.msg);
}
});
}
}
$("#subForm_pointEdit").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++) {
document.getElementById("pointType1").options.add(new Option(res[s].text, res[s].id))
if (res[s].id == '${modbusPoint.pointType}') {
$('#pointType1').val('${modbusPoint.pointType}')
}
}
});
}
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("regusterType1").options.add(new Option(res[s].text, res[s].id))
if (res[s].id == '${modbusPoint.regusterType}') {
$('#regusterType1').val('${modbusPoint.regusterType}')
}
}
});
}
$(function () {
initType();
initRegisterType();
});
</script>
<div class="modal fade" id="subdivPointEdit">
<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">&times;</span></button>
<h4 class="modal-title">新增配置</h4>
</div>
<div class="modal-body">
<!-- 新增界面formid强制为subForm -->
<form class="form-horizontal " id="subForm_pointEdit">
<input id="pId1" name="pId" type="hidden" value="${modbusPoint.pId}"/>
<input id="id1" name="id" type="hidden" value="${modbusPoint.id}"/>
<!-- 界面提醒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="name1" name="name" autocomplete="off"
placeholder="地址名称" value="${modbusPoint.name}">
</div>
<label class="col-sm-2 control-label">寄存器地址*</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="address1" name="address" autocomplete="off"
placeholder="寄存器地址" value="${modbusPoint.address}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">寄存器类型*</label>
<div class="col-sm-4">
<select id="regusterType1" 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="slaveId1" 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="pointType1" name="pointType" class="form-control select2">
</select>
</div>
<label class="col-sm-2 control-label">是否启用*</label>
<div class="col-sm-4">
<select id="status1" name="status" class="form-control select2">
<option value=0 <c:if test="${modbusPoint.status == 0 }">selected</c:if>>禁用</option>
<option value=1 <c:if test="${modbusPoint.status == 1 }">selected</c:if>>启用</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>