mobile.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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: 'mobile/index' + location.search,
  8. add_url: 'mobile/add',
  9. edit_url: 'mobile/edit',
  10. del_url: 'mobile/del',
  11. multi_url: 'mobile/multi',
  12. import_url: 'mobile/import',
  13. table: 'mobile',
  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: 'name', title: __('Name')},
  27. {field: 'no', title: __('No')},
  28. {field: 'type', title: __('Type')},
  29. {field: 'network', title: __('Network')},
  30. {field: 'city', title: __('City')},
  31. {field: 'province', title: __('Province')},
  32. {field: 'amount_exists', title: __('Amount_exists'), operate:'BETWEEN'},
  33. {field: 'amount_original', title: __('Amount_original'), operate:'BETWEEN'},
  34. {field: 'amount_base', title: __('Amount_base'), operate:'BETWEEN'},
  35. {field: 'amount_charge', title: __('Amount_charge'), operate:'BETWEEN'},
  36. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  37. {field: 'update_time', title: __('Update_time')},
  38. {field: 'top_time', title: __('Top_time')},
  39. {field: 'rec_time', title: __('Rec_time')},
  40. {field: 'summary', title: __('Summary')},
  41. {field: 'saled', title: __('Saled')},
  42. {field: 'is_activity', title: __('Is_activity')},
  43. {field: 'is_hold', title: __('预占'),formatter: Table.api.formatter.toggle},
  44. {field: 'activity_time_end', title: __('Activity_time_end'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  45. {field: 'sort', title: __('Sort')},
  46. //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate},
  47. ]
  48. ]
  49. });
  50. // 为表格绑定事件
  51. Table.api.bindevent(table);
  52. },
  53. add: function () {
  54. Controller.api.bindevent();
  55. },
  56. edit: function () {
  57. Controller.api.bindevent();
  58. },
  59. api: {
  60. bindevent: function () {
  61. Form.api.bindevent($("form[role=form]"));
  62. }
  63. }
  64. };
  65. return Controller;
  66. });