index.html 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. <title>常用语列表</title>
  7. <link rel="shortcut icon" href="favicon.ico">
  8. <link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  9. <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
  10. <link href="__CSS__/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
  11. <link href="__CSS__/animate.min.css" rel="stylesheet">
  12. <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
  13. </head>
  14. <body class="gray-bg">
  15. <div class="wrapper wrapper-content animated fadeInRight">
  16. <input style="display:none;" type="text" value="1" id="type">
  17. <!-- Panel Other -->
  18. <div class="ibox float-e-margins">
  19. <!--<div style="display: flex;">
  20. <div class="ibox-title" style="width: 100px;" id="current1" onclick="current(1)">
  21. <h5>系统常用语</h5>
  22. </div>
  23. <div class="ibox-title" id="current2" style="width: 100px; background: #eee" onclick="current(2)">
  24. <h5>客服常用语</h5>
  25. </div>
  26. <div class="ibox-title" style="width: calc(100% - 200px); background: #eee;">
  27. </div>
  28. </div>-->
  29. <div class="ibox-title">
  30. <h5>系统常用语列表</h5>
  31. </div>
  32. <div class="ibox-content" style="border-top: 0;">
  33. <a href="/admin/words/addword.html">
  34. <button class="btn btn-primary" type="button" style="margin-top:10px"><strong>新增常用语</strong>
  35. </button>
  36. </a>
  37. <form action="/admin/words/inserExcel" enctype="multipart/form-data" method="post" role="form" class="form-inline pull-right">
  38. <div class="content clearfix m-b">
  39. <div class="form-group">
  40. <a href="javascript:allDel()" class="btn" style="margin-top:5px;" ><button type="button" class="btn btn-danger btn-sm"><i class="fa fa-trash-o"></i>全部删除</button></a>
  41. </div>
  42. <div class="form-group">
  43. <a href="/static/admin/file/words.xlsx" class="btn btn-primary" style="margin-top:5px" >下载快捷回复模板文件</a>
  44. </div>
  45. <div class="form-group">
  46. <!--<label>导入快捷回复:</label>-->
  47. <input type="file" class="form-control" name="excel" style="width: 200px;border: none;" />
  48. </div>
  49. <div class="form-group">
  50. <input type="submit" class="btn btn-primary" style="margin-top:5px" value="导入">
  51. </div>
  52. </div>
  53. </form>
  54. <!--搜索框开始-->
  55. <form id='commentForm' role="form" method="post" class="form-inline pull-right">
  56. <input style="display: none">
  57. <div class="content clearfix m-b" style="margin-top:5px;">
  58. <div class="form-group">
  59. <label>常用语:</label>
  60. <input type="text" class="form-control" id="content" name="content">
  61. </div>
  62. <div class="form-group">
  63. <button class="btn btn-primary" type="button" style="margin-top:5px" id="search"><strong>搜 索</strong>
  64. </button>
  65. </div>
  66. </div>
  67. </form>
  68. <!--搜索框结束-->
  69. <div class="example-wrap">
  70. <div class="example">
  71. <table id="cusTable">
  72. <thead>
  73. <th data-field="id">内容ID</th>
  74. <th data-field="title">快捷</th>
  75. <th data-field="content">内容</th>
  76. <th data-field="update_time">修订时间</th>
  77. <th data-field="user_name">修订人</th>
  78. <th data-field="status">状态</th>
  79. <th data-field="operate">操作</th>
  80. </thead>
  81. </table>
  82. </div>
  83. </div>
  84. <!-- End Example Pagination -->
  85. </div>
  86. </div>
  87. </div>
  88. <!-- End Panel Other -->
  89. <script src="__JS__/jquery.min.js?v=2.1.4"></script>
  90. <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
  91. <script src="__JS__/content.min.js?v=1.0.0"></script>
  92. <script src="__JS__/plugins/bootstrap-table/bootstrap-table.min.js"></script>
  93. <script src="__JS__/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
  94. <script src="__JS__/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
  95. <script src="__JS__/plugins/layer/layer.min.js"></script>
  96. <script type="text/javascript">
  97. function current(id) {
  98. $("#type").val(id);
  99. if (id == 1) {
  100. $("#current1").css("background","#fff");
  101. $("#current2").css("background","#eee");
  102. } else if (id == 2) {
  103. $("#current2").css({"background":"#fff"});
  104. $("#current1").css({"background":"#eee"});
  105. }
  106. initTable()
  107. }
  108. function initTable(type) {
  109. //先销毁表格
  110. $('#cusTable').bootstrapTable('destroy');
  111. type = $('#type').val();
  112. //初始化表格,动态从服务器加载数据
  113. $("#cusTable").bootstrapTable({
  114. method: "get", //使用get请求到服务器获取数据
  115. url: "{:url('words/index')}", //获取数据的地址
  116. striped: true, //表格显示条纹
  117. pagination: true, //启动分页
  118. pageSize: 50, //每页显示的记录数
  119. pageNumber:1, //当前第几页
  120. pageList: [20, 50], //记录数可选列表
  121. sidePagination: "server", //表示服务端请求
  122. paginationFirstText: "首页",
  123. paginationPreText: "上一页",
  124. paginationNextText: "下一页",
  125. paginationLastText: "尾页",
  126. queryParamsType : "undefined",
  127. queryParams: function queryParams(params) { //设置查询参数
  128. var param = {
  129. pageNumber: params.pageNumber,
  130. pageSize: params.pageSize,
  131. type: type,
  132. searchText:$('#content').val()
  133. };
  134. return param;
  135. },
  136. onLoadSuccess: function(res){ //加载成功时执行
  137. if(111 == res.code){
  138. window.location.reload();
  139. }
  140. layer.msg("加载成功", {time : 1000});
  141. },
  142. onLoadError: function(){ //加载失败时执行
  143. layer.msg("加载数据失败");
  144. }
  145. });
  146. }
  147. $(document).ready(function () {
  148. //调用函数,初始化表格
  149. initTable();
  150. //当点击查询按钮的时候执行
  151. $("#search").bind("click", initTable);
  152. });
  153. function userDel(id){
  154. layer.confirm('确认删除此常用语?', {icon: 3, title:'提示'}, function(index){
  155. //do something
  156. $.getJSON("{:url('words/delWord')}", {'id' : id}, function(res){
  157. if(1 == res.code){
  158. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  159. initTable();
  160. });
  161. }else if(111 == res.code){
  162. window.location.reload();
  163. }else{
  164. layer.alert(res.msg, {title: '友情提示', icon: 2});
  165. }
  166. });
  167. layer.close(index);
  168. })
  169. }
  170. function allDel(){
  171. layer.confirm('确认删除全部快捷回复?', {icon: 3, title:'提示'}, function(index){
  172. //do something
  173. $.getJSON("{:url('words/delAll')}", function(res){
  174. if(1 == res.code){
  175. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  176. initTable();
  177. });
  178. }else if(111 == res.code){
  179. window.location.reload();
  180. }else{
  181. layer.alert(res.msg, {title: '友情提示', icon: 2});
  182. }
  183. });
  184. layer.close(index);
  185. })
  186. }
  187. </script>
  188. </body>
  189. </html>