project-question-list.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>列表页面</title>
  5. <!--#include file="common/_header.html"-->
  6. <style>
  7. .table .center{
  8. text-align:center;
  9. }
  10. </style>
  11. </head>
  12. <body>
  13. <nav class="breadcrumb">
  14. <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 问题回复列表
  15. <a class="btn btn-success radius r"
  16. style="line-height: 1.6em; margin-top: 3px"
  17. href="javascript:location.replace(location.href);" title="刷新">
  18. <i class="Hui-iconfont">&#xe68f;</i></a>
  19. </nav>
  20. <div class="page-container">
  21. <div class="container mb-10">
  22. <form>
  23. <div class="row mb-10">
  24. <input type="text" class="input-text" style="width: 250px" placeholder="输入项目名称" id="selProjectName">
  25. <input type="text" class="input-text" style="width: 250px" placeholder="输入问题" id="selDetail">
  26. <button type="submit" class="btn btn-success" id="btnSearch">
  27. <i class="Hui-iconfont">&#xe665;</i> 查询
  28. </button>
  29. <button type="reset" class="btn btn-success" id="btnReset">
  30. <i class="Hui-iconfont">&#xe665;</i> 重置
  31. </button>
  32. </div>
  33. </form>
  34. </div>
  35. <div class="cl pd-5 bg-1 bk-gray">
  36. <span class="l">
  37. <a href="javascript:batch_del();" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i>批量删除</a>
  38. <!-- <a href="javascript:item_add();" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>添加</a> -->
  39. </span>
  40. </div>
  41. <div class="mt-20">
  42. <table id="grid1" class="table table-border table-bordered table-bg">
  43. <thead>
  44. <tr class="text-c">
  45. <th width="25"><input id="checkAll" type="checkbox" value=""></th>
  46. <th width="100">项目名称</th>
  47. <th width="100">问题</th>
  48. <th width="100">停止回复</th>
  49. <th width="100">操作</th>
  50. </tr>
  51. </thead>
  52. <tbody>
  53. </tbody>
  54. </table>
  55. </div>
  56. </div>
  57. <!--_footer 作为公共模版分离出去-->
  58. <!--#include file="common/_footer.html"-->
  59. <!--/_footer 作为公共模版分离出去-->
  60. <!--请在下方写此页面业务相关的脚本-->
  61. <script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
  62. <script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
  63. <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
  64. <script id="rowTmpl" type="text/template">
  65. <a href="javascript:item_edit('{{id}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i>变更回复状态</a>
  66. <a href="javascript:item_del('{{id}}','{{name}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i>删除</a>
  67. </script>
  68. <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
  69. <script type="text/javascript" src="scripts/global.js"></script>
  70. <script type="text/javascript">
  71. var path = global_backend_url;
  72. $(document).ready(function(){
  73. $('#grid1').dataTable({
  74. ajax: {
  75. url: path + "/projectQuestion/list",
  76. type: 'post',
  77. dataFilter: function(responseText){
  78. var jsonData = JSON.parse(responseText);
  79. // 处理返回json
  80. if(jsonData.result){
  81. return JSON.stringify(jsonData.data);
  82. }
  83. else{
  84. processError(jsonData);
  85. return null;
  86. }
  87. },
  88. data: function(searchParams){
  89. // 查询json
  90. searchParams["selProjectName"] = $("#selProjectName").val();
  91. searchParams["selDetail"] = $("#selDetail").val();
  92. }
  93. },
  94. serverSide: true,
  95. searching : false,
  96. ordering: false,
  97. columns: [
  98. {data:'id'},
  99. {data:'project.projectName'},
  100. {data:'detail'},
  101. // {data:'stopReply'},
  102. {
  103. "title": "停止回复", "render": function (data, type, row, meta) {
  104. var result = "";
  105. if (row.stopReply == "1") {
  106. result = "是";
  107. }
  108. else {
  109. result = "否";
  110. }
  111. return result;
  112. }
  113. },
  114. {"data":null}
  115. ],
  116. columnDefs: [
  117. {
  118. targets:0,
  119. sClass:'center',
  120. bSortable:false,
  121. render: function (data, type, row) {
  122. return '<input type="checkbox" name="checkItems" value="'+ data + '">';
  123. }
  124. },{
  125. targets:4,
  126. sClass:'center',
  127. bSortable:false,
  128. render: function (data, type, row) {
  129. return template("rowTmpl",{
  130. id: row.id
  131. });
  132. }
  133. }
  134. ]
  135. });
  136. $("#checkAll").change(function(){
  137. var checked = $(this).is(':checked');
  138. $("input[name='checkItems']").each(function(){
  139. $(this).attr("checked",checked);
  140. });
  141. });
  142. $("#btnSearch").click(function(){
  143. event.preventDefault();
  144. var table = $('#grid1').DataTable();
  145. table.ajax.reload();
  146. });
  147. });
  148. function item_add(){
  149. layer_show("添加","projectQuestion-detail.html",800,600);
  150. }
  151. function item_edit(id){
  152. // layer_show("编辑","projectQuestion-detail.html?id=" + id,800,600);
  153. layer.confirm("是否变更回复状态?",{
  154. btns:["是","否"]
  155. },function(){
  156. $.post(path + "/projectQuestion/closeResult/" + id,null,function(json){
  157. if(json.result){
  158. layer.msg("变更成功!",{icon:1,time:2000});
  159. reloadList();
  160. }
  161. else{
  162. layer.msg("变更失败!" + json.message);
  163. }
  164. });
  165. });
  166. }
  167. function item_del(id){
  168. layer.confirm("是否删除?",{
  169. btns:["是","否"]
  170. },function(){
  171. $.post(path + "/projectQuestion/delete/" + id,null,function(json){
  172. if(json.result){
  173. layer.msg("删除成功!",{icon:1,time:2000});
  174. reloadList();
  175. }
  176. else{
  177. layer.msg("删除失败!" + json.message);
  178. }
  179. });
  180. });
  181. }
  182. function reloadList(){
  183. $('#grid1').DataTable().ajax.reload(null,false);
  184. }
  185. function batch_del(){
  186. layer.confirm("是否删除选中项?",{
  187. btns:["是","否"]
  188. },function(){
  189. var arr = $("input[name='checkItems']:checked").map(function(){
  190. return $(this).val();
  191. }).get();
  192. $.post(path + "/projectQuestion/batchDelete",{
  193. ids:arr.join(",")
  194. },function(json){
  195. if(json.result){
  196. layer.msg("删除成功!",{icon:1,time:2000});
  197. reloadList();
  198. }
  199. else{
  200. layer.msg("删除失败!" + json.message);
  201. }
  202. });
  203. })
  204. }
  205. </script>
  206. </body>
  207. </html>