change - 传感器阈值设置
parent
7845e926ac
commit
b3e202f71c
@ -0,0 +1,163 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<th:block th:include="include :: header('设置传感器报警阈值')"/>
|
||||
<th:block th:include="include :: select2-css"/>
|
||||
|
||||
<th:block th:include="include :: datetimepicker-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-sensorInfo-edit" th:object="${baseSensorInfo}">
|
||||
<input name="objId" th:field="*{objId}" type="hidden">
|
||||
<input name="monitorunitId" type="hidden" th:field="*{monitorunitId}" id="treeId"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">传感器编号:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="sensorId" th:field="*{sensorId}" class="form-control" type="text" readonly="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">传感器名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="sensorName" th:field="*{sensorName}" class="form-control" type="text" readonly="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否启用:</label>
|
||||
<div class="col-sm-8">
|
||||
|
||||
<select name="enableFlag" id="enableFlag" class="form-control m-b" th:with="type=${@dict.getType('enable_flag')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="form-header h4">设置阈值参数</h4>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">添加参数:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="suggest-demo-1">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-white dropdown-toggle form-control" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="product"/>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer"/>
|
||||
<th:block th:include="include :: bootstrap-suggest-js"/>
|
||||
<th:block th:include="include :: bootstrap-typeahead-js"/>
|
||||
<th:block th:include="include :: select2-js"/>
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "base/sensorInfo";
|
||||
$("#form-sensorInfo-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
/*if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/set", $('#form-sensorInfo-edit').serialize());
|
||||
}*/
|
||||
|
||||
if ($.validate.form()) {
|
||||
if (arrList.length<1){
|
||||
$.modal.alertError("未添加参数");
|
||||
return
|
||||
}
|
||||
var formData = new FormData();
|
||||
formData.append('monitorunitId', $("input[name=monitorunitId]").val());
|
||||
formData.append('sensorId', $("input[name=sensorId]").val());
|
||||
formData.append('sensorName', $("input[name=sensorName]").val());
|
||||
formData.append('enableFlag', $("#enableFlag").select2('val'));
|
||||
$("input[name='paramCode']").each(function(){
|
||||
formData.append("paramCode",$(this).attr('data-id'));
|
||||
});
|
||||
$("input[name='maxValue']").each(function(){
|
||||
formData.append("maxValue",$(this).val());
|
||||
});
|
||||
$("input[name='minValue']").each(function(){
|
||||
formData.append("minValue",$(this).val());
|
||||
});
|
||||
$.ajax({
|
||||
url: prefix + "/set",
|
||||
type: 'post',
|
||||
cache: false,
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: "json",
|
||||
success: function(result) {
|
||||
$.operate.successCallback(result);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var arrList = new Array();
|
||||
var productid;
|
||||
//动态添加成品数量
|
||||
var testBsSuggest = $("#suggest-demo-1").bsSuggest({
|
||||
url: ctx + "base/sensorInfo/getParamList",
|
||||
idField: "paramCode",
|
||||
effectiveFields: ["paramCode", "paramName"],
|
||||
keyField: "paramName",//xuanz
|
||||
effectiveFieldsAlias: {paramCode: "参数编码", paramName: "参数名称"},
|
||||
searchFields: ["paramName"],
|
||||
}).on('onDataRequestSuccess', function (e, result) {
|
||||
console.log('onDataRequestSuccess: ', result);
|
||||
}).on('onSetSelectValue', function (e, keyword) {
|
||||
productid = keyword.id;
|
||||
if ($.inArray(productid, arrList) == -1) {
|
||||
$("#product").append(
|
||||
"<div><label class=\"col-sm-2 control-label is-required\">参数名称:</label>\n" +
|
||||
" <div class=\"col-sm-2\">\n" +
|
||||
" <input name=\"paramCode\" value='" + keyword.key + "' data-id='" + keyword.id + "' class=\"form-control\" type=\"text\" readonly='true' required>\n" +
|
||||
" </div>\n" +
|
||||
" <label class=\"col-sm-2 control-label is-required\" style='margin-left: -35px'>最小值:</label>" +
|
||||
" <div class=\"col-sm-2\">\n" +
|
||||
" <input name=\"minValue\" class=\"form-control\" type=\"text\" required>\n" +
|
||||
" </div>\n" +
|
||||
" <label class=\"col-sm-2 control-label is-required\" style='margin-left: -35px'>最大值:</label>" +
|
||||
" <div class=\"col-sm-2\">\n" +
|
||||
" <input name=\"maxValue\" class=\"form-control\" type=\"text\" required>\n" +
|
||||
" </div>\n" +
|
||||
" <div class=\"col-sm-1\">\n" +
|
||||
" <p style=\"margin-top: 10px\" class=\"glyphicon glyphicon-trash\" aria-hidden=\"true\"></p>\n" +
|
||||
" </div>" +
|
||||
"</div>"
|
||||
);
|
||||
arrList.push(productid);
|
||||
console.log(arrList)
|
||||
} else {
|
||||
$.modal.msgWarning('参数已添加!');
|
||||
}
|
||||
|
||||
}).on('onUnsetSelectValue', function (e) {
|
||||
|
||||
});
|
||||
//删除添加的成品
|
||||
$(document).ready(function () {
|
||||
$(document).on("click", ".glyphicon", function () {
|
||||
$(this).parent().parent().remove();
|
||||
arrList.splice(arrList.indexOf(productid), 1);
|
||||
console.log(arrList)
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue