虞城12345_前端

GroupManage.html 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <script src="../Script/Common/huayi.load.js"></script>
  7. <script src="../Script/Common/huayi.config.js"></script>
  8. <link href="../css/init.css" rel="stylesheet" />
  9. <link href="../css/Table/table1.css" rel="stylesheet" />
  10. <title>班组管理</title>
  11. <style>
  12. .th-bar{
  13. height: initial;
  14. }
  15. </style>
  16. </head>
  17. <body class="gray-bg">
  18. <div class="daoHang clearfix">
  19. <div class="dhLeft">
  20. <sapn><i class="syIcon"></i>位置:<a id="ReIndex" href="javaScript:;">首页</a>&gt;<a href="javaScript:;">系统管理</a>&gt;<a href="" class="nowPosition">班组管理</a></sapn>
  21. </div>
  22. <div class="dhRight">
  23. <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
  24. </div>
  25. </div>
  26. <div class="wrapper wrapper-content">
  27. <div class="th-top clearfix">
  28. <div class="form-inline th-bar clearfix">
  29. <div class="time-box form-group" >
  30. <i class="tub fa fa-search"></i>
  31. <input class="form-control" type="text" id="name" placeholder="请输入班组名称"/>
  32. </div>
  33. <div class="form-group tool_bars pull-right">
  34. <button class="btns" id="sc_btns">搜索</button>
  35. <button class="btns add">添加</button>
  36. <button class="btns xg">修改</button>
  37. <button class="btns remove">删除</button>
  38. </div>
  39. </div>
  40. </div>
  41. <div style="width: 100%;padding: 10px;">
  42. <table id="list" data-row-style="rowStyle" data-query-params="queryParams" data-pagination="true">
  43. <thead>
  44. <tr>
  45. <th data-field="state" data-checkbox="true"></th>
  46. <th data-align="center" data-formatter="setCode">编号</th>
  47. <th data-field="F_GroupName">班组名称</th>
  48. <th data-field="F_GroupCode">班组代码</th>
  49. <th data-field="F_Remark">说明</th>
  50. <th data-field="UserName">创建人</th>
  51. <th data-field="F_CreateTime">创建时间</th>
  52. </tr>
  53. </thead>
  54. <tbody id="tbody"></tbody>
  55. </table>
  56. </div>
  57. </div>
  58. <script>
  59. $(document).ready(function () {
  60. /*搜索*/
  61. $("#sc_btns").click(function () {
  62. initTable();
  63. })
  64. $(".add").click(function () {
  65. layer.open({
  66. type: 2,
  67. content: "GroupEdit.html" , //iframe的url,no代表不显示滚动条
  68. title: '新增班组',
  69. area: ['40%', '50%'] //宽高
  70. });
  71. });
  72. $(".xg").click(function () {
  73. var id = $.map($('#list').bootstrapTable('getSelections'),
  74. function(row) {
  75. return row.F_Id;
  76. });
  77. if (id.length != 1) {
  78. layer.confirm('请选择一行进行修改?', {
  79. btn: ['确定'] //按钮
  80. });
  81. return;
  82. } else {
  83. layer.open({
  84. type: 2,
  85. content: "GroupEdit.html?id=" + id, //iframe的url,no代表不显示滚动条
  86. title: '修改班组',
  87. area: ['40%', '50%'] //宽高
  88. });
  89. }
  90. });
  91. /*删除内容*/
  92. $(".remove").click(function () {
  93. var ids = $.map($('#list').bootstrapTable('getSelections'),
  94. function (row) {
  95. return row.F_Id;
  96. });
  97. /*判断长度*/
  98. if (ids.length <= 0) {
  99. layer.confirm('没有可删除的选项?', {
  100. btn: ['确定'] //按钮
  101. });
  102. return;
  103. }
  104. layer.confirm('确定删除选中的选项?', {
  105. btn: ['是', '否'] //按钮
  106. }, function () {
  107. /*执行删除*/
  108. var ids = $.map($('#list').bootstrapTable('getSelections'),
  109. function (row) {
  110. return row.F_Id;
  111. });
  112. /*发送请求*/
  113. $.post(huayi.config.callcenter_url + "Group/DelGroup", {
  114. ids: ids,
  115. token: $.cookie("token")
  116. }, function (result) {
  117. result = JSON.parse(result);
  118. if (result.state.toLowerCase() == "success") {
  119. layer.msg("删除成功");
  120. initTable();
  121. }
  122. })
  123. });
  124. });
  125. initTable();
  126. })
  127. function initTable() {
  128. //先销毁表格
  129. $('#list').bootstrapTable('destroy');
  130. //初始化表格,动态从服务器加载数据
  131. $("#list").bootstrapTable({
  132. method: "get", //使用get请求到服务器获取数据
  133. url: huayi.config.callcenter_url + "Group/GetList", //获取数据的Servlet地址
  134. contentType: "application/x-www-form-urlencoded", striped: true, //表格显示条纹
  135. pagination: true, //启动分页
  136. pageSize: 10, //每页显示的记录数
  137. pageNumber: 1, //当前第几页
  138. pageList: [10, 20, 50, 100], //记录数可选列表
  139. search: false, //是否启用查询
  140. showColumns: false, //显示下拉框勾选要显示的列
  141. showRefresh: false, //显示刷新按钮
  142. sidePagination: "server", //表示服务端请求
  143. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  144. //设置为limit可以获取limit, offset, search, sort, order
  145. queryParamsType: "undefined",
  146. queryParams: function queryParams(params) { //设置查询参数
  147. var param = {
  148. page: params.pageNumber,
  149. pagesize: params.pageSize,
  150. name: $("#name").val(),
  151. token: $.cookie("token")
  152. };
  153. return param;
  154. },
  155. onLoadSuccess: function (data) { //加载成功时执行
  156. //layer.msg("加载成功");
  157. },
  158. onLoadError: function () { //加载失败时执行
  159. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  160. }
  161. });
  162. }
  163. //编号
  164. function setCode(val, row, index) {
  165. return index + 1;
  166. }
  167. </script>
  168. </body>
  169. </html>