index.html 9.2 KB

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