虞城12345_前端

ClassManage.html 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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%;">
  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_Name">班别名称</th>
  48. <th data-field="F_Code">班别代码</th>
  49. <th data-field="F_InTime">上班时间</th>
  50. <th data-field="F_OutTime">下班时间</th>
  51. <th data-field="F_Remark">说明</th>
  52. <th data-field="UserName">创建人</th>
  53. <th data-field="F_CreateTime">创建时间</th>
  54. </tr>
  55. </thead>
  56. <tbody id="tbody"></tbody>
  57. </table>
  58. </div>
  59. </div>
  60. <script>
  61. $(document).ready(function () {
  62. /*搜索*/
  63. $("#sc_btns").click(function () {
  64. initTable();
  65. })
  66. $(".add").click(function () {
  67. layer.open({
  68. type: 2,
  69. content: "ClassEdit.html" , //iframe的url,no代表不显示滚动条
  70. title: '新增班别',
  71. area: ['40%', '50%'] //宽高
  72. });
  73. });
  74. $(".xg").click(function () {
  75. var id = $.map($('#list').bootstrapTable('getSelections'),
  76. function(row) {
  77. return row.F_Id;
  78. });
  79. if (id.length != 1) {
  80. layer.confirm('请选择一行进行修改?', {
  81. btn: ['确定'] //按钮
  82. });
  83. return;
  84. } else {
  85. layer.open({
  86. type: 2,
  87. content: "ClassEdit.html?id=" + id, //iframe的url,no代表不显示滚动条
  88. title: '修改班别',
  89. area: ['40%', '50%'] //宽高
  90. });
  91. }
  92. });
  93. /*删除内容*/
  94. $(".remove").click(function () {
  95. var ids = $.map($('#list').bootstrapTable('getSelections'),
  96. function (row) {
  97. return row.F_Id;
  98. });
  99. /*判断长度*/
  100. if (ids.length <= 0) {
  101. layer.confirm('没有可删除的选项?', {
  102. btn: ['确定'] //按钮
  103. });
  104. return;
  105. }
  106. layer.confirm('确定删除选中的选项?', {
  107. btn: ['是', '否'] //按钮
  108. }, function () {
  109. /*执行删除*/
  110. var ids = $.map($('#list').bootstrapTable('getSelections'),
  111. function (row) {
  112. return row.F_Id;
  113. });
  114. /*发送请求*/
  115. $.post(huayi.config.callcenter_url + "Class/DelClass", {
  116. ids: ids,
  117. token: $.cookie("token")
  118. }, function (result) {
  119. result = JSON.parse(result);
  120. if (result.state.toLowerCase() == "success") {
  121. layer.msg("删除成功");
  122. initTable();
  123. }
  124. })
  125. });
  126. });
  127. initTable();
  128. })
  129. function initTable() {
  130. //先销毁表格
  131. $('#list').bootstrapTable('destroy');
  132. //初始化表格,动态从服务器加载数据
  133. $("#list").bootstrapTable({
  134. method: "get", //使用get请求到服务器获取数据
  135. url: huayi.config.callcenter_url + "Class/GetList", //获取数据的Servlet地址
  136. contentType: "application/x-www-form-urlencoded", striped: true, //表格显示条纹
  137. pagination: true, //启动分页
  138. pageSize: 10, //每页显示的记录数
  139. pageNumber: 1, //当前第几页
  140. pageList: [10, 20, 50, 100], //记录数可选列表
  141. search: false, //是否启用查询
  142. showColumns: false, //显示下拉框勾选要显示的列
  143. showRefresh: false, //显示刷新按钮
  144. sidePagination: "server", //表示服务端请求
  145. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  146. //设置为limit可以获取limit, offset, search, sort, order
  147. queryParamsType: "undefined",
  148. queryParams: function queryParams(params) { //设置查询参数
  149. var param = {
  150. page: params.pageNumber,
  151. pagesize: params.pageSize,
  152. name: $("#name").val(),
  153. token: $.cookie("token")
  154. };
  155. return param;
  156. },
  157. onLoadSuccess: function (data) { //加载成功时执行
  158. //layer.msg("加载成功");
  159. },
  160. onLoadError: function () { //加载失败时执行
  161. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  162. }
  163. });
  164. }
  165. //编号
  166. function setCode(val, row, index) {
  167. return index + 1;
  168. }
  169. </script>
  170. </body>
  171. </html>