lists.js 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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: 'office/lists/index' + location.search,
  8. add_url: 'office/lists/add',
  9. edit_url: 'office/lists/edit',
  10. del_url: 'office/lists/del',
  11. multi_url: 'office/lists/multi',
  12. import_url: 'office/lists/import',
  13. table: 'office_lists',
  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. showExport:false,
  23. // commonSearch:false,
  24. search:false,
  25. columns: [
  26. [
  27. {checkbox: true},
  28. {field:'id', title: __('序号'),formatter: function(value, row, index){return ++index;}, operate: false},
  29. {field: 'city.name', title: __('City.name'), operate: false},
  30. {field: 'parklists.name', title: __('Parklists.name'), operate: false},
  31. {
  32. field: 'c_id', title: __('联动搜索'), searchList: function (column) {
  33. return Template('categorytpl', {});
  34. }, formatter: function (value, row, index) {
  35. return '无';
  36. }, visible: false
  37. },
  38. {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  39. {field: 'title', title: __('Title'), operate: 'LIKE'},
  40. // {field: 'money', title: __('Money')},
  41. // {field: 'wuye', title: __('Wuye')},
  42. // {field: 'mianji', title: __('Mianji')},
  43. {field: 'banner_images', title: __('Banner_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  44. {field: 'address', title: __('Address'), operate: 'LIKE'},
  45. // {field: 'fangxing', title: __('Fangxing')},
  46. {field: 'louceng', title: __('Louceng')},
  47. {field: 'num', title: __('座位')},
  48. // {field: 'riqi', title: __('Riqi')},
  49. // {field: 'congtent', title: __('Congtent')},
  50. // {field: 'jiaotong', title: __('Jiaotong')},
  51. // {field: 'tingche', title: __('Tingche')},
  52. // {field: 'wangluo', title: __('Wangluo'), operate: 'LIKE'},
  53. // {field: 'fuwu', title: __('Fuwu'), operate: 'LIKE'},
  54. // {field: 'canyin', title: __('Canyin'), operate: 'LIKE'},
  55. // {field: 'shebei', title: __('Shebei'), operate: 'LIKE'},
  56. // {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  57. {field: 'switch', title: __('Switch'), table: table, formatter: Table.api.formatter.toggle, operate: false},
  58. {field: 'sort', title: __('Sort')},
  59. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  60. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  61. ]
  62. ]
  63. });
  64. // 为表格绑定事件
  65. Table.api.bindevent(table);
  66. },
  67. add: function () {
  68. Controller.api.bindevent();
  69. },
  70. edit: function () {
  71. Controller.api.bindevent();
  72. },
  73. api: {
  74. bindevent: function () {
  75. Form.api.bindevent($("form[role=form]"));
  76. }
  77. }
  78. };
  79. return Controller;
  80. });