106 lines
4.5 KiB
Plaintext
106 lines
4.5 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_configEdit").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm_configEdit").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/work/configModbus/doUpdate.do", $("#subForm_configEdit").serialize(), function (result) {
|
||
if (result.code == 1) {
|
||
closeModal("configEditsubModel")
|
||
$("#config_table").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', result.msg);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
$("#subForm_configEdit").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
});
|
||
|
||
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("type").options.add(new Option(res[s].text, res[s].id));
|
||
if (res[s].id == '${modbusConfig.type}') {
|
||
$('#type').val('${modbusConfig.type}')
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
function initDataType() {
|
||
$.post(ext.contextPath + '/enums/getEnumsList.do', {enumName: 'ModbusDataTypeEnum'}, function (data) {
|
||
var res = eval('(' + data + ')');
|
||
for (var s = 0; s < res.length; s++) {
|
||
document.getElementById("dataType").options.add(new Option(res[s].text, res[s].id));
|
||
if (res[s].id == '${modbusConfig.dataType}') {
|
||
$('#dataType').val('${modbusConfig.dataType}')
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
$(function () {
|
||
initType();
|
||
initDataType();
|
||
});
|
||
|
||
</script>
|
||
<div class="modal fade" id="configEditsubModel">
|
||
<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_configEdit">
|
||
<input id="pId" name="pId" type="hidden" value="${modbusConfig.pId}"/>
|
||
<input id="id" name="id" type="hidden" value="${modbusConfig.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">
|
||
<select id="type" name="type" class="form-control select2">
|
||
</select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">Modbus数据类型</label>
|
||
<div class="col-sm-4">
|
||
<select id="dataType" name="dataType" class="form-control select2">
|
||
</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> |