158 lines
7.3 KiB
Plaintext
158 lines
7.3 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
|||
|
|
<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">
|
|||
|
|
var selectMPint = function(pid) {
|
|||
|
|
$.post(ext.contextPath + '/work/mpoint/showlistForSelect.do', {formId:'subForm2',hiddenId:'mpid',codeId:'mpcode',textId:'txt',valueId :'value',mpid:$("#mpid").val()} , function(data) {
|
|||
|
|
$("#mpSubDiv").html(data);
|
|||
|
|
openModal('mpSubModal');
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
function doupdate() {
|
|||
|
|
if($('#mpid').val()==null || $('#mpid').val()==''){
|
|||
|
|
swal('请选择测量点');
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var com = $("input[name='compare']:checked").val();
|
|||
|
|
if(com == '1' || com == '-1' || com == '0' ){
|
|||
|
|
if($('#val').val() == null || $('#val').val() == ''){
|
|||
|
|
swal('请输入数值');
|
|||
|
|
$('#val').focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}else{
|
|||
|
|
if($('#lowerlimit').val() == null || $('#lowerlimit').val() == ''){
|
|||
|
|
swal('请输入下限数值');
|
|||
|
|
$('#lowerlimit').focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if($('#upperlimit').val() == null || $('#upperlimit').val() == ''){
|
|||
|
|
swal('请输入上限数值');
|
|||
|
|
$('#upperlimit').focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/*$("#subForm2").bootstrapValidator('validate');//提交验证 */
|
|||
|
|
/*setTimeout(function(){
|
|||
|
|
if ($("#subForm2").data('bootstrapValidator').isValid()) {//*/
|
|||
|
|
$.post(ext.contextPath + "/alarm/alarmCondition/update.do", $("#subForm2").serialize(), function(data) {
|
|||
|
|
if (data == 1){
|
|||
|
|
closeModal('subModal');
|
|||
|
|
$("#conditiontable").bootstrapTable('refresh');
|
|||
|
|
}else if(data == 0){
|
|||
|
|
showAlert('d','保存失败','alertDiv');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data.res,'alertDiv');
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
/* }*/
|
|||
|
|
/* }, 100); */
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//输入框验证
|
|||
|
|
/*$("#subForm2").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
mpointid: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '测量点不能为空'
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
}); */
|
|||
|
|
|
|||
|
|
|
|||
|
|
$(function(){
|
|||
|
|
$("input[name='compare']").click(function(){
|
|||
|
|
var com = $("input[name='compare']:checked").val();
|
|||
|
|
if(com=='-1'||com=='1'||com=='0'){
|
|||
|
|
$("#val").attr("disabled",false);
|
|||
|
|
$("#upperlimit").attr("disabled",'disabled');
|
|||
|
|
$("#lowerlimit").attr("disabled",'disabled');
|
|||
|
|
$("#val").val('');
|
|||
|
|
$("#upperlimit").val('');
|
|||
|
|
$("#lowerlimit").val('');
|
|||
|
|
}else{
|
|||
|
|
$("#upperlimit").attr("disabled",false);
|
|||
|
|
$("#lowerlimit").attr("disabled",false);
|
|||
|
|
$("#val").attr("disabled","disabled");
|
|||
|
|
$("#val").val('');
|
|||
|
|
$("#upperlimit").val('');
|
|||
|
|
$("#lowerlimit").val('');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
</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">编辑KPI测量点</h4>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-body">
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal" id="subForm2">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input type="hidden" name="alarmtypeid" value="${alarmCondition.alarmtypeid}">
|
|||
|
|
<input type="hidden" name="id" value="${alarmCondition.id}">
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*测量点编号</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="hidden" class="form-control" style="cursor: pointer"id="mpcode" >
|
|||
|
|
<input type="text" class="form-control" style="cursor: pointer" id="mpid" value="${alarmCondition.mpointid}" name ="mpointid" onclick="selectMPint('')" placeholder="单击选择" readonly>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">测量点名称</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" class="form-control" id="txt" value="${alarmCondition.mPoint.parmname}" placeholder="测量点名称" readonly>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">条件</label>
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<label><input type="radio" name="compare" value="1" <c:if test="${alarmCondition.compare==1}">checked="checked"</c:if> />大于</label>
|
|||
|
|
<label><input type="radio" name="compare" value="-1" <c:if test="${alarmCondition.compare==-1}">checked="checked"</c:if>/>小于</label>
|
|||
|
|
|
|||
|
|
<label><input type="radio" name="compare" value="0" <c:if test="${alarmCondition.compare==0}">checked="checked"</c:if>/>等于</label>
|
|||
|
|
|
|||
|
|
<label><input type="radio" name="compare" value="2" <c:if test="${alarmCondition.compare==2}">checked="checked"</c:if>/>范围[a,b]</label>
|
|||
|
|
|
|||
|
|
<label><input type="radio" name="compare" value="3" <c:if test="${alarmCondition.compare==3}">checked="checked"</c:if>/>范围[-∞,a],[b,+∞]</label>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">触发条件</label>
|
|||
|
|
|
|||
|
|
<div class="col-sm-10">
|
|||
|
|
<label>预警数值 </label><input type="number" id="val" name="val" value="${alarmCondition.val}" style="width:80px;" <c:if test="${alarmCondition.compare==2 || alarmCondition.compare==3}">disabled="disabled"</c:if>>
|
|||
|
|
<label>下限 </label><input type="number" name="lowerlimit" id="lowerlimit" style="width:80px;" <c:if test="${alarmCondition.compare==0 || alarmCondition.compare==1 || alarmCondition.compare==-1}">disabled="disabled"</c:if> value="${alarmCondition.lowerlimit}" />
|
|||
|
|
<label>上限 </label><input type="number" name="upperlimit" id="upperlimit" style="width:80px;" <c:if test="${alarmCondition.compare==0 || alarmCondition.compare==1 || alarmCondition.compare==-1}">disabled="disabled"</c:if> value="${alarmCondition.upperlimit}" />
|
|||
|
|
</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="doupdate()" id="btn_save">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|