240 lines
11 KiB
Plaintext
240 lines
11 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">
|
|||
|
|
//测量点选择
|
|||
|
|
// function showMPoint4SelectFun() {
|
|||
|
|
// $.post(ext.contextPath + '/plan/showMPoint4SingleSelect.do', {
|
|||
|
|
// formId: "subForm",
|
|||
|
|
// hiddenId: "parameter",
|
|||
|
|
// textId: "parameterNames",
|
|||
|
|
// mPointIds: $('#valueUrl').val()
|
|||
|
|
// }, function (data) {
|
|||
|
|
// $("#subDiv_select").html(data);
|
|||
|
|
// openModal('mpSubModal');
|
|||
|
|
// });
|
|||
|
|
// };
|
|||
|
|
//摄像头选择
|
|||
|
|
// function showCamera4SelectFun() {
|
|||
|
|
// $.post(ext.contextPath + '/work/camera/showCamera4Select.do', {
|
|||
|
|
// formId: "subForm",
|
|||
|
|
// hiddenId: "cameraId",
|
|||
|
|
// textId: "cameraName",
|
|||
|
|
// cameraId: $('#cameraId').val()
|
|||
|
|
// }, function (data) {
|
|||
|
|
// $("#subDiv_select").html(data);
|
|||
|
|
// openModal('camera4SelectModal');
|
|||
|
|
// });
|
|||
|
|
// };
|
|||
|
|
function dosave() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/visualjsp/dosaveJspElement.do", $("#subForm").serialize(), function (data) {
|
|||
|
|
if (data.res == 1) {
|
|||
|
|
closeModal('subModal')
|
|||
|
|
refresh();
|
|||
|
|
} else if (data.res == 0) {
|
|||
|
|
showAlert('d', '保存失败');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.res);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$("#subForm").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
name: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '名称不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
elementCode: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '元素识别编码不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
getValueType: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '获取值方式不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
valueUrl: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '链接不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
morder: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '顺序不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
$(function () {
|
|||
|
|
// $.post(ext.contextPath + "/datatype/getDataType4Select2.do", {}, function (data) {
|
|||
|
|
// $("#dataType").empty();
|
|||
|
|
// var select = $("#dataType").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; } // 函数用于呈现当前的选择
|
|||
|
|
// });
|
|||
|
|
// select.val(data[0].id).trigger("change");
|
|||
|
|
// }, 'json');
|
|||
|
|
|
|||
|
|
$.post(ext.contextPath + '/user/getUnitForTree_Selected.do', { ng: '' }, function (data) {
|
|||
|
|
$("#unitId").val(data[0].id);
|
|||
|
|
$("#unitName").val(data[0].text);
|
|||
|
|
//$table.bootstrapTable('refresh');//异步加载重新刷新,待修改
|
|||
|
|
$('#companytree').treeview({
|
|||
|
|
data: data,
|
|||
|
|
showBorder: false,
|
|||
|
|
levels: 3,
|
|||
|
|
});
|
|||
|
|
$('#companytree').on('nodeSelected', function (event, data) {
|
|||
|
|
$("#unitId").val(data.id);
|
|||
|
|
$("#unitName").val(data.text);
|
|||
|
|
document.getElementById('ul_tree').style.display = "none";
|
|||
|
|
});
|
|||
|
|
}, 'json');
|
|||
|
|
|
|||
|
|
//防止点击树的+号收起下拉框
|
|||
|
|
$("#ul_tree").on("click", function (e) {
|
|||
|
|
event.stopPropagation();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
//点击空白隐藏树
|
|||
|
|
$(document).click(function (e) {
|
|||
|
|
var divTree = $('#ul_tree'); // 设置目标区域
|
|||
|
|
if (!divTree.is(e.target) && divTree.has(e.target).length === 0) {
|
|||
|
|
divTree.hide()
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
</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">新增JSP元素</h4>
|
|||
|
|
</div>
|
|||
|
|
<div class="modal-body">
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal" id="subForm" enctype="multipart/form-data">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input id="pid" name="pid" type="hidden" value="${pid}" />
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">*名称</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" id="name" name="name" class="form-control" placeholder="名称">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">*元素识别编码</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" id="elementCode" name="elementCode" class="form-control"
|
|||
|
|
placeholder="元素识别编码">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">样式</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" id="style" name="style" class="form-control" placeholder="style">
|
|||
|
|
<span style="display: inline-block;">注:1.曲线图元素时可选择bar/line等echarts支持类型。</span>
|
|||
|
|
<span style="display: inline-block;">2.颜色元素填写方式。例:FFD568(不需要#)。</span>
|
|||
|
|
<span>3.背景图地址。例:/IMG/bg_2F/Q21-singleStatus.jpg。</span>
|
|||
|
|
<span style="display: inline-block;"> 4.其他元素可填写style样式类型。例:height:30%注意符号需要英文符号。</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">*获取值方式</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" id="getValueType" name="getValueType" class="form-control"
|
|||
|
|
placeholder="getValue/getHistory/getModbus/getHttp" value="getValue">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">*链接</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="text" id="valueUrl" name="valueUrl" class="form-control" placeholder="链接">
|
|||
|
|
<span style="display: inline-block;">注:1.getValue/getHistory/getModbus时填写生产库测量点id。</span>
|
|||
|
|
<span>2.getHTTP/getCacheData时填写http链接路径。</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="cameraName" name="cameraName"
|
|||
|
|
placeholder="选择摄像头" onclick="showCamera4SelectFun();" value="" readonly
|
|||
|
|
style="background-color: white">
|
|||
|
|
<input id="cameraId" name="cameraId" type="hidden" value="" />
|
|||
|
|
<span style="display: inline-block;">注:若为摄像头元素此选项必选。</span>
|
|||
|
|
</div>
|
|||
|
|
</div> -->
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">*所属厂</label>
|
|||
|
|
<input id="unitId" name="unitId" type="hidden" />
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="width:300px;"
|
|||
|
|
onclick="document.getElementById('ul_tree').style.display = 'block';">
|
|||
|
|
<input class="form-control " id="unitName" name="unitName" style="width: 100%"></input>
|
|||
|
|
</a>
|
|||
|
|
<ul id="ul_tree" class="dropdown-menu" data-stopPropagation="true" style="border-color:#ccc;">
|
|||
|
|
<li class="header">
|
|||
|
|
<div id="companytree" style="width: 275px;height:400px;overflow-y:scroll;overflow-x:hidden;"></div>
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-3 control-label">*顺序</label>
|
|||
|
|
<div class="col-sm-7">
|
|||
|
|
<input type="number" id="morder" name="morder" class="form-control" placeholder="顺序" min="1"
|
|||
|
|
value="1">
|
|||
|
|
</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>
|