一、设备主页面(deviceMain.jsp)  

<t:dgToolBar title="编辑设备" icon="icon-edit" url="deviceController.do?goDeviceDetail" funname="editMyDevice"></t:dgToolBar>
// 编辑管理的设备
function editMyDevice(title,url,gname){
var ids = "";
var rows = $("#" + gname).datagrid('getSelections');
if (rows.length == 1) {
$.dialog.setting.zIndex = getzIndex(true);
$.dialog.confirm('你确定编辑该数据吗?', function(r) {
if (r) {
$.dialog({
content: 'url:'+url+"&ids="+rows[0].serial,
lock : true,
width:700,
height:320,
title:"编辑设备信息",
opacity : 0.3,
cache:false,
cancelVal: '关闭',
cancel: true, /*为true等价于function(){}*/
button:[{
name: '保存',
callback: function(){
iframe = this.iframe.contentWindow;//获取弹出层的iframe
saveParam();//自定义保存数据方法
$("#"+gname).datagrid("reload");
$("#"+gname).datagrid('unselectAll');
return true;//阻止页面关闭(默认为true不关闭)
}
}]
});
}
});
} else if (rows.length > 1) {
tip("请选择一条数据进行编辑");
} else {
tip("请选择需要编辑的数据");
}
} /**
* 自定义保存数据方法
* @param url
* @param gridname
*/
function saveParam() {
$("#formobj", iframe.document).form('submit', {
onSubmit : function() {
},
success : function(r) {
msgdialog('操作成功!','success');
},
error : function(r) {
msgdialog('操作异常!','error');
}
});//UsersForm为Form表单id,提交表单
} /**
* 操作结果提示语
* @param content:提示内容
* @param type:图标类型
*/
function msgdialog(content,type){
$.dialog({
content: content,
title:'提示信息',
icon: type+'.gif',
titleIcon: 'lhgcore.gif',
width:136,
height:80,
top: '98%',
left:'98%',
fixed: true
});
}

二、设备弹出框编辑页面(deviceEdit.jsp)  

<body style="overflow-y: hidden" scroll="no">
<t:formvalid formid="formobj" layout="table" dialog="true" action="deviceController.do?doUpdateDevice">
<input id="serial" name="serial" type="hidden" value="${device.serial}">
<input id="phone" name="phone" type="hidden" value="${device.phone }">
<input id="smsflag" name="smsflag" type="hidden" value="${device.smsflag }">
<table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
<tr>
<td align="right" width="25%" nowrap>
<label class="Validform_label"> IP: </label>
</td>
<td class="value" width="85%">
<input id="nodeip" name="nodeip" class="inputxt" type="text" datatype="s1-200" value="${device.nodeip}"/>
<span class="Validform_checktip"></span>
</td>
</tr>
<tr>
<td align="right">
<label class="Validform_label"> 主机名称: </label>
</td>
<td class="value">
<input id="hostname" name="hostname" class="inputxt" type="text" value="${device.hostname}"/>
</td>
</tr>
<tr>
<td align="right">
<label class="Validform_label"> 类型: </label>
</td>
<td class="value">
<input id="type" name="type" class="inputxt" type="text" value="${device.type}"/>
</td>
</tr>
</table>
</t:formvalid>
</body>

三、后台程序(DeviceController.java)

   /**
* 进入编辑页面
* @param id
* @param request
* @return
*/
@RequestMapping(params="goDeviceDetail")
public String goDeviceDetail(String ids, HttpServletRequest request) {
String sql = "select * from device where Serial = " + ids;
Device device= deviceService.excuteQuery(sql);
device.setNodeip(device.getNodeip().trim());
device.setHostname(device.getHostname().trim());
device.setPhone(device.getPhone().trim());
device.setType(device.getType().trim());
device.setSmsflag(device.getSmsflag().trim());
request.setAttribute("device", device);
return "device/deviceEdit";
}
   /**
* 更新设备信息
*
* @return
*/
@RequestMapping(params = "doUpdateDevice")
@ResponseBody
public AjaxJson doUpdateDevice(Device device, HttpServletRequest request) {
String message = "更新设备成功";
AjaxJson j = new AjaxJson(); String nodeip = device.getNodeip().trim();
String hostname = device.getHostname().trim();
String type = device.getType().trim(); String updateSybaseSql = "update device set NodeIP='" + nodeip + "', hostname='"+hostname+"', type='"+type+"' where Serial=" + device.getSerial();
int result = this.deviceService.excuteUpdate(updateSybaseSql);
if(result != -1){
this.systemService.saveOrUpdate(device);
try {
DataSyncQueue.syncPhoneZrQueue.put("phone_zr"); //更新设备信息成功后,同步数据
} catch (InterruptedException e) {
e.printStackTrace();
}
}
j.setMsg(message);
return j;
}

JEECG弹出框提交表单的更多相关文章

  1. vue iview modal弹出框 form表单验证

    一.ref="addApply" :model="addApply" :rules="ruleValidate"   不要忘记prop 二. ...

  2. jeecg 弹出框 点击按钮回调父页面 返回值

    jeecg 弹出框 点击按钮回调父页面 返回值 <t:base type="jquery"></t:base> <t:base type=" ...

  3. iframe中使用模态框提交表单后,iframe加载父页面的解决方法

    在iframe中使用模态框提交表单后,会出现iframe加载整个父页面的问题,如下图: 解决方法: 在form表单中添加target属性 _parent 这个属性会使目标文档载入父窗口或者包含来超链接 ...

  4. Layui 监听 复选框 提交表单

    表单数据这一块 layui 做的是真的不好,无论是在渲染还是在交互方面,每次都要自己来重新实现代码 #贴上代码 <!DOCTYPE html> <head> <meta ...

  5. EasyUI加zTree使用解析 easyui修改操作的表单回显方法 验证框提交表单前验证 datagrid的load方法

    带参提交一次查询,从服务器加载新数据.这是一个神奇的方法 $('#dg').datagrid('load',{ code: '01', name: 'name01' }); easyui修改操作的回显 ...

  6. ios手机弹出层上表单的操作,收起键盘焦点错乱的问题

    今天遇到了ios手机下 弹出层上form表单 当收起键盘后,焦点错乱,无法再操作的问题 解决办法 function device() { const u = navigator.userAgent; ...

  7. easyUI使用dailog实现弹出框带表单功能

    本文为博主原创,未经允许不得转载: 示例如下: 需要注意的地方在id为win的div中需要有:closed="true"这个属性,这个属性为控制dailogn对话框显示与隐藏的属性 ...

  8. 由于想要实现下载的文件可以进行选择,而不是通过<a>标签写死下载文件的参数,所以一直想要使用JFinal结合ajax实现文件下载,但是ajax实现的文件下载并不能触发浏览器的下载文件弹出框,这里通过模拟表单提交实现同样的效果。

    由于想要实现下载的文件可以进行选择,而不是通过<a>标签写死下载文件的参数,所以一直想要使用JFinal结合ajax实现文件下载(这样的话ajax可以传递不同的参数),但是ajax实现的文 ...

  9. Bootstrap使用模态框modal实现表单提交弹出框

    Bootstrap 模态框(Modal)插件 模态框(Modal)是覆盖在父窗体上的子窗体.通常,目的是显示来自一个单独的源的内容,可以在不离开父窗体的情况下有一些互动.子窗体可提供信息.交互等.如果 ...

随机推荐

  1. 【算法学习记录-排序题】【PAT A1025】PAT Ranking

    Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhe ...

  2. 微信小程序块导航

    1.wxml页面 <!--index.wxml--> <swiper current="{{currentTab}}" class="swiper-bo ...

  3. macaron 根目录默认为templates文件夹,所以如果启动目录同目录下有templates目录,要给它指定另一个文件夹

    m *macaron.Macaron //随便指向一个目录,因为web没用到模板,不能使用默认值templates,因为这个目录被其他模板占用了m.Use(macaron.Renderer(macar ...

  4. manifold learning

    MDS, multidimensional scaling, 线性降维方法, 目的就是使得降维之后的点两两之间的距离尽量不变(也就是和在原是空间中对应的两个点之间的距离要差不多).只是 MDS 是针对 ...

  5. [学习笔记]用Python简易向喜欢的人表白

    前几天是情人节,就用Python图像库PIL来搞点事情. 先看图: 其实这样看不出什么来,然后需要放大: 放大以后就能看到你相对女神说的话. 但是对于学计算机的我来说,更想琢磨是怎样的流程完成的这个图 ...

  6. java基础之 控制语句

    java基础之控制语句 在java中控制语句包括: if-else语句 swicth-case 语句 while循环 do-while循环 for循环 break语句 continue语句 其中:if ...

  7. TCP/IP详解,卷1:协议--IP:网际协议

    引言 I P 是 T C P / I P 协议族中最为核心的协议.所有的 T C P.U D P.I C M P 及 I G M P 数据都以 I P 数据 报格式传输(见图 1 - 4).许多刚开始 ...

  8. docker映射

    端口映射 大-P对容器暴露的所有端口进行映射 小-p可以指定对哪些端口进行映射 第一种,只指定容器的端口,宿主机的端口是随机映射的 第二种,宿主机的端口和容器的端口一一对应, 第三种,只配置容器的ip ...

  9. AcWing 3. 完全背包问题

    朴素 #include<iostream> #include<algorithm> using namespace std ; ; int n,m; int v[N],w[N] ...

  10. PTPX-功耗分析总结

    使用PrimeTime PX进行功耗分析有两种:一种是平均功耗的分析Averaged power analysis,一种是Time-based power analysis.   电路的功耗主要有两种 ...