vipjifei.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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: 'vipjifei/index' + location.search,
  8. add_url: 'vipjifei/add',
  9. edit_url: 'vipjifei/edit',
  10. del_url: 'vipjifei/del',
  11. multi_url: 'vipjifei/multi',
  12. import_url: 'vipjifei/import',
  13. table: 'vip_jifei',
  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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'productcode', title: __('Productcode'), operate: 'LIKE'},
  29. {field: 'productprice', title: __('Productprice'), operate: 'LIKE'},
  30. {field: 'productunit', title: __('Productunit'), operate: 'LIKE'},
  31. {field: 'productcount', title: __('Productcount'), operate: 'LIKE'},
  32. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  33. {field: 'user_switch', title: __('User_switch'), searchList: {"1":__('Yes'),"0":__('No')}, table: table, formatter: Table.api.formatter.status},
  34. {field: 'pay_switch', title: __('Pay_switch'), searchList: {"1":__('Yes'),"0":__('No')}, table: table, formatter: Table.api.formatter.status},
  35. {field: 'weigh', title: __('Weigh'), operate: false},
  36. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  39. ]
  40. ]
  41. });
  42. // 为表格绑定事件
  43. Table.api.bindevent(table);
  44. },
  45. recyclebin: function () {
  46. // 初始化表格参数配置
  47. Table.api.init({
  48. extend: {
  49. 'dragsort_url': ''
  50. }
  51. });
  52. var table = $("#table");
  53. // 初始化表格
  54. table.bootstrapTable({
  55. url: 'vipjifei/recyclebin' + location.search,
  56. pk: 'id',
  57. sortName: 'id',
  58. columns: [
  59. [
  60. {checkbox: true},
  61. {field: 'id', title: __('Id')},
  62. {
  63. field: 'deletetime',
  64. title: __('Deletetime'),
  65. operate: 'RANGE',
  66. addclass: 'datetimerange',
  67. formatter: Table.api.formatter.datetime
  68. },
  69. {
  70. field: 'operate',
  71. width: '130px',
  72. title: __('Operate'),
  73. table: table,
  74. events: Table.api.events.operate,
  75. buttons: [
  76. {
  77. name: 'Restore',
  78. text: __('Restore'),
  79. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  80. icon: 'fa fa-rotate-left',
  81. url: 'vipjifei/restore',
  82. refresh: true
  83. },
  84. {
  85. name: 'Destroy',
  86. text: __('Destroy'),
  87. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  88. icon: 'fa fa-times',
  89. url: 'vipjifei/destroy',
  90. refresh: true
  91. }
  92. ],
  93. formatter: Table.api.formatter.operate
  94. }
  95. ]
  96. ]
  97. });
  98. // 为表格绑定事件
  99. Table.api.bindevent(table);
  100. },
  101. add: function () {
  102. Controller.api.bindevent();
  103. },
  104. edit: function () {
  105. Controller.api.bindevent();
  106. },
  107. api: {
  108. bindevent: function () {
  109. Form.api.bindevent($("form[role=form]"));
  110. }
  111. }
  112. };
  113. return Controller;
  114. });