capacity_load.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. Table.api.init({
  5. extend: {
  6. index_url: 'capacity_load/index' + location.search,
  7. add_url: 'capacity_load/add',
  8. edit_url: 'capacity_load/edit',
  9. del_url: 'capacity_load/del',
  10. multi_url: 'capacity_load/multi',
  11. table: 'capacity_load'
  12. }
  13. });
  14. var table = $('#table');
  15. table.bootstrapTable({
  16. url: $.fn.bootstrapTable.defaults.extend.index_url,
  17. pk: 'id',
  18. sortName: 'weigh',
  19. columns: [[
  20. {checkbox: true},
  21. {field: 'id', title: __('Id')},
  22. {field: 'name', title: __('Name'), operate: 'LIKE'},
  23. {field: 'capacity', title: __('Capacity'), operate: 'LIKE'},
  24. {field: 'percentage', title: __('Percentage'), operate: false, formatter: function (value) { return value + '%'; }},
  25. {field: 'weigh', title: __('Weigh'), operate: false},
  26. {field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
  27. {field: 'updatetime', title: __('Updatetime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
  28. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  29. ]]
  30. });
  31. Table.api.bindevent(table);
  32. },
  33. add: function () {
  34. Controller.api.bindevent();
  35. },
  36. edit: function () {
  37. Controller.api.bindevent();
  38. },
  39. api: {
  40. bindevent: function () {
  41. Form.api.bindevent($('form[role=form]'));
  42. }
  43. }
  44. };
  45. return Controller;
  46. });