231 lines
6.7 KiB
Plaintext
231 lines
6.7 KiB
Plaintext
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<%@ 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"%>
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
<jsp:include page="../../inc.jsp"></jsp:include>
|
|
<script type="text/javascript">
|
|
function dosave(dialog) {
|
|
if ($(".form").form('validate')) {
|
|
$.post(ext.contextPath + "/work/scadaPic/updateMPoint.do", $(".form").serialize(), function(data) {
|
|
if (data.res == 1) {
|
|
top.$.messager.alert('提示', "保存成功", 'info', function() {
|
|
dialog.dialog('destroy');
|
|
});
|
|
}else if(data.res == 0){
|
|
top.$.messager.alert('提示', "保存失败", 'info');
|
|
}else{
|
|
top.$.messager.alert('提示', data.res, 'info');
|
|
}
|
|
},'json');
|
|
}
|
|
}
|
|
var grid;
|
|
var MpPics;
|
|
$(function() {
|
|
$("#mpid").textbox('textbox').bind("click", function () {
|
|
selectMPint();
|
|
});
|
|
$('#expressionflag').switchbutton({
|
|
onChange: function(checked){
|
|
if(checked==true){
|
|
$('#tool').panel('open');
|
|
$('#expressionflag').switchbutton("setValue",1);//选中是value为1
|
|
showExpression()
|
|
}else{
|
|
$('#tool').panel('close');
|
|
}
|
|
}
|
|
});
|
|
$('#tool').panel({
|
|
width:"100%",
|
|
height:"250",
|
|
title: '表达式',
|
|
tools: [{
|
|
iconCls:'icon-add',
|
|
handler:function(){addFun();}
|
|
},{
|
|
iconCls:'icon-remove',
|
|
handler:function(){deletesFun();}
|
|
}]
|
|
|
|
});
|
|
$('#tool').panel('close');
|
|
MpPics =JSON.parse(getMpPic());
|
|
grid = $('#grid').datagrid({
|
|
title : '',
|
|
url : ext.contextPath + '/work/scadaPic/getMPoint_ExpressionList.do?mpid='+mpid,
|
|
striped : true,
|
|
rownumbers : true,
|
|
singleSelect: false,
|
|
ctrlSelect:true,
|
|
selectOnCheck: false,
|
|
checkOnSelect: false,
|
|
idField : 'id',
|
|
columns : [ [
|
|
{checkbox:true , field : 'ck'},
|
|
{width : '160', title : '表达式', field : 'expression', sortable : true, halign:'center'},
|
|
{width : '100', title : '显示图标', field : 'expressionway', sortable : true, align:'center',formatter : function(value,row){
|
|
|
|
//console.log(MpPics[value].path)
|
|
var pic='<img src=../../'+MpPics[value].path+' style="width:20px;height:20px;" ></img>';
|
|
return pic;
|
|
}}
|
|
] ],
|
|
onLoadSuccess : function(data) {
|
|
$('.iconImg').attr('src', ext.pixel_0);
|
|
}
|
|
});
|
|
if("${scadaPic_MPoint.expressionflag}"=='1'){
|
|
$('#expressionflag').switchbutton("check");
|
|
}
|
|
|
|
});
|
|
function showExpression(){
|
|
|
|
var mpid =$("#mpid").textbox('getValue');
|
|
$('#grid').datagrid({url:ext.contextPath + '/work/scadaPic/getMPoint_ExpressionList.do?mpid='+mpid});
|
|
|
|
}
|
|
function selectMPint(){
|
|
var dialog = parent.ext.modalDialog({
|
|
title : '选择测量点',
|
|
width: 800,
|
|
height:550,
|
|
url : ext.contextPath + '/work/mpoint/showlistForSelect.do',
|
|
buttons : [{
|
|
text : '确定',
|
|
iconCls:'icon-ok',
|
|
handler : function() {
|
|
var res=dialog.find('iframe').get(0).contentWindow.selectOK();
|
|
if(res!=null){
|
|
$("#mpid").textbox('setValue',res.id);
|
|
$("#txt").textbox('setValue',res.parmname);
|
|
}
|
|
showExpression();
|
|
dialog.dialog('destroy');
|
|
|
|
}
|
|
},
|
|
{
|
|
text : '取消',
|
|
iconCls:'icon-cancel',
|
|
handler : function() {
|
|
dialog.dialog('destroy');
|
|
|
|
}
|
|
}
|
|
]
|
|
});
|
|
}
|
|
var addFun = function() {
|
|
var mpid =$("#mpid").textbox('getValue');
|
|
if(mpid==null || mpid==""){
|
|
top.$.messager.alert('提示', '请先选择测量点!','info');
|
|
return;
|
|
}
|
|
var dialog = parent.ext.modalDialog({
|
|
iframeId:'add',
|
|
title : '新增表达式',
|
|
width:500,
|
|
height:200,
|
|
url : ext.contextPath + '/work/scadaPic/addMPointExpression.do?mpid='+mpid,
|
|
buttons : [
|
|
{
|
|
text : '保存',
|
|
handler : function() {
|
|
dialog.find('iframe').get(0).contentWindow.dosave(dialog, grid);
|
|
}
|
|
}
|
|
]
|
|
});
|
|
};
|
|
var deletesFun = function() {
|
|
var checkedItems = $('#grid').datagrid('getChecked');
|
|
var datas="";
|
|
$.each(checkedItems, function(index, item){
|
|
if(datas!=""){
|
|
datas+=",";
|
|
}
|
|
datas+=item.id;
|
|
});
|
|
if(datas==""){
|
|
top.$.messager.alert('提示', '未查询到需要删除的记录','info');
|
|
}else{
|
|
top.$.messager.confirm('提示', '您确定要删除多条记录?', function(r) {
|
|
if (r) {
|
|
$.post(ext.contextPath + '/work/scadaPic/deleteMPointExpression.do', {ids:datas} , function(data) {
|
|
if(data>0){
|
|
top.$.messager.alert('提示','成功删除'+data+'条记录','info');
|
|
grid.datagrid('reload');
|
|
grid.datagrid('clearChecked');
|
|
}else{
|
|
top.$.messager.alert('提示','删除失败','info');
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
};
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<form method="post" class="form">
|
|
<input name="id" type="hidden" value="${scadaPic_MPoint.id}"/>
|
|
<input name="containerwidth" type="hidden" value="${scadaPic_MPoint.containerwidth}"/>
|
|
<input name="containerheight" type="hidden" value="${scadaPic_MPoint.containerheight}"/>
|
|
<input name="pid" type="hidden" value="${scadaPic_MPoint.pid}"/>
|
|
<table class="table">
|
|
<tr>
|
|
<th>测量点编号</th>
|
|
<td><input id="mpid" name="mpid" class="easyui-textbox" data-options="required:true,validType:'isBlank',prompt:'单击选择'" value="${scadaPic_MPoint.mpid}" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>文本内容</th>
|
|
<td><input id ="txt" name="txt" class="easyui-textbox" data-options="required:true,validType:'isBlank'" value="${scadaPic_MPoint.txt}" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>字体大小</th>
|
|
<td>
|
|
<input id="fsize" name="fsize" class="easyui-textbox" value="${scadaPic_MPoint.fsize}"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>posx</th>
|
|
<td>
|
|
<input id="posx" name="posx" class="easyui-textbox" value="${scadaPic_MPoint.posx}"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>posy</th>
|
|
<td>
|
|
<input id="posy" name="posy" class="easyui-textbox" value="${scadaPic_MPoint.posy}"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>精确位数</th>
|
|
<td>
|
|
<input id="accuracy" name="accuracy" class="easyui-textbox" value="${scadaPic_MPoint.accuracy}"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>启用表达式</th>
|
|
<td>
|
|
<input id="expressionflag" name ="expressionflag"
|
|
class="easyui-switchbutton" style="height:22px;width:50px;"
|
|
data-options="onText:'是',offText:'否'" unchecked/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br/>
|
|
<div id="tool" class="easyui-panel" style="height:200px;width:100%;" data-options="border:true" >
|
|
<table id="grid" data-options="border:false,fit:true" ></table>
|
|
</div>
|
|
</form>
|
|
</body>
|
|
</html>
|