信阳市12345_前端

BlackWhiteList.html 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <script src="../js/huayi.load.js"></script>
  6. <title>黑白名单</title>
  7. <style>
  8. .toolBar {
  9. padding: 15px 0;
  10. border-bottom: 1px solid #ccc;
  11. }
  12. .toolBar select {
  13. width: 150px;
  14. padding: 2px 2px 2px 10px;
  15. height: 32px;
  16. border: 1px solid rgb(204, 204, 204);
  17. }
  18. .tool_downs {
  19. display: flex;
  20. justify-content: center;
  21. }
  22. .tool_downs span {
  23. display: block;
  24. width: 100%;
  25. height: 100%;
  26. text-align: center;
  27. }
  28. .tool_downs a {
  29. display: block;
  30. list-style: none;
  31. float: left;
  32. padding-left: 10px;
  33. }
  34. </style>
  35. <script>
  36. $(document).ready(function () {
  37. initTable();
  38. $(".searchGo").click(function () {
  39. initTable();
  40. });
  41. $(".addBtn").click(function () {
  42. layer.open({
  43. type: 2,
  44. content: "./BlackWhiteAdd.html", //iframe的url,no代表不显示滚动条
  45. title: "黑白名单",
  46. area: ["500px", "600px"], //宽高
  47. });
  48. });
  49. });
  50. function initTable() {
  51. //先销毁表格
  52. $("#tableList").bootstrapTable("destroy");
  53. //初始化表格,动态从服务器加载数据
  54. $("#tableList").bootstrapTable({
  55. method: "post", //使用get请求到服务器获取数据
  56. url: huayi.config.callcenter_url + "SystemApi/GetBlackWhiteList", //获取数据的Servlet地址
  57. contentType: "application/x-www-form-urlencoded",
  58. striped: true, //表格显示条纹
  59. pagination: true, //启动分页
  60. pageSize: 10, //每页显示的记录数
  61. pageNumber: 1, //当前第几页
  62. pageList: [10, 20, 50, 100], //记录数可选列表
  63. search: false, //是否启用查询
  64. showColumns: false, //显示下拉框勾选要显示的列
  65. showRefresh: false, //显示刷新按钮
  66. sidePagination: "server", //表示服务端请求
  67. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  68. //设置为limit可以获取limit, offset, search, sort, order
  69. queryParamsType: "undefined",
  70. queryParams: function queryParams(params) {
  71. //设置查询参数
  72. var param = {
  73. currentPage: params.pageNumber,
  74. pageSize: params.pageSize,
  75. mobile: $("#keyvalue").val(),
  76. type: $("#type").val()
  77. };
  78. return param;
  79. },
  80. onLoadSuccess: function () {
  81. //加载成功时执行
  82. //layer.msg("加载成功");
  83. },
  84. onLoadError: function () {
  85. //加载失败时执行
  86. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  87. },
  88. });
  89. }
  90. function operation(val, row) {
  91. return (
  92. '<div class="tool_downs">' +
  93. '<a href="javascript:;" class="aBtn" authorize="yes" onclick="editBtn(' +
  94. row.mobile +
  95. ')" title="编辑">编辑</a>' +
  96. '<a href="javascript:;" class="aBtn" authorize="yes" onclick="deleteBtn(' +
  97. row.mobile +
  98. ')" title="删除">删除</a>' +
  99. "</div>"
  100. );
  101. }
  102. function typename(val) {
  103. var name = '未知';
  104. switch (val + '') {
  105. case '1': name = '黑名单'; break;
  106. case '2': name = '白名单'; break;
  107. }
  108. return name;
  109. }
  110. function editBtn(id) {
  111. layer.open({
  112. type: 2,
  113. content: "./BlackWhiteAdd.html?id=" + id, //iframe的url,no代表不显示滚动条
  114. title: "黑白名单",
  115. area: ["500px", "600px"], //宽高
  116. });
  117. }
  118. function deleteBtn(id) {
  119. layer.confirm('确定删除吗?', {
  120. btn: ['是', '否'] //按钮
  121. }, function () {
  122. $.getJSON(huayi.config.callcenter_url + "SystemApi/DeleteBlackWhite", {
  123. mobile: id
  124. }, function (result) {
  125. if (result.state.toLowerCase() == "success") {
  126. layer.msg("删除成功");
  127. initTable();
  128. }
  129. })
  130. });
  131. }
  132. </script>
  133. </head>
  134. <body class="gray-bg">
  135. <div class="container-fluid wrapper-content animated fadeInRight">
  136. <div class="toolBar clearfix">
  137. <div class="toolRight">
  138. <span>
  139. 手机号:
  140. <input id="keyvalue" type="text" class="">
  141. 类型:
  142. <select id="type" >
  143. <option value="0">全部</option>
  144. <option value="1">黑名单</option>
  145. <option value="2">白名单</option>
  146. </select>
  147. </span>
  148. <button class="btns searchGo">搜索</button>
  149. <button class="btns addBtn">添加</button>
  150. </div>
  151. </div>
  152. <div class="treeTable clearfix">
  153. <div class="tableCon col-md-12">
  154. <table id="tableList" data-row-style="rowStyle" data-query-params="queryParams" data-pagination="true">
  155. <thead>
  156. <tr>
  157. <th data-field="mobile" data-align="center">手机号</th>
  158. <th data-field="type" data-formatter="typename" data-align="center">类型</th>
  159. <th data-field="startTime" data-align="center">开始时间</th>
  160. <th data-field="endTime" data-align="center">结束时间</th>
  161. <th data-field="remark" data-align="center">描述</th>
  162. <th data-align="center" data-formatter="operation" data-width="150">操作</th>
  163. </tr>
  164. </thead>
  165. <tbody id="tbody"></tbody>
  166. </table>
  167. </div>
  168. </div>
  169. </div>
  170. </body>
  171. </html>