一、设备主页面(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. Ora-00906:missing left parenthesis

    问题描述 Ora-00906:missing left parenthesis 问题原因 varchar和varchar2  必须指定长度,不然会报错

  2. Spring与RestHighLevelClient

    Elasticsearch连接方式有两种:分别为TCP协议与HTTP协议 最近使用es比较多,之前使用一直是使用spring封装的spring-data-elasticsearch:关于spring- ...

  3. python特性

    # for用法 for i in range(0,100,2): print(i) n = 0 # while用法 while n < 100: print(n) n += 2 else: pr ...

  4. JS高级---案例:验证用户输入的是不是中文名字

    案例:验证用户输入的是不是中文名字 [\u4e00-\u9fa5] <!DOCTYPE html> <html lang="en"> <head> ...

  5. python之路模块补充

    =======================================json序列化========================================= ============ ...

  6. Outlook365(Oulook2016 或2013) 写邮件输入收件人时的推荐联系人如何清理?

    · 在Outlook365(Oulook2016 或2013) 中写邮件,输入收件人邮箱地址时,会出现“最近联系人”  “其他建议”等推荐的联系人,可以方便选择.如果里面有很多邮箱地址的已经无效的话, ...

  7. sql 应用记录

    SELECT * FROM (select aa.*,bb.mentalvisitid, ' then '家庭访视' else '电话' end as BCSFXS ,bb.visitdate, ' ...

  8. Oracle 监听器 Listene

    Oracle 监听器 Listener 是一个重要的数据库服务器组件,在整个 Oracle 体系结构中,扮演着重要的作用.它负责管理 Oracle 数据库和客户端之间的通讯,它在一个特定的网卡端口(默 ...

  9. d2admin框架学习

    <template slot-scope="scope"> <el-button @click="upper_score(scope.$index, s ...

  10. codeforces 1284E. New Year and Castle Construction(极角排序+扫描枚举)

    链接:https://codeforces.com/problemset/problem/1284/E 题意:平面上有n个点,问你存在多少组四个点围成的四边形 严格包围某个点P的情况.不存在三点共线. ...