closing.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'massager/closing/index' + location.search,
  8. add_url: 'massager/closing/add',
  9. edit_url: 'massager/closing/edit',
  10. // del_url: 'massager/closing/del',
  11. multi_url: 'massager/closing/multi',
  12. import_url: 'massager/closing/import',
  13. table: 'massager_closing',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'massager.id', title: __('Massager.id')},
  27. {field: 'massager.name', title: __('Massager.name'), operate: 'LIKE'},
  28. {field: 'year', title: __('Year')},
  29. {field: 'month', title: __('Month')},
  30. {field: 'closing_amount', title: "结算金额"},
  31. {
  32. field: 'status',
  33. title: __('Status'),
  34. searchList: {"checking": __('Checking'), "reject": __('Reject'), "allow": __('Allow')},
  35. formatter: Table.api.formatter.status
  36. },
  37. {
  38. field: 'updatetime',
  39. title: __('Updatetime'),
  40. operate: 'RANGE',
  41. addclass: 'datetimerange',
  42. autocomplete: false,
  43. formatter: Table.api.formatter.datetime
  44. },
  45. {
  46. field: 'city_code',
  47. title: __('区域'),
  48. searchList: Config.allow_areas,
  49. visible: false
  50. },
  51. {
  52. field: 'operate',
  53. title: __('Operate'),
  54. table: table,
  55. buttons: [
  56. {
  57. name: 'check_pass',
  58. text: '通过',
  59. title: '通过审核',
  60. classname: 'btn btn-xs btn-success btn-view btn-ajax',
  61. icon: 'fa fa-check',
  62. url: 'massager/closing/check?id={id}&check=pass',
  63. visible: function (row) {
  64. return "checking" === row["status"];
  65. },
  66. refresh: true
  67. },
  68. {
  69. name: 'check_reject',
  70. text: '拒绝',
  71. title: '拒绝审核',
  72. classname: 'btn btn-xs btn-warning btn-view btn-ajax',
  73. icon: 'fa fa-times',
  74. url: 'massager/closing/check?id={id}&check=reject',
  75. visible: function (row) {
  76. return "checking" === row["status"];
  77. },
  78. refresh: true
  79. },
  80. {
  81. name: 'wallet',
  82. text: '查看明细',
  83. title: '查看明细',
  84. icon: 'fa fa-money',
  85. classname: 'btn btn-xs btn-primary btn-dialog',
  86. url: 'massager/closing/details'
  87. },
  88. ],
  89. events: Table.api.events.operate,
  90. formatter: Table.api.formatter.operate
  91. }
  92. ]
  93. ]
  94. });
  95. // 为表格绑定事件
  96. Table.api.bindevent(table);
  97. },
  98. add: function () {
  99. Controller.api.bindevent();
  100. },
  101. edit: function () {
  102. Controller.api.bindevent();
  103. },
  104. api: {
  105. bindevent: function () {
  106. Form.api.bindevent($("form[role=form]"));
  107. }
  108. }
  109. };
  110. return Controller;
  111. });