bill.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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: 'profit/bill/index' + location.search,
  8. edit_url: 'profit/bill/edit',
  9. multi_url: 'profit/bill/multi',
  10. import_url: 'profit/bill/import',
  11. table: 'profit_bill',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. fixedColumns: true,
  21. fixedRightNumber: 1,
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {
  26. field: 'identity_type',
  27. title: __('Identity_type'),
  28. searchList: {
  29. "platform": __('Platform'),
  30. "agency": __('Agency'),
  31. "store": __('Store'),
  32. "massager": __('Massager'),
  33. "user": __("用户")
  34. },
  35. formatter: Table.api.formatter.normal
  36. },
  37. {field: 'target_id', title: __('Target_id')},
  38. {field: 'target_name', title: __('Target_name'), operate: 'LIKE'},
  39. {
  40. field: 'change_type',
  41. title: __('Change_type'),
  42. searchList: {
  43. "profit": __('Profit'),
  44. "drawings": __('Drawings'),
  45. "closing_expend": "结算支出",
  46. "closing_income": "结算收入",
  47. "channel_expend": "渠道支出",
  48. "channel_income": "渠道收入"
  49. },
  50. formatter: Table.api.formatter.normal
  51. },
  52. {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
  53. {field: 'total_amount', title: __('Total_amount'), operate: 'BETWEEN'},
  54. {field: 'rate', title: __('Rate'), operate: 'BETWEEN'},
  55. {field: 'change', title: __('Change'), operate: 'BETWEEN'},
  56. {field: 'before', title: __('Before'), operate: 'BETWEEN'},
  57. {field: 'after', title: __('After'), operate: 'BETWEEN'},
  58. {
  59. field: 'createtime',
  60. title: __('Createtime'),
  61. operate: 'RANGE',
  62. addclass: 'datetimerange',
  63. autocomplete: false,
  64. formatter: Table.api.formatter.datetime
  65. },
  66. {
  67. field: 'city_code',
  68. title: __('区域'),
  69. searchList: Config.allow_areas,
  70. visible: false
  71. },
  72. {
  73. field: 'operate',
  74. title: __('Operate'),
  75. table: table,
  76. events: Table.api.events.operate,
  77. formatter: Table.api.formatter.operate
  78. }
  79. ]
  80. ]
  81. });
  82. // 为表格绑定事件
  83. Table.api.bindevent(table);
  84. },
  85. add: function () {
  86. Controller.api.bindevent();
  87. },
  88. edit: function () {
  89. Controller.api.bindevent();
  90. },
  91. api: {
  92. bindevent: function () {
  93. Form.api.bindevent($("form[role=form]"));
  94. }
  95. }
  96. };
  97. return Controller;
  98. });