121 lines
5.1 KiB
Plaintext
121 lines
5.1 KiB
Plaintext
|
|
<%@page import="com.sipai.entity.scada.MPoint" %>
|
|||
|
|
<%@page import="com.sipai.tools.CommString" %>
|
|||
|
|
<%@ 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" %>
|
|||
|
|
<%request.setAttribute("Active_False", CommString.Active_False); %>
|
|||
|
|
<%request.setAttribute("Active_True", CommString.Active_True); %>
|
|||
|
|
<%request.setAttribute("Flag_Enable", MPoint.Flag_Enable);%>
|
|||
|
|
<%request.setAttribute("Flag_Disable", MPoint.Flag_Disable);%>
|
|||
|
|
|
|||
|
|
<%request.setAttribute("Flag_Sql", MPoint.Flag_Sql);%>
|
|||
|
|
<%request.setAttribute("Flag_Modbus", MPoint.Flag_Modbus);%>
|
|||
|
|
<%request.setAttribute("Flag_Type_KPI", MPoint.Flag_Type_KPI);%>
|
|||
|
|
<%request.setAttribute("Flag_Type_Hand", MPoint.Flag_Type_Hand);%>
|
|||
|
|
<%request.setAttribute("Flag_Type_Data", MPoint.Flag_Type_Data);%>
|
|||
|
|
<%request.setAttribute("Flag_BizType_Hand", MPoint.Flag_BizType_Hand);%>
|
|||
|
|
<%request.setAttribute("Flag_BizType_Auto", MPoint.Flag_BizType_Auto);%>
|
|||
|
|
|
|||
|
|
<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 () {
|
|||
|
|
// refreshTypeSelect();
|
|||
|
|
// refreshActiveSelect();
|
|||
|
|
// refreshSignaltypeSelect();
|
|||
|
|
// refreshValuetypeSelect();
|
|||
|
|
// refreshBizTypeSelect();
|
|||
|
|
|
|||
|
|
$("#modbusfigid").select2({minimumResultsForSearch: -1}).val("${mPoint.modbusfigid}").trigger("change");
|
|||
|
|
|
|||
|
|
$.post(ext.contextPath + "/work/mpoint/getJson.do", {}, function (data) {
|
|||
|
|
var selelct = $("#modbusfigid").select2({
|
|||
|
|
data: data,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: false,//允许清空
|
|||
|
|
escapeMarkup: function (markup) {
|
|||
|
|
return markup;
|
|||
|
|
}, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: -1,//禁用搜索框
|
|||
|
|
formatResult: function formatRepo(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
}, // 函数用来渲染结果
|
|||
|
|
formatSelection: function formatRepoSelection(repo) {
|
|||
|
|
return repo.text;
|
|||
|
|
} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
selelct.val('${mPoint.modbusfigid}').trigger("change");
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
function update() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/work/mpoint/update2.do", $("#subForm").serialize(), function (data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
closeModal('subModal')
|
|||
|
|
$("#table").bootstrapTable('refresh');
|
|||
|
|
|
|||
|
|
} else if (data.res == 0) {
|
|||
|
|
showAlert('d', '保存失败');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.res);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
<div class="modal fade" id="subModal">
|
|||
|
|
<div class="modal-dialog">
|
|||
|
|
<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="subForm">
|
|||
|
|
<input type="hidden" class="form-control" id="id" name ="id" placeholder="id" value="${mPoint.id }">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">Modbus服务器</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select class="form-control select2" id="modbusfigid" name="modbusfigid"
|
|||
|
|
style="width: 100%"></select>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">寄存器地址</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="register" name="register" placeholder="寄存器地址"
|
|||
|
|
value="${mPoint.register }" autocomplete="off">
|
|||
|
|
</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="update()" id="btn_save">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|