shenqing.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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: 'shenqing/index' + location.search,
  8. add_url: 'shenqing/add',
  9. edit_url: 'shenqing/edit',
  10. del_url: 'shenqing/del',
  11. multi_url: 'shenqing/multi',
  12. import_url: 'shenqing/import',
  13. table: 'gg_shenqing',
  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: 'uid', title: __('Uid')},
  32. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  33. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  34. {field: 'name', title: __('Name'), operate: 'LIKE'},
  35. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  36. {field: 'notice', title: __('Notice')},
  37. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  38. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  39. ]
  40. ]
  41. });
  42. // 为表格绑定事件
  43. Table.api.bindevent(table);
  44. },
  45. add: function () {
  46. Controller.api.bindevent();
  47. },
  48. edit: function () {
  49. Controller.api.bindevent();
  50. },
  51. api: {
  52. bindevent: function () {
  53. Form.api.bindevent($("form[role=form]"));
  54. }
  55. }
  56. };
  57. return Controller;
  58. });