add.jsp 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <!doctype html>
  3. <html>
  4. <head>
  5. <%@ include file="../../common/head.jsp"%>
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  8. </head>
  9. <body>
  10. <div class="wrapper wrapper-content">
  11. <div class="row">
  12. <div class="col-sm-12">
  13. <cs:form_validate formId="addRoleForm"/>
  14. <form class="form-horizontal" action="add.cs" id="addRoleForm" method="POST">
  15. <div class="form-group">
  16. <label class="col-sm-3 control-label">代码:</label>
  17. <div class="col-sm-6">
  18. <input id="code" name="code" class="form-control" validate="{required:true}" validateMessage="{required:'请输入code,不能重复'}" >
  19. </div>
  20. </div>
  21. <div class="form-group">
  22. <label class="col-sm-3 control-label">上级分类:</label>
  23. <div class="col-sm-6">
  24. <select class="form-control m-b" id="oneCategoryId" name="oneCategoryId" onchange="menuChange(this)" validate="{required:true}" validateMessage="{required:'请输入code,不能重复'}">
  25. <option value="">请选择</option>
  26. <c:forEach items="${firstCategory }" var="superMenu">
  27. <option value="${superMenu.id }" >${superMenu.gcName}</option>
  28. </c:forEach>
  29. </select>
  30. </div>
  31. </div>
  32. <script type="text/javascript">
  33. function menuChange(obj){
  34. var ss = $(obj).children('option:selected').val();
  35. $("#tlb").css("display","none");
  36. $("#thlb").css("display","none");
  37. $("#folb").css("display","none");
  38. $("#twoCategoryId").empty();
  39. $("#threeCategoryId").empty();
  40. $("#fourCategoryId").empty();
  41. $.ajax({
  42. type: "get",
  43. url: "<%=basePath%>mgmProductCategoryCtl/nextCategory.cs",
  44. data: {id:ss},
  45. dataType: "json",
  46. success: function(data){
  47. if(data.mlist.length > 0){
  48. $("#tlb").css("display","block");
  49. $("#twoCategoryId").empty();
  50. $("#twoCategoryId").append("<option value='0'>请选择</option>");
  51. data.mlist.forEach(function(val,index,arr){
  52. $("#twoCategoryId").append("<option value='"+val.id+"'>"+ val.gcName+"</option>");
  53. });
  54. }
  55. }
  56. });
  57. }
  58. function twoMenuChange(obj){
  59. var ss = $(obj).children('option:selected').val();
  60. $("#thlb").css("display","none");
  61. $("#folb").css("display","none");
  62. $("#threeCategoryId").empty();
  63. $("#fourCategoryId").empty();
  64. $.ajax({
  65. type: "get",
  66. url: "<%=basePath%>mgmProductCategoryCtl/nextCategory.cs",
  67. data: {id:ss},
  68. dataType: "json",
  69. success: function(data){
  70. if(data.mlist.length > 0){
  71. $("#thlb").css("display","block");
  72. $("#threeCategoryId").empty();
  73. $("#threeCategoryId").append("<option value='0'>请选择</option>");
  74. data.mlist.forEach(function(val,index,arr){
  75. $("#threeCategoryId").append("<option value='"+val.id+"'>"+ val.gcName+"</option>");
  76. });
  77. }
  78. }
  79. });
  80. }
  81. function threeMenuChange(obj){
  82. var ss = $(obj).children('option:selected').val();
  83. $("#folb").css("display","none");
  84. $("#fourCategoryId").empty();
  85. $.ajax({
  86. type: "get",
  87. url: "<%=basePath%>mgmProductCategoryCtl/nextCategory.cs",
  88. data: {id:ss},
  89. dataType: "json",
  90. success: function(data){
  91. if(data.mlist.length > 0){
  92. $("#folb").css("display","block");
  93. $("#fourCategoryId").empty();
  94. $("#fourCategoryId").append("<option value='0'>请选择</option>");
  95. data.mlist.forEach(function(val,index,arr){
  96. $("#fourCategoryId").append("<option value='"+val.id+"'>"+ val.gcName+"</option>");
  97. });
  98. }
  99. }
  100. });
  101. }
  102. </script>
  103. <div id="tlb" class="form-group" style="display:none;">
  104. <label class="col-sm-3 control-label">二级分类:</label>
  105. <div class="col-sm-6">
  106. <select class="form-control m-b" id="twoCategoryId" name="twoCategoryId" onchange="twoMenuChange(this)">
  107. <option value="0">请选择</option>
  108. </select>
  109. </div>
  110. </div>
  111. <div id="thlb" class="form-group" style="display:none;">
  112. <label class="col-sm-3 control-label">三级分类:</label>
  113. <div class="col-sm-6">
  114. <select class="form-control m-b" id="threeCategoryId" name="threeCategoryId" onchange="threeMenuChange(this)">
  115. <option value="0">请选择</option>
  116. </select>
  117. </div>
  118. </div>
  119. <div id="folb" class="form-group" style="display:none;">
  120. <label class="col-sm-3 control-label">四级分类:</label>
  121. <div class="col-sm-6">
  122. <select class="form-control m-b" id="fourCategoryId" name="fourCategoryId" >
  123. <option value="0">请选择</option>
  124. </select>
  125. </div>
  126. </div>
  127. <div class="form-group">
  128. <label class="col-sm-3 control-label">名称:</label>
  129. <div class="col-sm-6">
  130. <input id="name" name="name" class="form-control" validate="{required:true}" validateMessage="{required:'请输入名称'}" >
  131. </div>
  132. </div>
  133. <div class="form-group">
  134. <label class="col-sm-3 control-label">描述:</label>
  135. <div class="col-sm-6">
  136. <input id="note" name="note" class="form-control" >
  137. </div>
  138. </div>
  139. <div class="form-group">
  140. <div class="col-sm-4 col-sm-offset-3 pull-left">
  141. <button class="btn btn-default btn-dlg-close">取消</button>
  142. <button class="btn btn-primary" type="submit">提交</button>
  143. </div>
  144. </div>
  145. </form>
  146. </div>
  147. </div>
  148. </div>
  149. </body>
  150. </html>