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

<t:dgToolBar title="编辑设备" icon="icon-edit" url="deviceController.do?goDeviceDetail" funname="editMyDevice"></t:dgToolBar>
JEECG弹出框提交表单
// 编辑管理的设备 
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
    });
}
JEECG弹出框提交表单

 

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

JEECG弹出框提交表单
<body style="overflow-y: hidden" scroll="no">
<t:formvalid form>
    <input >
    <input >
    <input >
    <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 />
                <span class="Validform_checktip"></span>
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label"> 主机名称: </label>
            </td>
            <td class="value">
                <input />
            </td>
        </tr>
        <tr>
            <td align="right">
                <label class="Validform_label"> 类型: </label>
            </td>
            <td class="value">
                <input />
            </td>
        </tr>
    </table>
</t:formvalid>
</body>
JEECG弹出框提交表单

 

三、后台程序(DeviceController.java)

JEECG弹出框提交表单
   /**
     * 进入编辑页面
     * @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";
    }
JEECG弹出框提交表单
JEECG弹出框提交表单
   /**
     * 更新设备信息
     * 
     * @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弹出框提交表单

相关文章:

  • 2021-12-20
  • 2021-12-16
  • 2022-12-23
  • 2022-02-08
  • 2021-12-27
  • 2021-05-15
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-15
  • 2021-04-29
  • 2021-10-06
  • 2021-12-16
  • 2021-12-31
相关资源
相似解决方案