点击新增按钮,弹出对话框,并且对话框加载另外一个页面的内容的具体实现

    xiaoxiao2022-06-30  57

    今天在做一个功能的时候,我要实现:点击新增按钮,弹出对话框,并且对话框加载另外一个页面的内容

    具体实现如下:

    1、新增按钮的实现代码(js部分):

    //弹出框跳转页面 function toPage(flag){ var path="/template/report_27"; //对话框要加载的页面所在路径 $('#table').dialog({ title: "新增页面", width:800, height: 500, closed: false, cache: false, href: "${base}/fill/loadReport.action?path="+path, modal: true, buttons: [{ text: '保存', iconCls: 'icon-ok', handler: function () { alert('ok'); } }, { text: '关闭', iconCls: 'icon-cancel', handler: function () { $('#table').dialog('close'); } }] }); } 2、body部分:非常简单吧,哈哈

    <div id="table"></div>

    3、后台java实现loadReport.action方法:

    @RequestMapping(value="/loadReport.action") public String loadReport(HttpServletRequest request,Model model){ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");//日期转换模板 String flag=ParamUtil.getString(request,"flag"); String path=ParamUtil.getString(request, "path"); AuthInfo logininfo=SessionUtil.getLoginUsers(request).get(0); Map<String,Object> data=new HashMap<String,Object>(); if(flag.equals("add")){ String xzqhmc=this.fiServiceImpl.getXzqhmcByCode(logininfo.getManageAreaCode()); model.addAttribute("xzqhdm", logininfo.getManageAreaCode()); model.addAttribute("xzqhmc", xzqhmc); model.addAttribute("tbr", logininfo.getPersonName()); model.addAttribute("tbsj", sdf.format(new Date())); }else{ String templateid=ParamUtil.getString(request, "templateid"); String reportid=ParamUtil.getString(request, "reportid"); String id=ParamUtil.getString(request, "id"); String tablename=ParamUtil.getString(request,"tablename"); data=this.fiServiceImpl.getReportData(id, tablename); } model.addAttribute("tbdata", data); model.addAttribute("flag", flag); return path; }

    4、实现效果

    转载请注明原文地址: https://ju.6miu.com/read-1126057.html

    最新回复(0)