duty_outfit.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. $(".btn-add").data("area", ["768px", "410px"]);
  6. Table.api.init({
  7. extend: {
  8. index_url: 'duty_outfit/index' + location.search,
  9. add_url: 'duty_outfit/add',
  10. edit_url: 'duty_outfit/edit',
  11. del_url: 'duty_outfit/del',
  12. multi_url: 'duty_outfit/multi',
  13. import_url: 'duty_outfit/import',
  14. table: 'duty_outfit',
  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: 'zbbz', title: __('Zbbz')},
  28. {field: 'zbsy', title: __('Zbsy')},
  29. {field: 'zbky', title: __('Zbky')},
  30. {field: 'sjpt', title: __('Sjpt')},
  31. {field: 'bzpt', title: __('Bzpt')},
  32. {field: 'cczb', title: __('Cczb')},
  33. {field: 'zbcd', title: __('Zbcd')},
  34. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  35. ]
  36. ]
  37. });
  38. // 为表格绑定事件
  39. Table.api.bindevent(table);
  40. table.on('post-body.bs.table', function () {
  41. $(".btn-editone").data("area", ["768px", "410px"]);
  42. })
  43. },
  44. add: function () {
  45. Controller.api.bindevent();
  46. },
  47. edit: function () {
  48. Controller.api.bindevent();
  49. },
  50. api: {
  51. bindevent: function () {
  52. Form.api.bindevent($("form[role=form]"));
  53. }
  54. }
  55. };
  56. return Controller;
  57. });