depart.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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: 'csmadmin/depart/index' + location.search,
  8. add_url: 'csmadmin/depart/add',
  9. edit_url: 'csmadmin/depart/edit',
  10. del_url: 'csmadmin/depart/del',
  11. multi_url: 'csmadmin/depart/multi',
  12. table: 'csmadmin_depart',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'weigh',
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. {field: 'departhead_id', title: __('Departhead_id')},
  26. {field: 'parent_id', title: __('Parent_id')},
  27. {field: 'name', title: __('Name')},
  28. {field: 'description', title: __('Description')},
  29. {field: 'weigh', title: __('Weigh')},
  30. {field: 'fromuuid', title: __('Fromuuid')},
  31. {field: 'fromsys', title: __('Fromsys'), searchList: {"dd":__('Fromsys dd'),"wx":__('Fromsys wx'),"fs":__('Fromsys fs')}, formatter: Table.api.formatter.normal},
  32. {field: 'status', title: __('Status'), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status},
  33. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  34. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  35. {field: 'b4', title: __('B4')},
  36. {field: 'b5', title: __('B5')},
  37. {field: 'b6', title: __('B6')},
  38. {field: 'b7', title: __('B7')},
  39. {field: 'b8', title: __('B8')},
  40. {field: 'b9', title: __('B9')},
  41. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  42. ]
  43. ]
  44. });
  45. // 为表格绑定事件
  46. Table.api.bindevent(table);
  47. },
  48. add: function () {
  49. Controller.api.bindevent();
  50. },
  51. edit: function () {
  52. Controller.api.bindevent();
  53. },
  54. api: {
  55. bindevent: function () {
  56. Form.api.bindevent($("form[role=form]"));
  57. }
  58. }
  59. };
  60. return Controller;
  61. });