174 lines
7.1 KiB
Plaintext
174 lines
7.1 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<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 dosave() {
|
|||
|
|
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/dosave.do", $("#subForm2").serialize(), function(data) {
|
|||
|
|
if (data == 1){
|
|||
|
|
closeModal('subModal');
|
|||
|
|
$("#conditiontable").bootstrapTable('refresh');
|
|||
|
|
}else if(data == 0){
|
|||
|
|
showAlert('d','保存失败','alertDiv');
|
|||
|
|
}else{
|
|||
|
|
showAlert('d',data,'alertDiv');
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
/*}
|
|||
|
|
}, 100);*/
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//输入框验证
|
|||
|
|
$("#subForm2").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
mpointid: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '测量点不能为空'
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
/* processsectionid: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '工艺段不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}, */
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
//初始化工艺段选择框
|
|||
|
|
var refreshSelect = function() {
|
|||
|
|
$("#processsectionid").select2({
|
|||
|
|
data: null,
|
|||
|
|
placeholder:'请先选择厂区',//默认文字提示
|
|||
|
|
allowClear: false,//允许清空
|
|||
|
|
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
$(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">新增预警触发条件</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="${alarmtypeid}">
|
|||
|
|
<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" 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" 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" checked="checked" />大于</label>
|
|||
|
|
<label><input type="radio" name="compare" value="-1" />小于</label>
|
|||
|
|
|
|||
|
|
<label><input type="radio" name="compare" value="0" />等于</label>
|
|||
|
|
|
|||
|
|
<label><input type="radio" name="compare" value="2" />范围[a,b]</label>
|
|||
|
|
|
|||
|
|
<label><input type="radio" name="compare" value="3" />范围[-∞,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" style="width:80px;">
|
|||
|
|
<label>下限 </label><input type="number" name="lowerlimit" id="lowerlimit" style="width:80px;" disabled="disabled"/>
|
|||
|
|
<label>上限 </label><input type="number" name="upperlimit" id="upperlimit" style="width:80px;" disabled="disabled"/>
|
|||
|
|
</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>
|