198 lines
6.8 KiB
Plaintext
198 lines
6.8 KiB
Plaintext
|
|
<!DOCTYPE html
|
|||
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|||
|
|
<%@ page language="java" import="java.util.*" 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"%>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subModal_modbusfigEdit #subFormEdit").bootstrapValidator('validate');//提交验证
|
|||
|
|
$.post(ext.contextPath + '/work/modbusfig/update.do', $("#subModal_modbusfigEdit #subFormEdit ").serialize(), function (data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
//document.getElementById('subModal_modbusfigEdit').innerHTML="";
|
|||
|
|
closeModal('subModal_modbusfigEdit');
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
} else if (data.res == 0) {
|
|||
|
|
showAlert('d', '保存失败');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.res);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//输入框验证
|
|||
|
|
$("#subModal_modbusfigEdit #subFormEdit").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '服务器名称不能为空'
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
companyId: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '厂区不能为空'
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
ipsever: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '服务器IP不能为空'
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
port: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '端口不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
slaveid: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '站内地址不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$(function () {
|
|||
|
|
$("#subFormEdit #flag").select2({minimumResultsForSearch: 10}).val("${modbusFig.flag}").trigger("change"); ;
|
|||
|
|
fixSelect2ToTool('subFormEdit #flag');
|
|||
|
|
$("#subFormEdit #order32").select2({minimumResultsForSearch: 10}).val("${modbusFig.order32}").trigger("change"); ;
|
|||
|
|
fixSelect2ToTool('subFormEdit #order32');
|
|||
|
|
//选择厂区
|
|||
|
|
$.post(ext.contextPath + "/user/getSearchBizsByUserId4Select.do", {}, function (data) {
|
|||
|
|
var selelct = $("#subFormEdit #companyId").select2({
|
|||
|
|
data: data,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: false,//允许清空
|
|||
|
|
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
formatResult: function formatRepo(repo) { return repo.text; }, // 函数用来渲染结果
|
|||
|
|
formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
selelct.on("change", function (e) {
|
|||
|
|
dosearch();
|
|||
|
|
});
|
|||
|
|
fixSelect2ToTool('subFormEdit #companyId');
|
|||
|
|
if (data.length == 1) {
|
|||
|
|
//选择厂区为一个厂时隐藏选择框
|
|||
|
|
selelct.val('${modbusFig.companyId}').trigger("change");
|
|||
|
|
$("#subFormEdit #companyId").next().css("display", "none");
|
|||
|
|
$("#subFormEdit #companyName").text($("#subFormEdit #companyId").text());
|
|||
|
|
} else {
|
|||
|
|
selelct.val('${modbusFig.companyId}').trigger("change");
|
|||
|
|
$("#subFormEdit #companyName").css("display", "none");
|
|||
|
|
};
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
</head>
|
|||
|
|
|
|||
|
|
<div class="modal fade" id="subModal_modbusfigEdit">
|
|||
|
|
<div class="modal-dialog" style="height:500px;">
|
|||
|
|
<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">修改ModBus配置</h4>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-body">
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal" id="subFormEdit">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input type="hidden" class="form-control" id="id" name="id" value="${modbusFig.id}">
|
|||
|
|
<div class="form-group" style="margin-bottom:10px;">
|
|||
|
|
<label class="col-sm-3 control-label">*所属厂区</label>
|
|||
|
|
<div class="col-sm-7" style="margin-top:6px">
|
|||
|
|
<select class="form-control select2" id="companyId" name="companyId" style="width: 270px;">
|
|||
|
|
</select>
|
|||
|
|
<span id="companyName" style="width:220px;border: none;background: transparent; "></span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">*服务器名称</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" class="form-control" id="name" name="name" placeholder="服务器名称"
|
|||
|
|
value="${modbusFig.name}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">启用</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<select class="form-control select2" id="flag" name="flag" style="width: 120px;">
|
|||
|
|
<option value="启用">启用</option>
|
|||
|
|
<option value="禁用">禁用</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">服务器IP</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" class="form-control" id="ipsever" name="ipsever" placeholder="服务器IP"
|
|||
|
|
value="${modbusFig.ipsever}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">端口号</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" class="form-control" id="port" name="port" placeholder="服务器名称"
|
|||
|
|
value="502" value="${modbusFig.port}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">站地址</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" class="form-control" id="slaveid" name="slaveid" placeholder="站地址"
|
|||
|
|
value="${modbusFig.slaveid}">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">数据高低位存储方式</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<select class="form-control select2" id="order32" name="order32" style="width: 270px;">
|
|||
|
|
<option value="4321">FFH4 FFH3 FFH2 FFH1</option>
|
|||
|
|
<option value="3412">FFH3 FFH4 FFH1 FFH2</option>
|
|||
|
|
<option value="1234">FFH1 FFH2 FFH3 FFH4</option>
|
|||
|
|
<option value="2143">FFH2 FFH1 FFH4 FFH3</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">备注</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<textarea type="text" class="form-control" id="remarks" name="remarks" placeholder="备注"
|
|||
|
|
style="height:120px;" value="${modbusFig.remarks}"></textarea>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</form>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-footer">
|
|||
|
|
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
|||
|
|
<button type="button" class="btn btn-primary" onclick="dosave()">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|