officeorder.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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: 'officeorder/index' + location.search,
  8. add_url: 'officeorder/add',
  9. edit_url: 'officeorder/edit',
  10. del_url: 'officeorder/del',
  11. multi_url: 'officeorder/multi',
  12. import_url: 'officeorder/import',
  13. table: 'office_order',
  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. // commonSearch:false,
  23. showExport:false,
  24. // search:false,
  25. columns: [
  26. [
  27. {checkbox: true},
  28. {field:'id', title: __('序号'),formatter: function(value, row, index){
  29. return ++index;
  30. }, operate: false},
  31. {field: 'number', title: __('Number')},
  32. {field: 'name', title: __('Name'), operate: 'LIKE'},
  33. {field: 'phone', title: __('Phone'), operate: 'LIKE'},
  34. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  35. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  36. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  37. {field: 'officelists.image', title: __('Officelists.image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  38. {field: 'officelists.title', title: __('Officelists.title'), operate: 'LIKE'},
  39. {field: 'officelists.money', title: __('Officelists.money')},
  40. {field: 'officelists.wuye', title: __('Officelists.wuye')},
  41. {field: 'officelists.mianji', title: __('Officelists.mianji')},
  42. {field: 'officelists.banner_images', title: __('Officelists.banner_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  43. {field: 'officelists.address', title: __('Officelists.address'), operate: 'LIKE'},
  44. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  45. ]
  46. ]
  47. });
  48. // 为表格绑定事件
  49. Table.api.bindevent(table);
  50. },
  51. add: function () {
  52. Controller.api.bindevent();
  53. },
  54. edit: function () {
  55. Controller.api.bindevent();
  56. },
  57. api: {
  58. bindevent: function () {
  59. Form.api.bindevent($("form[role=form]"));
  60. }
  61. }
  62. };
  63. return Controller;
  64. });