ajax之分页

来源:互联网 发布:优美句子知乎 编辑:程序博客网 时间:2024/05/01 01:52

ajax之分页

前台页面:

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. <%@ page contentType="text/html; charset=GBK"%>  
  2. <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>  
  3. <%@ taglib uri="/WEB-INF/tld/utiltags.tld" prefix="util"%>  
  4. <script type="text/javascript"  
  5.     src="<%=request.getContextPath()%>/js/common.js"></script>  
  6. <script language="javascript"  
  7.     src="<%=request.getContextPath()%>/js/xmlcommon.js"></script>  
  8. <script type="text/javascript"  
  9.     src="<%=request.getContextPath()%>/css/tabber.js"></script>  
  10. <script language="javascript"  
  11.     src="<%=request.getContextPath()%>/js/calendar.js"></script>  
  12.   
  13. <link rel="stylesheet"  
  14.     href="<%=request.getContextPath()%>/css/example.css" TYPE="text/css"  
  15.     MEDIA="screen" />  
  16. <link rel="stylesheet"  
  17.     href="<%=request.getContextPath()%>/css/style.css" type="text/css" />  
  18. <script language="javascript"  
  19.     src="<%=request.getContextPath()%>/js/jquery-1.3.2.min.js"></script>  
  20.   
  21. <head>  
  22.   
  23. <util:message />  
  24.   
  25. <meta http-equiv="Content-Type" content="text/html; charset=GBK">  
  26. <title>电话销售系统</title>  
  27. </head>  
  28. <body>  
  29.     <form name="form1" method="post" action="">  
  30.         <table width="99%" border="0" align="center" cellpadding="0"  
  31.             cellspacing="0">  
  32.             <tr>  
  33.                 <td width="22" height="32"  
  34.                     background="<%=request.getContextPath()%>/images/main/frame_q.jpg">  
  35.                      </td>  
  36.                 <td  
  37.                     background="<%=request.getContextPath()%>/images/main/frame_w.jpg"  
  38.                     class="MainTitle">  
  39.                     <!-- 呼入控制数据设置 -->   
  40.                         呼入屏蔽设置  
  41.                 </td>  
  42.                 <td width="22" height="32"  
  43.                     background="<%=request.getContextPath()%>/images/main/frame_e.jpg">  
  44.                      </td>  
  45.             </tr>  
  46.             <tr>  
  47.                 <td  
  48.                     background="<%=request.getContextPath()%>/images/main/frame_a.jpg">  
  49.                      </td>  
  50.                 <td valign="top" bgcolor="#EFEFEF">  
  51.                     <table width="100%" border="0" cellspacing="0" cellpadding="0">  
  52.                         <tr>  
  53.                             <td> </td>  
  54.                         </tr>  
  55.                     </table>  
  56.                     <table width="100%" border="0" cellpadding="0" cellspacing="0"  
  57.                         bgcolor="#EFEFEF">  
  58.                         <tr>  
  59.                             <td class="SecondTitle">.:设置查询:.</td>  
  60.                         </tr>  
  61.                         <tr>  
  62.                             <td bgcolor="#999999">  
  63.                                 <table name="tableA" border="0" cellspacing="1" cellpadding="1"  
  64.                                     width="100%">  
  65.                                     <tr width="100%">  
  66.                                         <td width="14%" align="right" class="general-td">数据来源:</td>  
  67.                                         <td align="left" class="general-td"><select  
  68.                                             name="dataSource" class="selectCtrl" id="dataSource">  
  69.                                                 <option value="">全部</option>  
  70.                                                 <option value="1" <c:if test='${result.blackListDTO.dataSource == "1"}'>selected</c:if>>电销系统</option>  
  71.                                                 <option value="2" <c:if test='${result.blackListDTO.dataSource == "2"}'>selected</c:if>>承保系统</option>  
  72.                                         </select></td>  
  73.                                         <td width="14%" align="right" class="general-td">类型:</td>  
  74.                                         <td align="left" class="general-td"><select  
  75.                                             name="type" class="selectCtrl" id="type">  
  76.                                                 <option value="">全部</option>  
  77.                                                 <option value="1-1" <c:if test='${result.blackListDTO.type == "1-1"}'>selected</c:if>>黑名单(电销)</option>  
  78.                                                 <option value="1-2" <c:if test='${result.blackListDTO.type == "1-2"}'>selected</c:if>>黑名单(承保)</option>  
  79.                                                 <option value="2" <c:if test='${result.blackListDTO.type == "2"}'>selected</c:if>>号码屏蔽</option>  
  80.                                         </select></td>  
  81.                                     </tr>  
  82.                                     <tr width="100%">  
  83.                                         <td width="14%" align="right" class="general-td">类型明细:</td>  
  84.                                         <td align="left" class="general-td"><select  
  85.                                             name="typeDetail" class="selectCtrl" id="typeDetail">  
  86.                                                 <option value="">全部</option>  
  87.                                                 <c:forEach var="blackList"  
  88.                                                     items="${result.blackListRemarkList}">  
  89.                                                     <option value='<c:out value="${blackList.paramId}"/>' <c:if test="${result.blackListDTO.typeDetail == blackList.paramId}">selected</c:if>>  
  90.                                                         <c:out value="${blackList.paramValue}" />  
  91.                                                     </option>  
  92.                                                 </c:forEach>  
  93.                                                 <option value="hc" <c:if test='${result.blackListDTO.typeDetail == "hc"}'>selected</c:if>>呼出</option>  
  94.                                                 <option value="dx" <c:if test='${result.blackListDTO.typeDetail == "dx"}'>selected</c:if>>短信</option>  
  95.                                         </select></td>  
  96.                                         <td width="14%" align="right" class="general-td">是否屏蔽:</td>  
  97.                                         <td align="left" class="general-td"><select  
  98.                                             name="isExcluded" class="selectCtrl" id="isExcluded">  
  99.                                                 <option value="">全部</option>  
  100.                                                 <option value="1" <c:if test='${result.blackListDTO.isExcluded == "1"}'>selected</c:if>></option>  
  101.                                                 <option value="0" <c:if test='${result.blackListDTO.isExcluded == "0"}'>selected</c:if>></option>  
  102.                                         </select></td>  
  103.                                     </tr>  
  104.   
  105.   
  106.                                     <tr width="100%">  
  107.                                         <td colspan="4" align="right" class="general-td"><input  
  108.                                             name="efdag3" type="button" class="btn" value="查询"  
  109.                                             onclick="searchCallInControlDataList();"></td>  
  110.                                     </tr>  
  111.                                 </table>  
  112.                             </td>  
  113.                         </tr>  
  114.                     </table>  
  115.   
  116.                     <table width="100%" border="0" cellspacing="0" cellpadding="0">  
  117.                         <tr>  
  118.                             <td> </td>  
  119.                         </tr>  
  120.                     </table>  
  121.                     <table width="100%" border="0" cellpadding="0" cellspacing="0"  
  122.                         bgcolor="#EFEFEF">  
  123.                         <tr>  
  124.                             <td class="SecondTitle">.:查询结果:.</td>  
  125.                         </tr>  
  126.                         <tr>  
  127.                             <td bgcolor="#999999">  
  128.                                 <table name="tableB" border="0" cellspacing="1" cellpadding="1"  
  129.                                     width="100%">  
  130.                                     <tr width="100%">  
  131.   
  132.                                         <td width="10%" align="center" bgcolor="#DFE0E4" class="title-td">  
  133.                                             选择  
  134.                                             <input type="checkbox" name="checkAll" id="checkAll" onclick="gotoCheckAll(this);">  
  135.                                         </td>  
  136.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  137.                                             class="title-td">数据来源</td>  
  138.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  139.                                             class="title-td">类型</td>  
  140.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  141.                                             class="title-td">类型明细</td>  
  142.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  143.                                             class="title-td">是否屏蔽</td>  
  144.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  145.                                             class="title-td">最新操作时间</td>  
  146.   
  147.                                     </tr>  
  148.                                     <c:forEach var="black" items="${result.blackList}">  
  149.                                         <tr width="100%">  
  150.                                             <td style="display:none;"><input type="hidden" name="id" value='<c:out value="${black.id}"/>'></td>  
  151.                                             <td width="7%" align="center" class="general-td"><input  
  152.                                                 type="checkbox" name="toBeEdited"></td>  
  153.                                             <td width="7%" align="center" class="general-td" id="dataSource1"   
  154.                                             style="color:<c:if test='${empty black.isExcluded}'>red;</c:if>">  
  155.                                                 <c:if test="${black.dataSource == 1}">电销系统</c:if>  
  156.                                                 <c:if test="${black.dataSource == 2}">承保系统</c:if>  
  157.                                             </td>  
  158.                                             <td width="6%" align="center" class="general-td" id="type1"  
  159.                                             style="color:<c:if test='${empty black.isExcluded}'>red;</c:if>">  
  160.                                                 <c:if test='${black.type == "1-1" || black.type == "1-2"}'>黑名单</c:if>  
  161.                                                 <c:if test='${black.type == "2"}'>号码屏蔽</c:if>  
  162.                                             </td>  
  163.                                             <td width="9%" align="center" class="general-td" id="tyepDetail1"  
  164.                                             style="color:<c:if test='${empty black.isExcluded}'>red;</c:if>">  
  165.                                                 <c:forEach var="blackList" items="${result.blackListRemarkList}">  
  166.                                                     <c:if test='${blackList.paramId == black.typeDetail}'>  
  167.                                                         <c:out value="${blackList.paramValue}" />  
  168.                                                     </c:if>  
  169.                                                 </c:forEach>  
  170.                                             </td>  
  171.                                             <td align="center" class="general-td">  
  172.                                                 <c:if test="${black.isExcluded == 1}"></c:if>  
  173.                                                 <c:if test="${black.isExcluded == 0}"></c:if>  
  174.                                             </td>  
  175.                                             <td align="center" class="general-td">  
  176.                                                 <c:out value="${black.updatedDate}"/>  
  177.                                             </td>  
  178.   
  179.                                         </tr>  
  180.                                     </c:forEach>  
  181.                                     <tr>  
  182.                                         <td align="right" class="general-td" colspan="9"><input  
  183.                                             name="efdag2" type="button" class="btn" value="修改" onclick="edit();"></td>  
  184.                                     </tr>  
  185.                                     <tr>  
  186.                                         <td class="general-td" colspan="9">  
  187.                                             <table id="table1" align="center" width="500" border="0"  
  188.                                                 cellpadding="0" cellspacing="0">  
  189.                                                 <tr>  
  190.                                                     <td id="td1" align="center" valign="middle"><input  
  191.                                                         type="hidden" name="pageTotal" id="pageTotal1"  
  192.                                                         value='<c:out value="${result.totalPage}" />'> <span> 共 <c:out  
  193.                                                                 value="${result.totalPage}" />  页   
  194.                                                     </span> <input type=button name="prevPage1" value="上一页" id="prevPage1"  
  195.                                                         onClick="gotoPrevPage1()" class="btn2"> <input id="nextPage1"  
  196.                                                         type=button name="nextPage1" value="下一页"  
  197.                                                         onclick="gotoNextPage1();" class="btn2"> <input id="jump1"  
  198.                                                         type=button name="jump1" value="跳至" onclick="gotoJump1()"  
  199.                                                         class="btn2"> <span> 第 <input id="pageNo1"  
  200.                                                             name="pageNo" style="text-align: center"  
  201.                                                             value='<c:out value="${result.pageNo}" />'  
  202.                                                             class="inputbg3">  
  203.                                                     </span> 页</td>  
  204.                                                 </tr>  
  205.   
  206.   
  207.                                             </table>  
  208.                                         </td>  
  209.                                     </tr>  
  210.   
  211.   
  212.   
  213.                                 </table>  
  214.                             </td>  
  215.                         </tr>  
  216.                     </table>  
  217.   
  218.                     <table width="100%" border="0" cellpadding="0" cellspacing="0"  
  219.                         bgcolor="#EFEFEF">  
  220.                         <tr>  
  221.                             <td class="SecondTitle">.:临时数据处理:.</td>  
  222.                         </tr>  
  223.                         <tr>  
  224.                             <td bgcolor="#999999">  
  225.                                 <table name="tableA" border="0" cellspacing="1" cellpadding="1"  
  226.                                     width="100%">  
  227.                                     <tr width="100%">  
  228.                                         <td width="14%" align="center" class="general-td">电话号码:</td>  
  229.                                         <td width="38%" align="left" class="general-td"><input id="phoneNo"  
  230.                                             maxlength="15" name="phoneNo" type="text" class="inputbg">  
  231.                                         </td>  
  232.                                     </tr>  
  233.   
  234.                                     <tr width="100%">  
  235.                                         <td colspan="4" align="right" class="general-td"><input id="query2"  
  236.                                             name="efdag3" type="button" class="btn" value="查询"  
  237.                                             onclick="searchCallInControlDataListByPhoneNo(this);"></td>  
  238.                                     </tr>  
  239.                                 </table>  
  240.                             </td>  
  241.                         </tr>  
  242.                     </table>  
  243.   
  244.                     <table width="100%" border="0" cellpadding="0" cellspacing="0"  
  245.                         bgcolor="#EFEFEF">  
  246.                         <tr>  
  247.                             <td bgcolor="#999999">  
  248.                                 <table name="tableA" border="0" cellspacing="1" cellpadding="1"  
  249.                                     width="100%">  
  250.                                     <tr width="100%" id="insert">  
  251.   
  252.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  253.                                             class="title-td">电话号码</td>  
  254.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  255.                                             class="title-td">数据来源</td>  
  256.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  257.                                             class="title-td">类型</td>  
  258.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  259.                                             class="title-td">类型明细</td>  
  260.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  261.                                             class="title-td">状态</td>  
  262.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  263.                                             class="title-td">创建时间</td>  
  264.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  265.                                             class="title-td">更新时间</td>  
  266.                                         <td width="10%" align="center" bgcolor="#DFE0E4"  
  267.                                             class="title-td">操作</td>  
  268.   
  269.                                     </tr>  
  270.                                     <tr>  
  271.                                         <td class="general-td" colspan="9">  
  272.                                             <table id="table1" align="center" width="500" border="0"  
  273.                                                 cellpadding="0" cellspacing="0">  
  274.                                                 <tr>  
  275.                                                     <td style="display:none;"><input type="hidden" id="hiddenPageNo2"></td>  
  276.                                                     <td id="td1" align="center" valign="middle">  
  277.                                                         共 <span id="pageTotal2">0</span> 页  
  278.                                                      <input type=button name="prevPage2" value="上一页" id="prevPage2"  
  279.                                                         onClick="searchCallInControlDataListByPhoneNo(this)" class="btn2" disabled="disabled"> <input  
  280.                                                         type=button name="nextPage2" value="下一页" id="nextPage2"  
  281.                                                         onClick="searchCallInControlDataListByPhoneNo(this)" class="btn2" disabled="disabled"> <input id="jump2"  
  282.                                                         type=button name="jump2" value="跳至" onclick="searchCallInControlDataListByPhoneNo(this)"  
  283.                                                         class="btn2" disabled="disabled">   
  284.                                                         第    
  285.                                                         <span>  
  286.                                                             <input name="pageNo2" style="text-align: center" value="0" class="inputbg3" id="pageNo2">  
  287.                                                         </span>  
  288.                                                          页  
  289.                                                     </td>  
  290.                                                 </tr>  
  291.                                             </table>  
  292.                                         </td>  
  293.                                     </tr>  
  294.                                 </table>  
  295.                             </td>  
  296.                         </tr>  
  297.                     </table>  
  298.                 </td>  
  299.             </tr>  
  300.         </table>  
  301.     </form>  
  302. </body>  
  303. <script type="text/javascript">  
  304.     var pageNo = $("#pageNo1").val();  
  305.     var dataSource = $("#dataSource").val();  
  306.     var type = $("#type").val();  
  307.     var typeDetail = $("#typeDetail").val();  
  308.     var isExcluded = $("#isExcluded").val();  
  309.     if($("#pageTotal1").val() <= "1")  
  310.     {  
  311.         $("#prevPage1").attr("disabled","disabled");  
  312.         $("#nextPage1").attr("disabled","disabled");  
  313.         $("#jump1").attr("disabled","disabled");  
  314.     }else{  
  315.         if(pageNo == $("#pageTotal1").val())  
  316.         {  
  317.             $("#nextPage1").attr("disabled","disabled");  
  318.         }else if(pageNo == "1"){  
  319.             $("#prevPage1").attr("disabled","disabled");  
  320.         }  
  321.     }  
  322.       
  323.     function gotoPrevPage1()  
  324.     {  
  325.        pageNo = parseInt($("#pageNo1").val());  
  326.        if(pageNo > 1)  
  327.        {         
  328.          pageNo=pageNo-1;  
  329.          window.location.href="<%=request.getContextPath()%>/callInControlData.goto.do?dataSource="  
  330.             +dataSource+"&type="+type+"&typeDetail="+typeDetail+"&isExcluded="+isExcluded+"&pageNo="+pageNo;  
  331.        }   
  332.     }  
  333.       
  334.       
  335.     function gotoNextPage1()  
  336.     {   
  337.          pageNo = parseInt($("#pageNo1").val());  
  338.          if(pageNo < $("#pageTotal1").val())  
  339.          {  
  340.             pageNo = parseInt(pageNo) + 1;  
  341.             window.location.href="<%=request.getContextPath()%>/callInControlData.goto.do?dataSource="  
  342.                 +dataSource+"&type="+type+"&typeDetail="+typeDetail+"&isExcluded="+isExcluded+"&pageNo="+pageNo;  
  343.          }  
  344.     }  
  345.       
  346.       
  347.     function gotoJump1()  
  348.     {  
  349.         var temp = pageNo;  
  350.         pageNo = $("#pageNo1").val();  
  351.         if(isNaN(pageNo) || parseInt(pageNo) > $("#pageTotal1").val() || parseInt(pageNo) < 1)  
  352.         {  
  353.             alert("您输入的页数不存在!");  
  354.             return false;  
  355.         }  
  356.         window.location.href="<%=request.getContextPath()%>/callInControlData.goto.do?dataSource="  
  357.             +dataSource+"&type="+type+"&typeDetail="+typeDetail+"&isExcluded="+isExcluded+"&pageNo="+pageNo;  
  358.     }  
  359.       
  360.     function searchCallInControlDataList()  
  361.     {         
  362.         dataSource = $("#dataSource").val();  
  363.         type = $("#type").val();  
  364.         typeDetail = $("#typeDetail").val();  
  365.         isExcluded = $("#isExcluded").val();  
  366.         window.location.href = "<%=request.getContextPath()%>/callInControlData.goto.do?dataSource="  
  367.             +dataSource+"&type="+type+"&typeDetail="+typeDetail+"&isExcluded="+isExcluded;  
  368.     }  
  369.       
  370.     function edit(){  
  371.         var toBeEdited = $('input[name="toBeEdited"]:checked');  
  372.         if(toBeEdited.length == 0){  
  373.             alert("请至少选择一条记录!");  
  374.             return;  
  375.         }  
  376.         var ids = new Array();  
  377.         for(var i = 0 ; i < toBeEdited.length ; i++){  
  378.             var _ids = toBeEdited.parent().prev().children();  
  379.             ids.push(_ids[i].value);  
  380.         }  
  381.         window.location.href="<%=request.getContextPath()%>/callInControlData.goto.do?flag=edit&ids="+ids;  
  382.     }  
  383.       
  384.     function gotoCheckAll(obj){  
  385.         if(obj.checked){  
  386.             $('input[name="toBeEdited"]').attr("checked","checked");  
  387.         }else{  
  388.             $('input[name="toBeEdited"]').attr("checked","");  
  389.         }  
  390.     }  
  391.       
  392.     function searchCallInControlDataListByPhoneNo(obj){  
  393.         var pageNo;  
  394.         if(obj.id == "query2"){  
  395.             pageNo = "1";   
  396.         }else if(obj.id == "prevPage2"){  
  397.             pageNo = parseInt($("#hiddenPageNo2").val())-1;  
  398.             if(pageNo == 1){  
  399.                 $("#prevPage2").attr("disabled","disabled");  
  400.             }  
  401.         }else if(obj.id == "nextPage2"){  
  402.             pageNo = parseInt($("#hiddenPageNo2").val())+1;  
  403.             if(pageNo == parseInt($("#pageTotal2").html())){  
  404.                 $("#nextPage2").attr("disabled","disabled");  
  405.             }  
  406.         }else if(obj.id == "jump2"){  
  407.             if(isNaN($("#pageNo2").val()) || $("#pageNo2").val() < 1 || $("#pageNo2").val() > $("#pageTotal2").html()){  
  408.                 alert("您输入的页数不存在!");  
  409.                 return;  
  410.             }  
  411.             else{  
  412.                 pageNo = $("#pageNo2").val();  
  413.             }  
  414.         }  
  415.         $.ajax({  
  416.             url:"<%=request.getContextPath()%>/callInControlData.goto.do",  
  417.             data:{flag:"queryByPhone",phoneNo:$("#phoneNo").val(),pageNo:pageNo},  
  418.             dataType:"json",  
  419.             type:"post",  
  420.             success:function(data){  
  421.                 $("#pageTotal2").html(Math.ceil(data[0].pageTotal/10));  
  422.                 if($("#pageTotal2").html() != 0){  
  423.                     $("#pageNo2").val(pageNo);  
  424.                     $("#hiddenPageNo2").val(pageNo);  
  425.                     if($("#pageTotal2").html() > 1){  
  426.                         if(pageNo != 1){  
  427.                             $("#prevPage2").attr("disabled","");  
  428.                             if(pageNo != $("#pageTotal2").html()){  
  429.                                 $("#nextPage2").attr("disabled","");  
  430.                             }  
  431.                         }else{  
  432.                             $("#nextPage2").attr("disabled","");  
  433.                             $("#jump2").attr("disabled","");  
  434.                         }  
  435.                     }  
  436.                 }  
  437.                 var dataSource = "";  
  438.                 var type = "";  
  439.                 var typeDetail = "";  
  440.                 var validFlag = "";  
  441.                 $('tr[name="dataInserted"]').remove();  
  442.                 for(var i = 0 ; i < data[0].blackList.length ; i++){  
  443.                     if(data[0].blackList[i].dataSource == "1"){  
  444.                         dataSource = "电销系统";  
  445.                     }else if(data[0].blackList[i].dataSource == "2"){  
  446.                         dataSource = "承保系统";  
  447.                     }  
  448.                     if(data[0].blackList[i].type == "1-1" || data[0].blackList[i].type == "1-2"){  
  449.                         type = "黑名单";  
  450.                     }else if(data[0].blackList[i].type == "2"){  
  451.                         type = "号码屏蔽";  
  452.                     }  
  453.                     if(data[0].blackList[i].validFlag == "1"){  
  454.                         validFlag = "有效";  
  455.                     }else if(data[0].blackList[i].validFlag == "0"){  
  456.                         validFlag = "无效";  
  457.                     }  
  458.                     for(var j = 0 ;j < data[0].blackListRemarkList.length ; j++){  
  459.                         if(data[0].blackList[i].typeDetail == data[0].blackListRemarkList[j].paramId){  
  460.                             typeDetail = data[0].blackListRemarkList[j].paramValue;  
  461.                             break;  
  462.                         }  
  463.                     }  
  464.                     $('<tr width="100%" name="dataInserted">'+  
  465.                         '<td align="center" class="general-td">'+data[0].blackList[i].phoneNo+'</td>'+  
  466.                         '<td align="center" class="general-td">'+dataSource+'</td>'+  
  467.                         '<td align="center" class="general-td">'+type+'</td>'+  
  468.                         '<td align="center" class="general-td">'+typeDetail+'</td>'+  
  469.                         '<td align="center" class="general-td">'+validFlag+'</td>'+  
  470.                         '<td align="center" class="general-td">'+data[0].blackList[i].createdDate+'</td>'+  
  471.                         '<td align="center" class="general-td">'+data[0].blackList[i].updatedDate+'</td>'+  
  472.                         '<td align="center" class="general-td"><input type="button" value="解锁呼入" class="btn"></td>'+  
  473.                     '</tr>').insertAfter($("#insert"));  
  474.                 }  
  475.             },  
  476.             error:function(data){  
  477.                 alert("系统异常,请联系管理员!");  
  478.             }  
  479.         });  
  480.     }  
  481. </script>  

后台java:

[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. package com.tpaic.callCenter.web.controller.comeInControlData;  
  2.   
  3. import java.util.ArrayList;  
  4. import java.util.HashMap;  
  5. import java.util.List;  
  6. import java.util.Map;  
  7.   
  8. import javax.servlet.http.HttpServletRequest;  
  9. import javax.servlet.http.HttpServletResponse;  
  10.   
  11. import net.sf.json.JSONArray;  
  12.   
  13. import org.apache.java.lang.Bytes;  
  14. import org.springframework.web.servlet.ModelAndView;  
  15.   
  16. import com.tpaic.callCenter.biz.util.SqlNamesUtil;  
  17. import com.tpaic.callCenter.dto.CodeTableDTO;  
  18. import com.tpaic.callCenter.dto.blackList.BlackListDTO;  
  19. import com.tpaic.callCenter.util.StringUtil;  
  20. import com.tpaic.callCenter.web.controller.common.AbstractCommonController;  
  21. import com.tpaic.callCenter.web.util.CommonUtils;  
  22. import com.tpaic.callCenter.web.util.ServiceRequestId;  
  23.   
  24.   
  25.   
  26. /** 
  27.  * @author ex_zhangkenan 
  28.  * 呼入控制数据设置 
  29.  */  
  30.   
  31. public class CallInControlDataGotoController extends AbstractCommonController{  
  32.     private String editView;  
  33.       
  34.     public String getEditView() {  
  35.         return editView;  
  36.     }  
  37.   
  38.     public void setEditView(String editView) {  
  39.         this.editView = editView;  
  40.     }  
  41.   
  42.     protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {  
  43.           
  44.           
  45.         Map<String,Object> resultMap = new HashMap<String,Object>();  
  46.         String flag = request.getParameter("flag");  
  47.         if(flag == null){  
  48.             //查询电销系统黑名单原因列表  
  49.             @SuppressWarnings("unchecked")  
  50.             List<Object> blackListRemarkList = (List<Object>) this.getDispatch().dispatchRequest(  
  51.                     CommonUtils.getAggregatedSearchDTO(  
  52.                             SqlNamesUtil.CODETABLE_SEARCH_CODETYPE, "blackListRemark"),  
  53.                             ServiceRequestId.AGGREGATED_SEARCH_ACTION);  
  54.             resultMap.put("blackListRemarkList", blackListRemarkList);  
  55.               
  56.             //查询电销系统blacklist表  
  57.             String pageNo = request.getParameter("pageNo");  
  58.             String dataSource = request.getParameter("dataSource");  
  59.             String type = request.getParameter("type");  
  60.             String typeDetail = request.getParameter("typeDetail");  
  61.             String isExcluded = request.getParameter("isExcluded");  
  62.             BlackListDTO blackListDTO = new BlackListDTO();  
  63.             if(StringUtil.isEmpty(pageNo)){  
  64.                 blackListDTO.setPageNo(1);  
  65.             }else{  
  66.                 blackListDTO.setPageNo(Integer.parseInt(pageNo));  
  67.             }  
  68.             blackListDTO.setDataSource(dataSource);  
  69.             blackListDTO.setType(type);  
  70.             blackListDTO.setTypeDetail(typeDetail);  
  71.             blackListDTO.setIsExcluded(isExcluded);  
  72.             String totalPage = (String) this.getDispatch().dispatchRequest(CommonUtils.getAggregatedSearchDTO(  
  73.                     SqlNamesUtil.Search_Blacklist_For_Total_Page, blackListDTO,false),  
  74.                     ServiceRequestId.AGGREGATED_SEARCH_ACTION);  
  75.             @SuppressWarnings("unchecked")  
  76.             List<BlackListDTO> blackList = (List<BlackListDTO>) this.getDispatch().dispatchRequest(CommonUtils.getAggregatedSearchDTO(  
  77.                     SqlNamesUtil.Search_Blacklist_For_List, blackListDTO),  
  78.                     ServiceRequestId.AGGREGATED_SEARCH_ACTION);  
  79.               
  80.             resultMap.put("pageNo", blackListDTO.getPageNo());  
  81.             resultMap.put("totalPage", totalPage);  
  82.             resultMap.put("blackList", blackList);  
  83.             resultMap.put("blackListDTO", blackListDTO);  
  84.             return new ModelAndView(this.getSuccessView(), "result", resultMap);  
  85.         }else if(flag.equals("edit")){  
  86.             String ids = request.getParameter("ids");  
  87.             @SuppressWarnings({ "unchecked" })  
  88.             List<BlackListDTO> blackList = (List<BlackListDTO>) this.getDispatch().dispatchRequest(CommonUtils.getAggregatedSearchDTO(  
  89.                     SqlNamesUtil.Search_Blacklist_For_List_By_Ids, ids),  
  90.                     ServiceRequestId.AGGREGATED_SEARCH_ACTION);  
  91.             resultMap.put("blackList", blackList);  
  92.             @SuppressWarnings("unchecked")  
  93.             List<CodeTableDTO> blackListRemarkList = (List<CodeTableDTO>) this.getDispatch().dispatchRequest(  
  94.                     CommonUtils.getAggregatedSearchDTO(  
  95.                             SqlNamesUtil.CODETABLE_SEARCH_CODETYPE, "blackListRemark"),  
  96.                             ServiceRequestId.AGGREGATED_SEARCH_ACTION);  
  97.             resultMap.put("blackListRemarkList", blackListRemarkList);  
  98.             return new ModelAndView(this.getEditView(), "result", resultMap);  
  99.         }else if(flag.equals("save")){  
  100.             String ids = request.getParameter("ids");  
  101.             String isOrNotExcluded = request.getParameter("isOrNotExcluded");  
  102.             List<BlackListDTO> blackListDTO = new ArrayList<BlackListDTO>();  
  103.             for(int i = 0 ; i < ids.split(",").length ; i++){  
  104.                 BlackListDTO dto = new BlackListDTO();  
  105.                 dto.setId(ids.split(",")[i]);  
  106.                 dto.setIsExcluded(isOrNotExcluded.split(",")[i]);  
  107.                 blackListDTO.add(dto);  
  108.             }  
  109.             String data = "1";  
  110.             Map<String,Object> map = new HashMap<String, Object>();  
  111.             map.put("blackListDTO", blackListDTO);  
  112.             try{  
  113.                 this.getDispatch().dispatchRequest(map, ServiceRequestId.UPDATE_BLACK_LIST_FOR_ISEXCLUDED_ACTION);  
  114.             }catch(Exception e){  
  115.                 data = "0";  
  116.             }  
  117.             response.getWriter().write(data);  
  118.             return null;  
  119.         }else if(flag.equals("queryByPhone")){  
  120.             String phoneNo = request.getParameter("phoneNo");  
  121.             String pageNo = request.getParameter("pageNo");  
  122.             BlackListDTO dto = new BlackListDTO();  
  123.             dto.setPhoneNo(phoneNo);  
  124.             dto.setPageNo(Integer.parseInt(pageNo));  
  125.             @SuppressWarnings("unchecked")  
  126.             List<BlackListDTO> blackList = (List<BlackListDTO>) this.getDispatch().dispatchRequest(CommonUtils.getAggregatedSearchDTO(  
  127.                     SqlNamesUtil.Search_Blacklist_For_List_By_Phone, dto),  
  128.                     ServiceRequestId.AGGREGATED_SEARCH_ACTION);  
  129.             String pageTotal = (String) this.getDispatch().dispatchRequest(CommonUtils.getAggregatedSearchDTO(  
  130.                     SqlNamesUtil.Search_Blacklist_By_Phone_For_Num, phoneNo,false),  
  131.                     ServiceRequestId.AGGREGATED_SEARCH_ACTION);  
  132.             @SuppressWarnings("unchecked")  
  133.             List<CodeTableDTO> blackListRemarkList = (List<CodeTableDTO>) this.getDispatch().dispatchRequest(  
  134.                     CommonUtils.getAggregatedSearchDTO(  
  135.                             SqlNamesUtil.CODETABLE_SEARCH_CODETYPE, "blackListRemark"),  
  136.                             ServiceRequestId.AGGREGATED_SEARCH_ACTION);  
  137.             Map<String,Object> map = new HashMap<String, Object>();  
  138.             map.put("blackList", blackList);  
  139.             map.put("blackListRemarkList", blackListRemarkList);  
  140.             map.put("pageTotal", pageTotal);  
  141.             JSONArray jsonArray = JSONArray.fromObject(map);  
  142.             response.setCharacterEncoding("UTF-8");  
  143.             response.getWriter().write(jsonArray.toString());  
  144.             return null;  
  145.         }  
  146.         return new ModelAndView(this.getSuccessView(), "result", resultMap);  
  147.     }  
  148.   
  149. }  
效果:

0 0
原创粉丝点击