diff --git a/src/main/java/com/nis/domain/Page.java b/src/main/java/com/nis/domain/Page.java index 046d3a8db..e1af7f486 100644 --- a/src/main/java/com/nis/domain/Page.java +++ b/src/main/java/com/nis/domain/Page.java @@ -3,10 +3,12 @@ */ package com.nis.domain; -import java.io.UnsupportedEncodingException; +import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Pattern; @@ -417,10 +419,83 @@ public class Page { sb.append("
"); // sb.insert(0,"
\n").append("
\n"); - + Map cancelMap = validateCancelService(); + if(cancelMap!=null) { + String requestName = (String)cancelMap.get("requestName"); + String indexTable = (String)cancelMap.get("indexTable"); + sb.append(""); + } return sb.toString(); } + //判断是否有requestName indexTableName + public Map validateCancelService() { + Map map = new HashMap(); + if(list != null && !list.isEmpty()) { + Object obj = (Object) list.get(0); + Class clazz = obj.getClass(); + tab: for (; clazz != Object.class; clazz = clazz.getSuperclass()) {//向上循环 遍历父类 + Field[] field = clazz.getDeclaredFields(); + for (Field f : field) { + String name = f.getName(); + if(name!=null&&name.equals("requestName")) { + + Object v = invokeMethod(obj, name); + if(v!=null) { + map.put("requestName", v); + } + } + if(name!=null&&name.equals("indexTable")) { + + Object v = invokeMethod(obj, name); + if(v!=null) { + map.put("indexTable", v); + } + } + if(map.containsKey("requestName")&&map.containsKey("indexTable")) { + break tab; + } + } + } + } + return map; + } + /** + * + * 执行某个Field的getField方法 + * + * @param owner 类 + * @param fieldName 类的属性名称 + * @param args 参数,默认为null + * @return + */ + private Object invokeMethod(Object owner, String fieldName) + { + Class ownerClass = owner.getClass(); + + //fieldName -> FieldName + String methodName = fieldName.substring(0, 1).toUpperCase()+ fieldName.substring(1); + + Method method = null; + + + + //invoke getMethod + try + { + method = ownerClass.getMethod("get" + methodName); + if (method!=null) { + + return method.invoke(owner); + }else { + return ""; + } + } + catch (Exception e) + { + return ""; + } + } /** * 获取分页HTML代码 * @return diff --git a/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java b/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java index 03b161717..925097ea2 100644 --- a/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java +++ b/src/main/java/com/nis/web/controller/basics/ServiceDictInfoController.java @@ -51,13 +51,7 @@ public class ServiceDictInfoController extends BaseController { } - - @RequestMapping(value="requestSelectInfo") - public String requestSelectInfo(Model model){ - List requestInfos=requestInfoService.getValidRequestInfo(); - model.addAttribute("requestInfos", requestInfos); - return "/basics/requestSelectInfo"; - } + @ResponseBody @RequestMapping(value="requestCancleInfoAjax", method = RequestMethod.POST) public String requestCancleInfoAjax(Integer cancelRequestId,String ids,String indexTable){ diff --git a/src/main/java/com/nis/web/controller/configuration/RequestInfoController.java b/src/main/java/com/nis/web/controller/configuration/RequestInfoController.java index e72a8941e..878dce3a5 100644 --- a/src/main/java/com/nis/web/controller/configuration/RequestInfoController.java +++ b/src/main/java/com/nis/web/controller/configuration/RequestInfoController.java @@ -162,4 +162,15 @@ public class RequestInfoController extends BaseController{ model.addAttribute("taskInfos", taskInfos); } + /** + * 配置取消审核操作时选择来函 + * @param model + * @return + */ + @RequestMapping(value="requestSelectInfo") + public String requestSelectInfo(Model model){ + List requestInfos=requestInfoService.getValidRequestInfo(); + model.addAttribute("requestInfos", requestInfos); + return "/basics/requestSelectInfo"; + } } diff --git a/src/main/webapp/WEB-INF/tags/sys/delRow.tag b/src/main/webapp/WEB-INF/tags/sys/delRow.tag index 064b9a469..018314742 100644 --- a/src/main/webapp/WEB-INF/tags/sys/delRow.tag +++ b/src/main/webapp/WEB-INF/tags/sys/delRow.tag @@ -199,21 +199,14 @@ var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox"); top.$.jBox.tip("", ""); return; } - if((url.indexOf("?isAudit=3") > 1)){ // 审核中区分是否有添加取消来函 - - var reobj=JSON.parse(JSON.stringify("${page.list[0]}")); - var indexTableNameArr=reobj.match(/indexTable=(\w*),/); - var requestNameArr=reobj.match(/requestName=(\w*),/); + var requestName=$("#ifCancelRequestInfo").attr("requestName"); + var indexTable=$("#ifCancelRequestInfo").attr("indexTable"); // 有来函业务的取消审核 - if(reobj!=null&&reobj.indexOf("requestName")!=-1&&requestNameArr!=null&&requestNameArr.length>1&&indexTableNameArr!=null&&indexTableNameArr.length>1){ - var indexTableName =indexTableNameArr[1]; - var requestName =requestNameArr[1]; - - if(requestName.indexOf("null")==-1&&typeof(indexTableName)!="undefined"&&indexTableName!=null&&indexTableName!=''&&indexTableName.indexOf("null")==-1){ - /****************************************** */ - $.jBox.open("iframe:${ctx}/basics/serviceDictInfo/requestSelectInfo", "",500, 400, { buttons: { '': 1, '': 0 }, + if(requestName!=null&&indexTable!=null&&requestName.indexOf("null")==-1&&indexTable.indexOf("null")==-1){ + /****************取消审核时增加来函************************** */ + $.jBox.open("iframe:${ctx}/cfg/request/requestSelectInfo", "",500, 400, { buttons: { '': 1, '': 0 }, submit: function (v, h, f) { if (v == 0) { return true; // close the window @@ -228,7 +221,7 @@ var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox"); $.ajax({ type:'post', url:'${ctx}/basics/serviceDictInfo/requestCancleInfoAjax', - data:{"cancelRequestId":cancelRequestId,"ids":ids,"indexTable":indexTableName}, + data:{"cancelRequestId":cancelRequestId,"ids":ids,"indexTable":indexTable}, async:false, success:function(data,textStatus){//处理返回结果 window.location = url+"&ids="+ids+"&compileIds="+compileIds; @@ -261,26 +254,6 @@ var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox"); /****************************************** */ - }else{ - // 防止有来函无表名的取消审核操作 - top.$.jBox.confirm("","",function(v,h,f){ - - if(v=="ok"){ - if(url.indexOf("?")>0){ - window.location = url+"&ids="+ids+"&compileIds="+compileIds; - }else{ - window.location = url+"?ids="+ids+"&compileIds="+compileIds; - } - if(url.indexOf("?isAudit") > 1){ - loading(''); - }else if(url.indexOf("export") > 1){ - closeTip(); - } - //$("#searchForm").submit(); - } - },{buttonsFocus:1}); - top.$('.jbox-body .jbox-icon').css('top','55px'); - } }else{ // 无来函选项的取消审核操作 top.$.jBox.confirm("","",function(v,h,f){