263 lines
8.1 KiB
Plaintext
263 lines
8.1 KiB
Plaintext
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<%@page import="com.sipai.entity.scada.MPoint"%>
|
||
<%@ 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("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);%>
|
||
<html>
|
||
<head>
|
||
<title></title>
|
||
<jsp:include page="../inc.jsp"></jsp:include>
|
||
<script type="text/javascript">
|
||
function dosave(dialog,grid) {
|
||
if ($(".form").form('validate')) {
|
||
$.post(ext.contextPath + "/work/mpoint/save.do", $(".form").serialize(), function(data) {
|
||
if (data.res == 1) {
|
||
|
||
$.post(ext.contextPath + "/work/mpoint/savep.do",{no:data.id,mids:getMids()},function(data1){
|
||
top.$.messager.alert('提示', "保存成功", 'info', function() {
|
||
grid.datagrid('reload');
|
||
dialog.dialog('destroy');
|
||
});
|
||
});
|
||
}else if(data.res == 0){
|
||
top.$.messager.alert('提示', "保存失败", 'info');
|
||
}else{
|
||
top.$.messager.alert('提示', data.res, 'info');
|
||
}
|
||
},'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>
|
||
</head>
|
||
<body>
|
||
<form method="post" class="form">
|
||
<table class="table">
|
||
<input id="mids" name="mids" type="hidden" value="" />
|
||
<tr>
|
||
<th>测量点ID</th>
|
||
<td><input id="id" name="id" class="easyui-textbox"
|
||
data-options="required:true,validType:'isBlank'" value="" />
|
||
</td>
|
||
<th>测量点Code</th>
|
||
<td><input id="mpointcode" name="mpointcode" class="easyui-textbox"
|
||
data-options="required:true,validType:'isBlank'" value="" />
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>测量点名称</th>
|
||
<td><input id="parmname" name="parmname" class="easyui-textbox"
|
||
data-options="required:true,validType:'isBlank'" value="" />
|
||
</td>
|
||
<th>测量点启用</th>
|
||
<td>
|
||
<select name="active" class="easyui-combobox" data-options="panelHeight:'auto',editable:false,value:'${Flag_Enable}',validType:'isBlank'">
|
||
<option value="${Flag_Enable}">启用</option>
|
||
<option value="${Flag_Disable}">禁用</option>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th>信号类型</th>
|
||
<td>
|
||
<select name="signaltype" class="easyui-combobox" data-options="panelHeight:'auto',editable:false,value:'AI',validType:'isBlank'">
|
||
<option value="AI">AI</option>
|
||
<option value="DI">DI</option>
|
||
</select>
|
||
</td>
|
||
<th>信号源</th>
|
||
<td>
|
||
<select name="valuetype" class="easyui-combobox" data-options="panelHeight:'auto',editable:false,value:'${Flag_Sql}'">
|
||
<option value="${Flag_Sql}">数据库</option>
|
||
<option value="${Flag_Modbus}">Modbus</option>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
<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>
|
||
</br>
|
||
<div id="m" style="width:80%;">
|
||
<table id="grid" data-options="border:false"></table>
|
||
</div>
|
||
</body>
|
||
</html>
|