function reportApplyAddFun(){ $("#dlg").dialog("open").dialog("center").dialog("setTitle",'');// ''(二级页面标题) $("#fm").form("clear"); $.ajax({ // 加载报告申请基础数据 type : "post", url : "reportApplyBase", data:{ "flag":"1"}, cache : false, async : false, dataType : "json", success : function(data){ var str = ""; document.getElementById("companyNature").innerHTML = str; } , error:function(data){ alert("加载数据失败!" + data); } }); }/** * 获取字典数据 * @param request * @param response * @param map * @return */ /*@RequestMapping("reportApplyBase") public String saveInfo(HttpServletRequest request, HttpServletResponse response) { String flag = request.getParameter("flag"); log.info(flag); ListreportApplyBaseList = new ArrayList (); String json = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(DB_URL, USER, PASS); stmt = con.createStatement(); rs = stmt.executeQuery("select * from test"); while (rs.next()) { ReportApplyBase reportApply = new ReportApplyBase();// reportApply.setId(rs.getInt(Integer.parseInt("id"))); reportApply.setName(rs.getString("name")); reportApply.setAddress(rs.getString("address")); reportApplyBaseList.add(reportApply); } // list转为json传入前端 json = JSON.toJSONString(reportApplyBaseList); log.info(json); // 取得流向JSP传递数据 response.setContentType("text/html;charset=UTF-8"); response.getWriter().println(json); response.reset(); } catch (Exception e) { log.info(e.getMessage()); e.printStackTrace(); } finally { try { con.close(); stmt.close(); } catch (SQLException e) { e.printStackTrace(); } } return json; }*/ index.html index.js
function load(){
$('.main').html('<div th:replace="reportApplyList :: header"></div>'); catalog(id);}/** 提交报告申请基本信息 **/ function reportApplySubmitFun() { var projectNumber = $("#projectNumber").val();// 项目编号 var checkMonad = $("#checkMonad").val();// 受检单位 var monadNature = $("#monadNature option:selected").val();// 单位性质 var ascriptionArea = $("#ascriptionArea option:selected").val();// 所属区域 var checkType = $("#checkType option:selected").val();// 检测类型 var money = $("#money").val();// 金额 $.ajax({// 加载报告申请基础数据 type : "post", url : "saveReportApply", data:{"projectNumber":projectNumber, "checkMonad":checkMonad, "monadNature":monadNature, "ascriptionArea":ascriptionArea, "checkType":checkType, "money":money}, cache : false, async : false, dataType : "text", success : function(data){ if(data=="ok"){ alert("提交成功!"); } else if(data=="no"){ alert("提交失败!"); } } }); }
/** * 保存附件(缴费通知、合同登记【word】) */ public void saveReportApplyWord(HttpServletRequest request, HttpServletResponse response) { FileSaver fs = new FileSaver(request, response); FlIndex flIndex = new FlIndex(); flIndex.setXmbh(fs.getFormField("projectNumber"));// 项目编号 flIndex.setSjdw(fs.getFormField("checkMonad")); // 受检单位 flIndex.setDwxz(fs.getFormField("monadNature"));// 单位性质 flIndex.setSsqy(fs.getFormField("ascriptionArea"));// 所属区域 flIndex.setJclx(fs.getFormField("checkType"));// 检测类型 flIndex.setJe(fs.getFormField("money"));// 金额 String typeId = request.getParameter("typeId"); String flag = ""; try { DocTable docTable = new DocTable(); if (typeId.equals("1")) { // 缴费通知 docTable.setJftzd(new SerialBlob(fs.getFileBytes()));// 文件内容 } else if (typeId.equals("2")) { // 合同登记 docTable.setHtlr(new SerialBlob(fs.getFileBytes())); } flIndex.setDoc(docTable); reportApplyDao.persistReportApply(flIndex); flag = "ok"; } catch (Exception e) { flag = "on"; log.info("保存附件(缴费通知、合同登记【word】)失败"); e.printStackTrace(); } finally { fs.setCustomSaveResult(flag); fs.close(); } }