edit.jsp 10 KB

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