thebus_config.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $(".btn-add").data("area",["100px","320px"]);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'thebus_config/index' + location.search,
  9. add_url: 'thebus_config/add',
  10. edit_url: 'thebus_config/edit',
  11. del_url: 'thebus_config/del',
  12. multi_url: 'thebus_config/multi',
  13. import_url: 'thebus_config/import',
  14. table: 'thebus_config',
  15. }
  16. });
  17. var table = $("#table");
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. columns: [
  24. [
  25. {checkbox: true},
  26. {field: 'id', title: __('Id')},
  27. {field: 'people_type', title: __('People_type'), operate: 'LIKE'},
  28. {field: 'auth_auto_open', title: __('Auth_auto_open')},
  29. {field: 'car_auto_back', title: __('Car_auto_back')},
  30. {field: 'noauth_open', title: __('Noauth_open')},
  31. {field: 'time1', title: __('Time1')},
  32. {field: 'time2', title: __('Time2')},
  33. {field: 'default_unit_id', title: __('Default_unit_id')},
  34. {field: 'default_people_id', title: __('Default_people_id')},
  35. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  36. ]
  37. ]
  38. });
  39. // 为表格绑定事件
  40. Table.api.bindevent(table);
  41. table.on('post-body.bs.table',function(){
  42. $(".btn-editone").data("area",["500px","400px"]);
  43. })
  44. },
  45. add: function () {
  46. Controller.api.bindevent();
  47. },
  48. edit: function () {
  49. Controller.api.bindevent();
  50. $("#c-default_people_id").data("params", function (obj) {
  51. var unit_id = $('#J_unitselect').val();
  52. return {
  53. "custom[unit_id][0]": "in",
  54. "custom[unit_id][1]": unit_id
  55. };
  56. });
  57. },
  58. api: {
  59. bindevent: function () {
  60. Form.api.bindevent($("form[role=form]"));
  61. }
  62. }
  63. };
  64. return Controller;
  65. });