index.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. $this->title = '挂单报表';
  3. ?>
  4. <?php $this->beginBlock('header_script'); ?>
  5. <link href="<?= STATIC_URL ?>/ui/css/plugins/dataTables/datatables.min.css" rel="stylesheet">
  6. <?php $this->endBlock(); ?>
  7. <style>
  8. table.table-bordered.dataTable th, table.table-bordered.dataTable td {
  9. white-space: nowrap;
  10. }
  11. @media (min-width: 1600px){
  12. .container {
  13. width: 1550px;
  14. }
  15. }
  16. @media (min-width: 1920px){
  17. .container {
  18. width: 1550px;
  19. }
  20. }
  21. </style>
  22. <div class="row">
  23. <div class="col-md-2">
  24. <?= $this->render('/common/_left_menu.php') ?>
  25. </div>
  26. <div class="col-md-10">
  27. <div class="ibox">
  28. <div class="ibox-title">
  29. <h2>挂单报表</h2>
  30. </div>
  31. <form>
  32. <input type="hidden" name="type" value="<?= $type ?>">
  33. <div class="ibox-content m-b-sm border-bottom">
  34. <div class="row">
  35. <div class="col-sm-4">
  36. <div class="form-group">
  37. <label class="control-label" for="price">开始时间</label>
  38. <input readonly="readonly" type="text" id="sTime" name="sTime" value="<?= $sTime ?>" placeholder="开始时间" class="data form-control">
  39. </div>
  40. </div>
  41. <div class="col-sm-4">
  42. <div class="form-group">
  43. <label class="control-label" for="quantity">结束时间</label>
  44. <input readonly="readonly" type="text" id="eTime" name="eTime" value="<?= $eTime ?>" placeholder="结束时间" class="data form-control">
  45. </div>
  46. </div>
  47. <div class="col-sm-4">
  48. <div class="form-group">
  49. <label class="control-label" for="quantity">操作</label>
  50. <input type="submit" class="btn btn-primary form-control" value="搜索">
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </form>
  56. <div class="ibox-content">
  57. <div class="table-responsive">
  58. <table id="datatables" class="table table-striped table-bordered table-hover dataTables-example">
  59. <thead>
  60. <tr>
  61. <th>订单号</th>
  62. <th>类型</th>
  63. <th>品种</th>
  64. <th>SL</th>
  65. <th>TP</th>
  66. <th>手数</th>
  67. <th>开仓价格</th>
  68. <th>开仓时间</th>
  69. <th>利息</th>
  70. <th>佣金</th>
  71. <th>获利</th>
  72. </tr>
  73. </thead>
  74. </table>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <?php $this->beginBlock('footer_script'); ?>
  81. <!-- Mainly scripts -->
  82. <script src="<?= STATIC_URL ?>/ui/js/plugins/dataTables/datatables.min.js"></script>
  83. <script>
  84. var table;
  85. $(document).ready(function() {
  86. table = $('#datatables').DataTable({
  87. "aLengthMenu": [[20,50,100,500], [20,50,100,500]],
  88. language: {
  89. "sProcessing": "处理中...",
  90. "sLengthMenu": "显示 _MENU_ 项结果",
  91. "sZeroRecords": "没有匹配结果",
  92. "sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
  93. "sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
  94. "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
  95. "sInfoPostFix": "",
  96. "sSearch": "搜索:",
  97. "sUrl": "",
  98. "sEmptyTable": "表中数据为空",
  99. "sLoadingRecords": "载入中...",
  100. "sInfoThousands": ",",
  101. "oPaginate": {
  102. "sFirst": "首页",
  103. "sPrevious": "上页",
  104. "sNext": "下页",
  105. "sLast": "末页"
  106. },
  107. "oAria": {
  108. "sSortAscending": ": 以升序排列此列",
  109. "sSortDescending": ": 以降序排列此列"
  110. }
  111. },
  112. "processing": true,
  113. "serverSide": true,
  114. "ajax": '/user/trades?type=<?= $type ?>&sTime=<?= $sTime ?>&eTime=<?= $eTime ?>',
  115. "order": [[0, "desc"]],
  116. "columns": [{
  117. "data": "TICKET"
  118. },
  119. {
  120. "data": "CMD"
  121. },
  122. {
  123. "data": "SYMBOL"
  124. },
  125. {
  126. "data": "SL"
  127. },
  128. {
  129. "data": "TP"
  130. },
  131. {
  132. "data": "VOLUME"
  133. },
  134. {
  135. "data": "OPEN_PRICE"
  136. },
  137. {
  138. "data": "OPEN_TIME"
  139. },
  140. {
  141. "data": "SWAPS"
  142. },
  143. {
  144. "data": "COMMISSION"
  145. },
  146. {
  147. "data": "PROFIT"
  148. }],
  149. columnDefs: [{
  150. targets: 1,
  151. render: function(data, type, row, meta) {
  152. if(data==0){
  153. return 'BUY';
  154. }else if (data==1){
  155. return 'SELL';
  156. }else if (data==2){
  157. return 'BUY LIMIT';
  158. }else if (data==3){
  159. return 'SELL LIMIT';
  160. }else if (data==4){
  161. return 'BUY STOP';
  162. }else if (data==5){
  163. return 'SELL STOP';
  164. }else if (data==6){
  165. return 'BALANCE';
  166. }else if (data==7){
  167. return 'CREDIT';
  168. }else{
  169. return '';
  170. }
  171. },
  172. "orderable": true
  173. },{
  174. targets: 5,
  175. render: function(data, type, row, meta) {
  176. return data/100;
  177. },
  178. "orderable": true
  179. }],
  180. "sPaginationType": "full_numbers",
  181. dom: '<"html5buttons"B>lTfgitp',
  182. buttons: [{
  183. extend: 'copy'
  184. },
  185. {
  186. extend: 'csv'
  187. },
  188. {
  189. extend: 'excel'
  190. },
  191. {
  192. extend: 'pdf'
  193. },
  194. {
  195. extend: 'print',
  196. customize: function(win) {
  197. $(win.document.body).addClass('white-bg');
  198. $(win.document.body).css('font-size', '10px');
  199. $(win.document.body).find('table').addClass('compact').css('font-size', 'inherit');
  200. }
  201. }]
  202. });
  203. $('#datatables tbody').on('click', 'tr',
  204. function() {
  205. if ($(this).hasClass('selected')) {
  206. $(this).removeClass('selected');
  207. } else {
  208. table.$('tr.selected').removeClass('selected');
  209. $(this).addClass('selected');
  210. }
  211. });
  212. });
  213. </script>
  214. <?php $this->endBlock(); ?>