444 lines
15 KiB
Plaintext
444 lines
15 KiB
Plaintext
|
|
<%@page import="com.sipai.entity.scada.MPoint"%>
|
|||
|
|
<%@page import="com.sipai.tools.CommString"%>
|
|||
|
|
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
|||
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
|||
|
|
<%request.setAttribute("Active_False", CommString.Active_False); %>
|
|||
|
|
<%request.setAttribute("Active_True", CommString.Active_True); %>
|
|||
|
|
<%request.setAttribute("Flag_Enable",MPoint.Flag_Enable);%>
|
|||
|
|
<%request.setAttribute("Flag_Disable",MPoint.Flag_Disable);%>
|
|||
|
|
|
|||
|
|
<%request.setAttribute("Flag_Sql",MPoint.Flag_Sql);%>
|
|||
|
|
<%request.setAttribute("Flag_Modbus",MPoint.Flag_Modbus);%>
|
|||
|
|
<%request.setAttribute("Flag_Type_KPI",MPoint.Flag_Type_KPI);%>
|
|||
|
|
<%request.setAttribute("Flag_Type_Data",MPoint.Flag_Type_Data);%>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<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 refreshTypeSelect = function () {
|
|||
|
|
var select = $("#type").select2({
|
|||
|
|
data: null,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: false,//允许清空
|
|||
|
|
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
});
|
|||
|
|
select.val('${mPoint.type}').trigger("change");
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
//初始化启用状态选择框
|
|||
|
|
var refreshActiveSelect = function () {
|
|||
|
|
var select = $("#active").select2({
|
|||
|
|
data: null,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: false,//允许清空
|
|||
|
|
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
});
|
|||
|
|
select.val('${mPoint.active}').trigger("change");
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
//初始化信号类型选择框
|
|||
|
|
var refreshSignaltypeSelect = function () {
|
|||
|
|
var select = $("#signaltype").select2({
|
|||
|
|
data: null,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: false,//允许清空
|
|||
|
|
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
});
|
|||
|
|
select.val('${mPoint.signaltype}').trigger("change");
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//初始化信号源选择框
|
|||
|
|
var refreshValuetypeSelect = function () {
|
|||
|
|
var select = $("#valuetype").select2({
|
|||
|
|
data: null,
|
|||
|
|
placeholder: '请选择',//默认文字提示
|
|||
|
|
allowClear: false,//允许清空
|
|||
|
|
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
|||
|
|
language: "zh-CN",
|
|||
|
|
minimumInputLength: 0,
|
|||
|
|
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
|||
|
|
});
|
|||
|
|
select.val('${mPoint.valuetype}').trigger("change");
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
$(function () {
|
|||
|
|
refreshTypeSelect();
|
|||
|
|
refreshActiveSelect();
|
|||
|
|
refreshSignaltypeSelect();
|
|||
|
|
refreshValuetypeSelect();
|
|||
|
|
$("#measuredt").datepicker({
|
|||
|
|
language: 'zh-CN',
|
|||
|
|
autoclose: true,
|
|||
|
|
todayHighlight: true,
|
|||
|
|
format:'yyyy-mm-dd',
|
|||
|
|
})
|
|||
|
|
$("#measuredt").datepicker('setDate',new Date());
|
|||
|
|
})
|
|||
|
|
function update() {
|
|||
|
|
$("#subFormEditMPoint").bootstrapValidator('validate');//提交验证
|
|||
|
|
if ($("#subFormEditMPoint").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
|||
|
|
$.post(ext.contextPath + "/work/mpoint/update.do", $("#subFormEditMPoint").serialize(), function (data) {
|
|||
|
|
//console.log("data",data);
|
|||
|
|
if (data.res == "1") {
|
|||
|
|
closeModal('subModalEditMPoint');
|
|||
|
|
} else if (data.res == 0) {
|
|||
|
|
showAlert('d', '保存失败');
|
|||
|
|
} else {
|
|||
|
|
showAlert('d', data.res);
|
|||
|
|
}
|
|||
|
|
}, 'json');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$("#subFormEditMPoint").bootstrapValidator({
|
|||
|
|
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
|||
|
|
fields: {
|
|||
|
|
mpointcode: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '测量点code不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
parmname: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '测量点名称不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
// parmvalue: {
|
|||
|
|
// validators: {
|
|||
|
|
// notEmpty: {
|
|||
|
|
// message: '测量点值不能为空'
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// },
|
|||
|
|
active: {
|
|||
|
|
validators: {
|
|||
|
|
notEmpty: {
|
|||
|
|
message: '启用状态不能为空'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
//选择工艺段
|
|||
|
|
/* $.post(ext.contextPath + "/user/processSection/getProcessSection4Select.do", {companyId:'${company.id}'}, function(data) {
|
|||
|
|
var selelct_ =$("#processsectioncode").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;} // 函数用于呈现当前的选择
|
|||
|
|
});
|
|||
|
|
fixSelect2ToTool('processSectionId');
|
|||
|
|
},'json'); */
|
|||
|
|
/* function getMids(){
|
|||
|
|
var mrows= $('#grid').datagrid("getRows");
|
|||
|
|
var mids="";
|
|||
|
|
$.each(mrows, function(index, item){
|
|||
|
|
mids+=item.id+",";
|
|||
|
|
});
|
|||
|
|
mids=mids.replace(/,$/gi,"");
|
|||
|
|
return mids;
|
|||
|
|
}
|
|||
|
|
function doadd_M(){
|
|||
|
|
|
|||
|
|
$("#mids").val(getMids());
|
|||
|
|
localStorage.setItem("mids",$("#mids").val().split(","));
|
|||
|
|
var dialog = parent.ext.modalDialog({
|
|||
|
|
title : '添加设备',
|
|||
|
|
height:500,
|
|||
|
|
url : ext.contextPath + '/equipment/showEquipmentCardForSelects.do?iframeId=mPointAdd',
|
|||
|
|
buttons : [ {
|
|||
|
|
iconCls:'icon-ok',
|
|||
|
|
text : '确认',
|
|||
|
|
handler : function() {
|
|||
|
|
var data = dialog.find('iframe').get(0).contentWindow.selectFun(dialog, grid);
|
|||
|
|
var datas= $.parseJSON(data);
|
|||
|
|
console.log('enter',datas);
|
|||
|
|
if(datas.length>0){
|
|||
|
|
for(var i=0;i<datas.length;i++){
|
|||
|
|
grid.datagrid('appendRow',{
|
|||
|
|
id:datas[i].id,
|
|||
|
|
equipmentcardid:datas[i].equipmentcardid,
|
|||
|
|
equipmentname:datas[i].equipmentname,
|
|||
|
|
equipmentmodel:datas[i].equipmentmodel,
|
|||
|
|
equipmentclass:datas[i].equipmentclass,
|
|||
|
|
geographyarea:datas[i].geographyarea
|
|||
|
|
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
dialog.dialog('destroy');
|
|||
|
|
}
|
|||
|
|
} ]
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function dodelete_M(){
|
|||
|
|
var rows = $('#grid').datagrid('getChecked');
|
|||
|
|
if(rows.length==0){
|
|||
|
|
top.$.messager.alert("提示","请选择需要删除的数据","info");
|
|||
|
|
}else{
|
|||
|
|
top.$.messager.confirm("提示", "确定删除这些数据?", function(r) {
|
|||
|
|
if (r) {
|
|||
|
|
//复制rows,否则deleteRow的index会出错
|
|||
|
|
var copyRows = [];
|
|||
|
|
for ( var j= 0; j < rows.length; j++) {
|
|||
|
|
copyRows.push(rows[j]);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$.each(copyRows, function(index, item){
|
|||
|
|
$('#grid').datagrid('deleteRow',$('#grid').datagrid('getRowIndex',copyRows[index]));
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
$(function() {
|
|||
|
|
$("#scdtype").combobox({
|
|||
|
|
url : ext.contextPath + '/equipment/getGeographyArea4Combo.do',
|
|||
|
|
valueField : 'id',
|
|||
|
|
textField : 'name',
|
|||
|
|
method:'get',
|
|||
|
|
panelHeight:'auto',
|
|||
|
|
});
|
|||
|
|
$('#m').panel({
|
|||
|
|
width:"98%",
|
|||
|
|
height:"300",
|
|||
|
|
title: '使用机台',
|
|||
|
|
tools: [{
|
|||
|
|
iconCls:'icon-add',
|
|||
|
|
handler:function(){doadd_M();}
|
|||
|
|
},{
|
|||
|
|
iconCls:'icon-remove',
|
|||
|
|
handler:function(){dodelete_M();}
|
|||
|
|
}]
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
grid = $('#grid').datagrid({
|
|||
|
|
title : '',
|
|||
|
|
striped : true,
|
|||
|
|
rownumbers : true,
|
|||
|
|
idField : 'id',
|
|||
|
|
columns : [ [
|
|||
|
|
{checkbox:true , field : 'ck'},
|
|||
|
|
{width : '150', title : '设备编号', field : 'equipmentcardid', sortable : true, editor:'textbox',halign:'center'},
|
|||
|
|
{width : '150', title : '设备名称', field : 'equipmentname', sortable : true, editor:'textbox',halign:'center'},
|
|||
|
|
{width : '90', title : '设备型号', field : 'equipmentmodel', sortable : true, editor:'textbox',halign:'center'},
|
|||
|
|
{width : '90', title : '设备类型', field : 'equipmentclass', sortable : true, editor:'textbox',halign:'center'},
|
|||
|
|
{width : '90', title : '存放位置', field : 'geographyarea', sortable : true, editor:'textbox',halign:'center'}
|
|||
|
|
] ]
|
|||
|
|
});
|
|||
|
|
$("#modbusfigid").combobox({
|
|||
|
|
url : ext.contextPath + '/work/modbusfig/getlist4combo.do',
|
|||
|
|
valueField : 'id',
|
|||
|
|
textField : 'name',
|
|||
|
|
method:'get',
|
|||
|
|
panelHeight:'auto',
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$("#pointfunctiondefinition").combobox({
|
|||
|
|
url : ext.contextPath + '/work/mpoint/getMPointFunType4Combo.do',
|
|||
|
|
valueField : 'id',
|
|||
|
|
textField : 'name',
|
|||
|
|
method:'get',
|
|||
|
|
panelHeight:'auto',
|
|||
|
|
});
|
|||
|
|
}); */
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
<div class="modal fade" id="subModalEditMPoint">
|
|||
|
|
<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强制为subFormEditMPoint -->
|
|||
|
|
<form class="form-horizontal" id="subFormEditMPoint">
|
|||
|
|
<input name="biztype" type="hidden" value="${mPoint.biztype}" />
|
|||
|
|
<input name="id" type="hidden" value="${mPoint.id}" />
|
|||
|
|
<!-- <div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*厂区</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input name="biztype" type="hidden" value="${company.id}"/>
|
|||
|
|
<p class="form-control-static" >${company.name}</p>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">*工艺段</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select class="form-control select2" id="processsectioncode" name ="processsectioncode" style="width: 170px;"></select>
|
|||
|
|
</div>
|
|||
|
|
</div> -->
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*测量点id</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="mpointid" name="mpointid" placeholder="测量点id"
|
|||
|
|
value="${mPoint.mpointid }">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">*测量点code</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="mpointcode" name="mpointcode"
|
|||
|
|
placeholder="测量点code" value="${mPoint.mpointcode }">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*测量点名称</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="parmname" name="parmname" placeholder="测量点名称"
|
|||
|
|
value="${mPoint.parmname }">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">*启用状态</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id="active" name="active" class="form-control select2">
|
|||
|
|
<option value="${Active_True}">启用</option>
|
|||
|
|
<option value="${Active_False}">禁用</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">信号类型</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id="signaltype" name="signaltype" class="form-control select2">
|
|||
|
|
<option value="AI">AI</option>
|
|||
|
|
<option value="DI">DI</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">信号源</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id="valuetype" name="valuetype" class="form-control select2">
|
|||
|
|
<option value="${Flag_Sql}">数据库</option>
|
|||
|
|
<option value="${Flag_Modbus}">Modbus</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">类型</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<select id="type" name="type" class="form-control select2">
|
|||
|
|
<option value="${Flag_Type_Data}">采集</option>
|
|||
|
|
<option value="${Flag_Type_KPI}">KPI</option>
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">测量点值</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="parmvalue" name="parmvalue" placeholder="测量点值"
|
|||
|
|
value="${mPoint.parmvalue }">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">单位</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="unit" name="unit" placeholder="测量点单位"
|
|||
|
|
value="${mPoint.unit }">
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">测量日期</label>
|
|||
|
|
<div class="col-sm-4">
|
|||
|
|
<input type="text" class="form-control" id="measuredt" name="measuredt"
|
|||
|
|
style="width: 150px;" placeholder="请选择" />
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<!-- <tr>
|
|||
|
|
<th>单位</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="unit" name="unit" class="easyui-textbox"/>
|
|||
|
|
</td>
|
|||
|
|
<th>精度位数</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="rate" name="rate" class="easyui-textbox"/>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<th>作用定义(可自定义)</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="pointfunctiondefinition" name="pointfunctiondefinition" class="easyui-combobox" />
|
|||
|
|
</td>
|
|||
|
|
<th>表达式(例:>1,=1,(1-2))</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="exp" name="exp" class="easyui-textbox" />
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table>
|
|||
|
|
<br />
|
|||
|
|
<table class="table">
|
|||
|
|
|
|||
|
|
<tr>
|
|||
|
|
<th>报警上限</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="alarmmax" name="alarmmax" class="easyui-textbox"/>
|
|||
|
|
</td>
|
|||
|
|
<th>报警下限</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="alarmmin" name="alarmmin" class="easyui-textbox"/>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
|
|||
|
|
<th>报警启用</th>
|
|||
|
|
<td>
|
|||
|
|
<select name="TriggerAlarm" class="easyui-combobox" data-options="panelHeight:'auto',editable:false,value:'${Flag_Disable}',validType:'isBlank'">
|
|||
|
|
<option value="${Flag_Enable}">启用</option>
|
|||
|
|
<option value="${Flag_Disable}">禁用</option>
|
|||
|
|
</select>
|
|||
|
|
</td>
|
|||
|
|
<th>所属车间</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="scdtype" name="scdtype" class="easyui-combobox" data-options="validType:'isBlank'"/>
|
|||
|
|
</td>
|
|||
|
|
|
|||
|
|
</tr>
|
|||
|
|
<tr>
|
|||
|
|
<th>Modbus服务器</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="modbusfigid" name="modbusfigid" class="easyui-combobox" data-options="validType:'isBlank'"/>
|
|||
|
|
</td>
|
|||
|
|
<th>寄存器地址</th>
|
|||
|
|
<td>
|
|||
|
|
<input id="register" name="register" class="easyui-textbox"/>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</table> -->
|
|||
|
|
</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="update()" id="btn_save">保存</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|