bill.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. let Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init();
  6. //绑定事件
  7. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  8. var panel = $($(this).attr("href"));
  9. if (panel.size() > 0) {
  10. Controller.table[panel.attr("id")].call(this);
  11. $(this).on('click', function (e) {
  12. $($(this).attr("href")).find(".btn-refresh").trigger("click");
  13. });
  14. }
  15. //移除绑定的事件
  16. $(this).unbind('shown.bs.tab');
  17. });
  18. //必须默认触发shown.bs.tab事件
  19. $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
  20. },
  21. table:{
  22. first:function () {
  23. let table1 = $("#table1");
  24. // 初始化表格
  25. table1.bootstrapTable({
  26. url: 'money/bill/index',
  27. pk: 'id',
  28. sortName: 'id',
  29. showToggle : false,
  30. toolbar : '#toolbar1',
  31. showExport : false,
  32. showColumns : false,
  33. columns: [
  34. [
  35. { field : 'order_num',
  36. title: __('Order_num'),
  37. operate: 'LIKE %...%',
  38. formatter: Table.api.formatter.bold,
  39. },
  40. { field : 'institution_id',
  41. title: __('Institution_id'),
  42. searchable: false
  43. },
  44. { field : 'institution_name',
  45. title: __('Institution_name'),
  46. operate: 'LIKE %...%'
  47. },
  48. { field : 'createdAt',
  49. title : __('Createdat'),
  50. operate : 'RANGE',
  51. addclass: 'datetimerange'
  52. },
  53. { field : 'create_user_name',
  54. title: __('Create_user_name')
  55. },
  56. { field : 'remark',
  57. title: __('Remark'),
  58. width:'100px'
  59. },
  60. {
  61. field : 'id',
  62. title: __('operate'),
  63. width: '120px',
  64. formatter: function (value) {
  65. return '<a onclick="orderDetail('+ value +')" class="btn btn-xs btn-danger" title="查看缴费单" style="margin-right: 5px" ><i class="fa fa-file-text-o"></i></a>' +'<a href="/admin/money/money/downOrder/id/'+ value +'" title="下载缴费单" class="btn btn-xs btn-danger" style="margin-right: 5px" ><i class="fa fa-download"></i></a>'+
  66. '<a href="/admin/money/bill/exportExam/id/'+ value +'" class=" btn btn-xs btn-primary " title="下载明细" ><i class="fa fa-download"></i></a>';
  67. },
  68. }
  69. ]
  70. ]
  71. });
  72. orderDetail = function(id) {
  73. let ids = Table.api.getrowbyid(table1,id).water_ids;
  74. Fast.api.ajax({
  75. url: 'money/money/makePaymentOrder/disable/1',
  76. data: {
  77. ids : ids,
  78. _method: 'GET'
  79. }
  80. }, function (data) {
  81. Layer.open({
  82. content: data,
  83. area : [
  84. $(window).width() > 800 ? '800px' : '95%',
  85. $(window).height() > 600 ? '600px' : '95%'
  86. ],
  87. title: '缴费单',
  88. btn: false
  89. });
  90. return false;
  91. }, function (data, ret) {
  92. Toastr.error(ret);
  93. });
  94. }
  95. // 为表格绑定事件
  96. Table.api.bindevent(table1);
  97. },
  98. second:function () {
  99. let table2 = $("#table2");
  100. // 初始化表格
  101. table2.bootstrapTable({
  102. url: 'money/bill/completedList',
  103. pk: 'id',
  104. sortName: 'id',
  105. showToggle : false,
  106. toolbar : '#toolbar2',
  107. showExport : false,
  108. showColumns : false,
  109. columns: [
  110. [
  111. { field : 'order_num',
  112. title: __('Order_num'),
  113. operate: 'LIKE %...%',
  114. formatter: Table.api.formatter.bold,
  115. },
  116. { field : 'institution_id',
  117. title: __('Institution_id'),
  118. searchable: false
  119. },
  120. { field : 'institution_name',
  121. title: __('Institution_name'),
  122. operate: 'LIKE %...%'
  123. },
  124. { field : 'createdAt',
  125. title : __('Createdat'),
  126. operate : 'RANGE',
  127. addclass: 'datetimerange'
  128. },
  129. { field : 'create_user_name',
  130. title: __('Create_user_name')
  131. }
  132. ]
  133. ]
  134. });
  135. // 为表格绑定事件
  136. Table.api.bindevent(table2);
  137. }
  138. },
  139. add: function () {
  140. Controller.api.bindevent();
  141. },
  142. edit: function () {
  143. Controller.api.bindevent();
  144. },
  145. api: {
  146. bindevent: function () {
  147. Form.api.bindevent($("form[role=form]"));
  148. }
  149. }
  150. };
  151. return Controller;
  152. });