product_service_list.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:8k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8"%>
  2. <%@ page import = "java.util.*"%>
  3. <%@ page import = "cn.js.fan.db.*"%>
  4. <%@ page import = "cn.js.fan.web.*"%>
  5. <%@ page import = "cn.js.fan.util.*"%>
  6. <%@ page import = "com.redmoon.oa.visual.*"%>
  7. <%@ page import = "com.redmoon.oa.flow.FormDb"%>
  8. <%@ page import = "com.redmoon.oa.flow.FormField"%>
  9. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  10. <%
  11. String priv = "sales.product";
  12. if (!privilege.isUserPrivValid(request, priv))
  13. {
  14. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  15. return;
  16. }
  17. String op = ParamUtil.get(request, "op");
  18. String formCode = "sales_product_service";
  19. String querystr = "";
  20. FormDb fd = new FormDb();
  21. fd = fd.getFormDb(formCode);
  22. %>
  23. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  24. <html>
  25. <head>
  26. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  27. <title><%=fd.getName()%>列表</title>
  28. <link href="../common.css" rel="stylesheet" type="text/css">
  29. <%@ include file="../inc/nocache.jsp"%>
  30. <script src="<%=Global.getRootPath()%>/inc/flow_dispose_js.jsp"></script>
  31. <script src="<%=Global.getRootPath()%>/inc/flow_js.jsp"></script>
  32. </head>
  33. <body background="" leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
  34. <%@ include file="product_service_inc_menu_top.jsp"%>
  35. <%
  36. String sql = "select id from " + fd.getTableNameByForm();
  37. String query = ParamUtil.get(request, "query");
  38. if (!query.equals(""))
  39. sql = query;
  40. else
  41. if (op.equals("search")) {
  42. Iterator ir = fd.getFields().iterator();
  43. String cond = "";
  44. while (ir.hasNext()) {
  45. FormField ff = (FormField)ir.next();
  46. String value = ParamUtil.get(request, ff.getName());
  47. String name_cond = ParamUtil.get(request, ff.getName() + "_cond");
  48. if (ff.getType().equals(ff.TYPE_DATE) || ff.getType().equals(ff.TYPE_DATE_TIME)) {
  49. String fDate = ParamUtil.get(request, ff.getName() + "FromDate");
  50. String tDate = ParamUtil.get(request, ff.getName() + "ToDate");
  51. if (!fDate.equals("")) {
  52. if (cond.equals(""))
  53. cond += ff.getName() + ">=" + StrUtil.sqlstr(fDate);
  54. else
  55. cond += " and " + ff.getName() + ">=" + StrUtil.sqlstr(fDate);
  56. }
  57. if (!tDate.equals("")) {
  58. if (cond.equals(""))
  59. cond += ff.getName() + "<=" + StrUtil.sqlstr(tDate);
  60. else
  61. cond += " and " + ff.getName() + "<=" + StrUtil.sqlstr(tDate);
  62. }
  63. }
  64. else {
  65. if (name_cond.equals("0")) {
  66. if (!value.equals("")) {
  67. if (cond.equals(""))
  68. cond += ff.getName() + " like " + StrUtil.sqlstr("%" + value + "%");
  69. else
  70. cond += " and " + ff.getName() + " like " + StrUtil.sqlstr("%" + value + "%");
  71. }
  72. }
  73. else if (name_cond.equals("1")) {
  74. if (!value.equals("")) {
  75. if (cond.equals(""))
  76. cond += ff.getName() + "=" + StrUtil.sqlstr(value);
  77. else
  78. cond += " and " + ff.getName() + "=" + StrUtil.sqlstr(value);
  79. }
  80. }
  81. }
  82. }
  83. if (!cond.equals(""))
  84. sql = sql + " where " + cond;
  85. }
  86. querystr = "query=" + StrUtil.UrlEncode(sql);
  87. %>
  88. <table width="58%" border="0" align="center" cellSpacing="1" class="tableframe">
  89.   <form id="form2" name="form2" action="?op=search" method="post">
  90.     <tbody>
  91.       <tr>
  92.         <td noWrap colSpan="3">
  93.           <table cellSpacing="0" cellPadding="0" width="100%" border="0">
  94.             <tbody>
  95.               <tr>
  96.                 <td colSpan="3" bgcolor="#C4DAFF"><b>服务型产品查询</b></td>
  97.               </tr>
  98.               <tr>
  99.                 <td width="29%">服务提供商:</td>
  100.                 <td noWrap width="19%"><select name="provider_cond">
  101.                   <option value="1">等于</option>
  102.                   <option value="0" selected>包含</option>
  103.                 </select></td>
  104.                 <td width="52%"><input name="provider" size="20"></td>
  105.               </tr>
  106.               <tr>
  107.                 <td width="29%">服务名称:</td>
  108.                 <td noWrap width="19%"><select name="service_name_cond">
  109.                     <option value="1">等于</option>
  110.                     <option value="0" selected>包含</option>
  111.                   </select></td>
  112.                 <td width="52%"><input name="service_name" size="20"></td>
  113.               </tr>
  114.               <tr>
  115.                 <td width="29%">服务收费标准:</td>
  116.                 <td noWrap width="19%"><select name="standad_name_cond">
  117.                     <option value="1">等于</option>
  118.                     <option value="0" selected>包含</option>
  119.                   </select></td>
  120.                 <td width="52%"><input name="standad_name" size="20"></td>
  121.               </tr>
  122.             </tbody>
  123.           </table>
  124.         </td>
  125.       </tr>
  126.       <tr align="middle">
  127.         <td noWrap align="middle" colSpan="3" height="35"><input class="BigButton"  type="submit" value="查  询" name="submit"> 
  128.           &nbsp;&nbsp;&nbsp;&nbsp;</td>
  129.       </tr>
  130.     </tbody>
  131.   </form>
  132. </table>
  133. <br>
  134. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0" class="main">
  135.   <tr> 
  136.     <td height="23" valign="middle" class="right-title">&nbsp;<%=fd.getName()%></td>
  137.   </tr>
  138.   <tr> 
  139.     <td valign="top" background="workplan/images/tab-b-back.gif">
  140. <%
  141. int pagesize = 10;
  142. Paginator paginator = new Paginator(request);
  143. int curpage = paginator.getCurPage();
  144. FormDAO fdao = new FormDAO();
  145. ListResult lr = fdao.listResult(formCode, sql, curpage, pagesize);
  146. int total = lr.getTotal();
  147. Vector v = lr.getResult();
  148.     Iterator ir = null;
  149. if (v!=null)
  150. ir = v.iterator();
  151. paginator.init(total, pagesize);
  152. // 设置当前页数和总页数
  153. int totalpages = paginator.getTotalPages();
  154. if (totalpages==0)
  155. {
  156. curpage = 1;
  157. totalpages = 1;
  158. }
  159. %>
  160. <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  161.         <tr> 
  162.           <td width="47">&nbsp;</td>
  163.           <td align="right" backgroun="images/title1-back.gif">找到符合条件的记录 <b><%=paginator.getTotal() %></b> 条 每页显示 <b><%=paginator.getPageSize() %></b> 条 页次 <b><%=curpage %>/<%=totalpages %></td>
  164.         </tr>
  165.       </table> 
  166.       <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1">
  167.         <tr align="center" bgcolor="#C4DAFF"> 
  168.           <td width="26%" bgcolor="#C4DAFF">服务产品名称</td>
  169.           <td width="20%" bgcolor="#C4DAFF">收费标准</td>
  170.           <td width="17%" bgcolor="#C4DAFF">操作</td>
  171.         </tr>
  172.       <%
  173.    int i = 0;
  174. while (ir!=null && ir.hasNext()) {
  175. fdao = (FormDAO)ir.next();
  176. i++;
  177. int id = fdao.getId();
  178. %>
  179.         <tr align="center" bgcolor="#EEEEEE"> 
  180.           <td width="26%" bgcolor="#EEEEEE"> <a href="product_service_show.jsp?id=<%=id%>&formCode=<%=formCode%>"><%=fdao.getFieldValue("service_name")%></a></td>
  181.           <td width="20%" bgcolor="#EEEEEE"><%=fdao.getFieldValue("standad_name")%></td>
  182.           <td width="17%" bgcolor="#EEEEEE"><a href="product_service_edit.jsp?id=<%=id%>&formCode=<%=StrUtil.UrlEncode(formCode)%>">编辑</a>&nbsp;&nbsp;<a href="../visual_del.jsp?id=<%=id%>&formCode=<%=formCode%>&privurl=<%=StrUtil.getUrl(request)%>">删除</a>&nbsp;&nbsp;   </td>
  183.         </tr>
  184.       <%
  185. }
  186. %>
  187.       </table>
  188.       <br>
  189.       <table width="98%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  190.         <tr> 
  191.           <td width="1%" height="23">&nbsp;</td>
  192.           <td height="23" valign="baseline"> 
  193.             <div align="right"> 
  194.             <%
  195. out.print(paginator.getCurPageBlock("?"+querystr));
  196. %>
  197.               &nbsp;</div></td>
  198.         </tr>
  199.       </table>
  200.     </td>
  201.   </tr>
  202.   <tr> 
  203.     <td height="9">&nbsp;</td>
  204.   </tr>
  205. </table>
  206. </body>
  207. </html>