userJoinSelect.jsp 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: huang
  4. Date: 2020/2/18
  5. Time: 16:02
  6. To change this template use File | Settings | File Templates.
  7. --%>
  8. <%@ page contentType="text/html;charset=UTF-8" %>
  9. <%@ include file="/webpage/include/taglib.jsp"%>
  10. <html>
  11. <head>
  12. <title>用户选择</title>
  13. <meta name="decorator" content="ani"/>
  14. <%@ include file="/webpage/include/bootstraptable.jsp"%>
  15. <%@include file="/webpage/include/treeview.jsp" %>
  16. <script type="text/javascript">
  17. $(document).ready(function() {
  18. var isParty = ${isParty}
  19. var url = isParty ? "${ctx}/leader/info/leaderInfo/data" : "${ctx}/leader/cadre/leaderCadre/data?duties=4"
  20. //bootstrap treeview初始化
  21. $('#jstree').jstree({
  22. 'core' : {
  23. "multiple" : false,
  24. "animation" : 0,
  25. "themes" : { "variant" : "large", "icons":true , "stripes":true},
  26. 'data' : {
  27. "url" : "${ctx}/leader/org/leaderOrgNo/treeData",
  28. "dataType" : "json" // needed only if you do not supply JSON headers
  29. }
  30. },
  31. "conditionalselect" : function (node, event) {
  32. return false;
  33. },
  34. 'plugins' : ['types', 'wholerow'],
  35. "types":{
  36. 'default' : { 'icon' : 'fa fa-folder' },
  37. '1' : {'icon' : 'fa fa-home'},
  38. '2' : {'icon' : 'fa fa-umbrella' },
  39. '3' : { 'icon' : 'fa fa-group'},
  40. '4' : { 'icon' : 'fa fa-file-text-o' }
  41. }
  42. }).bind("activate_node.jstree", function (obj, e) {
  43. // 处理代码
  44. // 获取当前节点
  45. var treeNode = e.node;
  46. var id = treeNode.id == '0' ? '' :treeNode.id;
  47. if(isParty){//level=0 代表公司
  48. $("#lead").val(id);
  49. }else{
  50. $("#villageId").val(id);
  51. }
  52. $('#table').bootstrapTable('refresh');
  53. }).on('loaded.jstree', function() {
  54. //$("#jstree").jstree('open_all');
  55. });
  56. //初始化表格
  57. $('#table').bootstrapTable({
  58. //请求方法
  59. method: 'post',
  60. //类型json
  61. dataType: "json",
  62. contentType: "application/x-www-form-urlencoded",
  63. //是否显示行间隔色
  64. striped: true,
  65. //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  66. cache: false,
  67. //是否显示分页(*)
  68. pagination: true,
  69. //排序方式
  70. sortOrder: "asc",
  71. //初始化加载第一页,默认第一页
  72. pageNumber:1,
  73. //每页的记录行数(*)
  74. pageSize: 5,
  75. //可供选择的每页的行数(*)
  76. pageList: [5, 10, 'ALL'],
  77. //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
  78. url: url,
  79. //默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
  80. //queryParamsType:'',
  81. ////查询参数,每次调用是会带上这个参数,可自定义
  82. queryParams : function(params) {
  83. var searchParam = $("#searchForm").serializeJSON();
  84. searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
  85. searchParam.pageSize = params.limit === undefined? -1 : params.limit;
  86. searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+ params.order;
  87. return searchParam;
  88. },
  89. //分页方式:client客户端分页,server服务端分页(*)
  90. sidePagination: "server",
  91. onClickRow: function(row, $el){
  92. },
  93. columns: [{
  94. radio: true
  95. }, {
  96. field: 'name',
  97. title: '姓名',
  98. sortable: true
  99. }, /*{
  100. field: 'phone',
  101. title: '电话',
  102. sortable: true
  103. }, {
  104. field: 'mobile',
  105. title: '手机',
  106. sortable: true
  107. }, {
  108. field: 'company.name',
  109. title: '归属公司'
  110. },*/ {
  111. field: 'allName',
  112. title: '归属部门'
  113. }]
  114. });
  115. if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,默认关闭tab
  116. $('#table').bootstrapTable("toggleView");
  117. }
  118. $('#table').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
  119. 'check-all.bs.table uncheck-all.bs.table', function () {
  120. $('#remove').prop('disabled', ! $('#table').bootstrapTable('getSelections').length);
  121. $('#edit').prop('disabled', $('#table').bootstrapTable('getSelections').length!=1);
  122. });
  123. $("#search").click("click", function() {// 绑定查询按扭
  124. $('#table').bootstrapTable('refresh');
  125. });
  126. $("#reset").click("click", function() {// 绑定查询按扭
  127. if(isParty){
  128. $("#lead").val("1");
  129. }else {
  130. $("#villageId").val("1");
  131. }
  132. $("#searchForm input").val("");
  133. $("#searchForm select").val("");
  134. $('#table').bootstrapTable('refresh');
  135. });
  136. });
  137. function getIdSelections() {
  138. return $.map($("#table").bootstrapTable('getSelections'), function (row) {
  139. return row.id
  140. });
  141. }
  142. function getNameSelections() {
  143. return $.map($("#table").bootstrapTable('getSelections'), function (row) {
  144. return row.name
  145. });
  146. }
  147. function getLoginNameSelections() {
  148. return $.map($("#table").bootstrapTable('getSelections'), function (row) {
  149. return row.loginName
  150. });
  151. }
  152. function getSelections() {
  153. return $.map($("#table").bootstrapTable('getSelections'), function (row) {
  154. return row
  155. });
  156. }
  157. </script>
  158. </head>
  159. <body class="bg-white">
  160. <div class="wrapper wrapper-content">
  161. <div class="row">
  162. <div class="col-sm-6 col-md-2" style="width: 30%;height:450px;overflow: auto;overflow-x:auto;">
  163. <div id="jstree"></div>
  164. </div>
  165. <div class="col-sm-5 col-md-10 animated fadeInRight" style="width: 70%;">
  166. <!-- 搜索框-->
  167. <div class="accordion-group">
  168. <div id="collapseTwo" class="accordion-body">
  169. <div class="accordion-inner">
  170. <form id="searchForm" class="form form-horizontal well clearfix" >
  171. <input type="hidden" id="companyId" name="company.id"/>
  172. <c:if test="${isParty}">
  173. <input type="hidden" id="lead" name="lead"/>
  174. </c:if>
  175. <c:if test="${!isParty}">
  176. <input type="hidden" id="villageId" name="villageId"/>
  177. </c:if>
  178. <div class="col-sm-4">
  179. <label class="label-item single-overflow pull-left" title="姓名:">姓名:</label>
  180. <input type="text" name="name" maxlength="100" class=" form-control"/>
  181. </div>
  182. <div class="col-sm-4">
  183. <div style="margin-top:26px">
  184. <a id="search" class="btn btn-primary btn-rounded btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
  185. <a id="reset" class="btn btn-primary btn-rounded btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
  186. </div>
  187. </div>
  188. </form>
  189. </div>
  190. </div>
  191. </div><!-- 搜索框结束 -->
  192. <!-- 表格 -->
  193. <table id="table"
  194. data-toolbar="#toolbar"
  195. data-minimum-count-columns="2"
  196. data-id-field="id">
  197. </table>
  198. </div>
  199. </div>
  200. </div>
  201. </body>
  202. </html>