index.tpl 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {include file='admin/header.tpl'}
  2. <div class="page-wrapper">
  3. <div class="container-xl">
  4. <div class="page-header d-print-none text-white">
  5. <div class="row align-items-center">
  6. <div class="col">
  7. <h2 class="page-title">
  8. <span class="home-title">工单列表</span>
  9. </h2>
  10. <div class="page-pretitle my-3">
  11. <span class="home-subtitle">查看并回复用户工单</span>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="page-body">
  18. <div class="container-xl">
  19. <div class="row row-deck row-cards">
  20. <div class="col-12">
  21. <div class="card">
  22. <div class="table-responsive">
  23. <table id="data_table" class="table card-table table-vcenter text-nowrap datatable">
  24. <thead>
  25. <tr>
  26. {foreach $details['field'] as $key => $value}
  27. <th>{$value}</th>
  28. {/foreach}
  29. </tr>
  30. </thead>
  31. </table>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <script>
  39. var table = $('#data_table').DataTable({
  40. ajax: {
  41. url: '/admin/ticket/ajax',
  42. type: 'POST',
  43. dataSrc: 'tickets'
  44. },
  45. "autoWidth": false,
  46. 'iDisplayLength': 10,
  47. 'scrollX': true,
  48. 'order': [
  49. [1, 'desc']
  50. ],
  51. columns: [
  52. {foreach $details['field'] as $key => $value}
  53. {
  54. data: '{$key}'
  55. },
  56. {/foreach}
  57. ],
  58. "columnDefs": [
  59. {
  60. targets: [0],
  61. orderable: false
  62. }
  63. ],
  64. "dom": "<'row px-3 py-3'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>" +
  65. "<'row'<'col-sm-12'tr>>" +
  66. "<'row card-footer d-flex d-flexalign-items-center'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
  67. language: {
  68. "sProcessing": "处理中...",
  69. "sLengthMenu": "显示 _MENU_ 条",
  70. "sZeroRecords": "没有匹配结果",
  71. "sInfo": "第 _START_ 至 _END_ 项结果,共 _TOTAL_项",
  72. "sInfoEmpty": "第 0 至 0 项结果,共 0 项",
  73. "sInfoFiltered": "(在 _MAX_ 项中查找)",
  74. "sInfoPostFix": "",
  75. "sSearch": "<i class=\"ti ti-search\"></i> ",
  76. "sUrl": "",
  77. "sEmptyTable": "表中数据为空",
  78. "sLoadingRecords": "载入中...",
  79. "sInfoThousands": ",",
  80. "oPaginate": {
  81. "sFirst": "首页",
  82. "sPrevious": "<i class=\"titi-arrow-left\"></i>",
  83. "sNext": "<i class=\"ti ti-arrow-right\"><i>",
  84. "sLast": "末页"
  85. },
  86. "oAria": {
  87. "sSortAscending": ": 以升序排列此列",
  88. "sSortDescending": ": 以降序排列此列"
  89. }
  90. },
  91. });
  92. function loadTable() {
  93. table;
  94. }
  95. function closeTicket(ticket_id) {
  96. $('#notice-message').text('确定关闭此工单?');
  97. $('#notice-dialog').modal('show');
  98. $('#notice-confirm').off('click').on('click', function () {
  99. $.ajax({
  100. url: "/admin/ticket/" + ticket_id + '/close',
  101. type: 'PUT',
  102. dataType: "json",
  103. success: function (data) {
  104. if (data.ret === 1) {
  105. $('#success-message').text(data.msg);
  106. $('#success-dialog').modal('show');
  107. reloadTableAjax();
  108. } else {
  109. $('#fail-message').text(data.msg);
  110. $('#fail-dialog').modal('show');
  111. }
  112. }
  113. });
  114. });
  115. }
  116. function deleteTicket(ticket_id) {
  117. $('#notice-message').text('确定删除此工单?');
  118. $('#notice-dialog').modal('show');
  119. $('#notice-confirm').off('click').on('click', function () {
  120. $.ajax({
  121. url: "/admin/ticket/" + ticket_id,
  122. type: 'DELETE',
  123. dataType: "json",
  124. success: function (data) {
  125. if (data.ret === 1) {
  126. $('#success-noreload-message').text(data.msg);
  127. $('#success-noreload-dialog').modal('show');
  128. reloadTableAjax();
  129. } else {
  130. $('#fail-message').text(data.msg);
  131. $('#fail-dialog').modal('show');
  132. }
  133. }
  134. })
  135. });
  136. }
  137. function reloadTableAjax() {
  138. table.ajax.reload(null, false);
  139. }
  140. loadTable();
  141. </script>
  142. {include file='admin/footer.tpl'}