265 lines
12 KiB
Plaintext
265 lines
12 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
//摄像头选择
|
|||
|
|
// 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');
|
|||
|
|
// });
|
|||
|
|
// };
|
|||
|
|
|
|||
|
|
var editMPointFun = function () {
|
|||
|
|
if ($('#valueUrl').val() != "") {
|
|||
|
|
$.post(ext.contextPath + '/visualjsp/editMPoint.do', { id: $('#valueUrl').val() }, function (data) {
|
|||
|
|
$("#subDiv_select").html(data);
|
|||
|
|
openModal('subModalEditMPoint');
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
swal({
|
|||
|
|
text: "请先选择测量点",
|
|||
|
|
dangerMode: true,
|
|||
|
|
buttons: {
|
|||
|
|
cancel: {
|
|||
|
|
text: "知道了",
|
|||
|
|
value: null,
|
|||
|
|
visible: true,
|
|||
|
|
className: "btn btn-default btn-sm",
|
|||
|
|
closeModal: true,
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
function doupdate() {
|
|||
|
|
$("#subForm").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/visualjsp/doupdateJspElement.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("${jspElement.dataType}").trigger("change");
|
|||
|
|
// fixSelect2ToTool("dataType");
|
|||
|
|
// }, 'json');
|
|||
|
|
|
|||
|
|
$.post(ext.contextPath + '/user/getUnitForTree_Selected.do', { ng: '' }, function (data) {
|
|||
|
|
$("#unitId").val('${jspElement.unitId}');
|
|||
|
|
$.post(ext.contextPath + '/user/getCompany.do', { id:'${jspElement.unitId}'}, function (data) {
|
|||
|
|
$("#unitName").val(data.content1[0].sname);
|
|||
|
|
}, 'json');
|
|||
|
|
// $("#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">
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input id="id" name="id" type="hidden" value="${jspElement.id}" />
|
|||
|
|
<input id="pid" name="pid" type="hidden" value="${jspElement.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="名称"
|
|||
|
|
value="${jspElement.name}">
|
|||
|
|
</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="元素识别编码" value="${jspElement.elementCode}">
|
|||
|
|
</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" value="${jspElement.style}"
|
|||
|
|
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="${jspElement.getValueType}">
|
|||
|
|
</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"
|
|||
|
|
value="${jspElement.valueUrl}" placeholder="链接">
|
|||
|
|
<span style="display: inline-block;">注:1.getValue/getHistory/getModbus时填写生产库测量点id。</span>
|
|||
|
|
<span>2.getHTTP/getCacheData时填写http链接路径。</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="col-sm-2">
|
|||
|
|
<button type="button" class="btn btn-default btn-sm" title="更改测量点值"
|
|||
|
|
onclick="editMPointFun();"><i class="fa fa-edit"></i></button>
|
|||
|
|
</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">
|
|||
|
|
<select class="form-control select2" id="dataType" name="dataType"
|
|||
|
|
style="width: 100%"></select>
|
|||
|
|
</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="${planInteraction.camera.name}" readonly
|
|||
|
|
style="background-color: white">
|
|||
|
|
<input id="cameraId" name="cameraId" type="hidden" value="${planInteraction.cameraId}" />
|
|||
|
|
<span style="display: inline-block;">注:若为摄像头元素此选项必选。</span>
|
|||
|
|
</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="${jspElement.morder}">
|
|||
|
|
</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="doupdate()">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|