cmServiceteamRoleForm.jsp 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
  3. <html>
  4. <head>
  5. <title>协销小组管理</title>
  6. <meta name="decorator" content="default"/>
  7. <script type="text/javascript">
  8. $(document).ready(function () {
  9. //$("#name").focus();
  10. $("#inputForm").validate({
  11. submitHandler: function (form) {
  12. var ids=document.getElementsByName("ids");
  13. var checks;
  14. for (let i = 0; i < ids.length; i++) {
  15. if(ids[i].checked){
  16. checks=ids[i];
  17. break;
  18. }
  19. }
  20. if(null==checks){
  21. alertx("请选择组员!");
  22. return false;
  23. }
  24. var cc=$("#findgroup").val();
  25. // console.log("选中的values---------------------------"+cc);
  26. debugger;
  27. if (null == cc || cc < 1) {
  28. alertx("请选择小组管理员!");
  29. return false;
  30. }
  31. loading('正在提交,请稍等...');
  32. form.submit();
  33. },
  34. errorContainer: "#messageBox",
  35. errorPlacement: function (error, element) {
  36. $("#messageBox").text("输入有误,请先更正。");
  37. if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
  38. error.appendTo(element.parent().parent());
  39. } else {
  40. error.insertAfter(element);
  41. }
  42. }
  43. });
  44. });
  45. function getMember() {
  46. var m = document.getElementsByName("ids");
  47. var opts = "<option value=''>" +"请选择组长" + "</option>";
  48. var count = 0;
  49. for (let i = 0; i < m.length; i++) {
  50. if (count >= 10) {
  51. var n = document.getElementsByName("ids");
  52. for (let i = 0; i < n.length; i++) {
  53. if (!n[i].checked) {
  54. var p = n[i].className;
  55. $('.' + p).hide();
  56. }
  57. }
  58. } else {
  59. var n = document.getElementsByName("ids");
  60. for (let i = 0; i < n.length; i++) {
  61. if (!n[i].checked) {
  62. var p = n[i].className;
  63. $('.' + p).show();
  64. }
  65. }
  66. }
  67. if (m[i].checked && count < 10) {
  68. opts += "<option value='" + m[i].value + "'>" + m[i].id + "</option>";
  69. count++;
  70. }
  71. }
  72. if (count >= 10) {
  73. alert("最多选择十个组员!");
  74. }
  75. $("#findgroup").html('').append(opts);
  76. }
  77. </script>
  78. </head>
  79. <body>
  80. <ul class="nav nav-tabs">
  81. <li><a href="${ctx}/new/user/cmSp/cmSpList/">协销人员列表</a></li>
  82. <shiro:hasPermission name="user:newCmClub:edit">
  83. <li><a href="${ctx}/new/user/cmSp/cmSpForm">添加协销人员</a></li>
  84. </shiro:hasPermission>
  85. <li><a href="${ctx}/serviceteam/cmServiceteamRole/">协销小组</a></li>
  86. <li><a href="${ctx}/new/user/cmSp/leader/">协销总管理员</a></li>
  87. <li class="active"><a
  88. href="${ctx}/serviceteam/cmServiceteamRole/form?teamId=${cmServiceteamRole.teamId}">协销小组${not empty cmServiceteamRole.teamId?'编辑':'添加'}</a>
  89. </li>
  90. </ul>
  91. <br/>
  92. <form:form id="inputForm" modelAttribute="cmServiceteamRole" action="${ctx}/serviceteam/cmServiceteamRole/save"
  93. method="post" class="form-horizontal">
  94. <form:hidden path="id"/>
  95. <form:hidden path="teamId"/>
  96. <sys:message content="${message}"/>
  97. <div class="control-group">
  98. <div class="controls">
  99. <c:if test="${not empty cmServiceteamRole.teamId}">
  100. <span style="color:red;">本页面包含本组组员和所有未分组协销账号,上限选择十个,如已选十个则不可选更多组员,取消已选项可复选至十个</span>
  101. <br/>
  102. <br/>
  103. </c:if>
  104. <c:if test="${empty cmServiceteamRole.teamId}">
  105. <span style="color:red;">本页面包含所有未分组协销账号,上限选择十个,如已选十个则不可选更多组员,取消已选项可复选至十个</span>
  106. <br/>
  107. <br/>
  108. </c:if>
  109. </div>
  110. <label class="control-label"><font color="red">*</font>组员:</label>
  111. <div class="controls">
  112. <c:forEach items="${cmServiceteamRole.group}" var="group" varStatus="status">
  113. <c:if test="${not empty group.teamFlag}">
  114. <input class="N${group.serviceProviderID}" type="checkbox" name="ids" id="${group.name}"
  115. value="${group.serviceProviderID}" style="zoom: 150%" checked
  116. onclick="getMember()">
  117. <span style="font-size: 15px;" id="${group.serviceProviderID}">${group.name}&nbsp;&nbsp;</span>
  118. </c:if>
  119. <c:if test="${empty group.teamFlag}">
  120. <c:if test="${empty cmServiceteamRole.fullFlag}">
  121. <input class="N${group.serviceProviderID}" type="checkbox" name="ids" id="${group.name}"
  122. value="${group.serviceProviderID}" style="zoom: 150%"
  123. onclick="getMember()">
  124. <span style="font-size: 15px;" id="${group.serviceProviderID}">${group.name}&nbsp;&nbsp;</span>
  125. </c:if>
  126. <c:if test="${not empty cmServiceteamRole.fullFlag}">
  127. <input class="N${group.serviceProviderID}" type="checkbox" name="ids" id="${group.name}"
  128. value="${group.serviceProviderID}" style="zoom: 150%;display: none"
  129. onclick="getMember()">
  130. <span style="font-size: 15px;" id="${group.serviceProviderID}">${group.name}&nbsp;&nbsp;</span>
  131. </c:if>
  132. </c:if>
  133. <c:if test="${status.count%10 eq 0}">
  134. <hr/>
  135. </c:if>
  136. </c:forEach>
  137. </div>
  138. <br/>
  139. <br/>
  140. <label class="control-label"><font color="red">*</font>小组管理员:</label>
  141. <div class="controls">
  142. <c:if test="${not empty cmServiceteamRole.teamId}">
  143. <form:select path="leaderId" class="input-medium" id="findgroup">
  144. <form:option value="" label="请在组员中选择"/>
  145. <form:option value="${cmServiceteamRole.leaderId}" label="${cmServiceteamRole.leaderName}"/>
  146. <c:forEach items="${cmServiceteamRole.group}" var="group">
  147. <c:if test="${group.serviceProviderID ne cmServiceteamRole.leaderId && not empty group.teamFlag}">
  148. <form:option value="${group.serviceProviderID}" label="${group.name}"/>
  149. </c:if>
  150. </c:forEach>
  151. </form:select>
  152. </c:if>
  153. <c:if test="${empty cmServiceteamRole.teamId}">
  154. <form:select path="leaderId" class="input-medium" id="findgroup">
  155. <form:option value="" label="请在组员中选择"/>
  156. </form:select>
  157. </c:if>
  158. </div>
  159. </div>
  160. <div class="form-actions">
  161. <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp
  162. <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
  163. </div>
  164. </form:form>
  165. </body>
  166. </html>