一、设备主页面(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. python爬取连续一字板股票及当时日期数据【原创分享】

    本篇为个人测试记录,记录爬取连续一字板的股票及当时日期. import tushare as ts import pandas as pd import time # 筛选一字板的策略 def gp_ ...

  2. 2019牛客多校第五场B generator 十进制快速幂

    generator 1 题意 给出\(x_0,x_1,a,b\)已知递推式\(x_i=a*x_{i-1}+b*x_{i-2}\),出个n和mod,求\(x_n\) (n特别大) 分析 比赛的时候失了智 ...

  3. [Codechef SSTORY] A Story with Strings - 后缀数组,二分

    [Codechef SSTORY] A Story with Strings Description 给定两个字符串,求它们的最长公共子串.如果解不唯一,输出最先在第二个字符串中出现的那个. Solu ...

  4. C++-有感

    今日在图书馆待了差不多一天,我都忘了我吃饭了没,拿着看视频学习,没啦,主要还是看书,突然感觉有点写不动了. 明天开始不带电脑了,准备把数据结构书重新过一遍,算了,还是不用C++写了,感觉C++居然做题 ...

  5. C++-new 的六种重载形式

    当写出这样的代码的时候, 实际上有两步操作: p = new P(); 1.分配内存, 2.然后在分配好的内存之上初始化类成员. 第二步是有构造函数完成的, 第一步就是new函数的工作. 全局的new ...

  6. U盘拷贝目标文件过大无法复制时的解决方法

    在cmd下输入:convert U盘符:/fs:ntfs    --->  回车 转换完成后可以看到U盘属性为NTFS了 这时就可以复制大文件到U盘了

  7. 大数据-es(elasticsearch)

    elasticsearch elasticsearch是lucene作为核心的实时分布式检索,底层使用倒排索引实现. 倒排索引原理 索引表中的每一项都包括一个属性值和具有该属性值的各记录的地址.由于不 ...

  8. OpenCV——仿射变换

    什么是仿射变换? 一个任意的仿射变换都能表示为 乘以一个矩阵 (线性变换) 接着再 加上一个向量 (平移). 综上所述, 我们能够用仿射变换来表示: 旋转 (线性变换) 平移 (向量加) 缩放操作 ( ...

  9. spring(三):BeanFactory

  10. Go初始化结构体数组/切片

    package main import "fmt" func main() { var s []student fmt.Printf("%T\n", s) // ...