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