eyemarginp.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: 'applys/eyemarginp/index' + location.search,
  8. edit_url: 'applys/eyemarginp/edit',
  9. del_url: 'applys/eyemarginp/del',
  10. multi_url: 'applys/eyemarginp/multi',
  11. table: 'eyemargin',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. columns: [
  21. [
  22. {checkbox: true},
  23. {field: 'id', title: __('Id')},
  24. {field: 'user_id', title: __('User_id')},
  25. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  26. {field: 'eye_type', title: __('Eye_type'), searchList: {"1":__('Eye_type 1'),"2":__('Eye_type 2')}, formatter: Table.api.formatter.normal},
  27. {field: 'content', title: __('Content'), operate: 'LIKE'},
  28. {field: 'cover', title: __('Cover'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image,
  29. cellStyle: {css: {
  30. "line-height": "64px",
  31. }
  32. }
  33. },
  34. {field: 'album', title: __('Album'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.images},
  35. {field: 'city', title: __('城市'), operate: 'LIKE'},
  36. {field: 'is_main', title: __('Is_main'), searchList: {"1":__('Is_main 1'),"0":__('Is_main 0')}, formatter: Table.api.formatter.normal},
  37. {field: 'status', title: __('Status'), searchList: {"-1":__('Status -1'),"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
  38. {field: 'weight', title: __('Weight')},
  39. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  41. ]
  42. ]
  43. });
  44. // 为表格绑定事件
  45. Table.api.bindevent(table);
  46. },
  47. add: function () {
  48. Controller.api.bindevent();
  49. },
  50. edit: function () {
  51. Controller.api.bindevent();
  52. },
  53. api: {
  54. bindevent: function () {
  55. Form.api.bindevent($("form[role=form]"));
  56. }
  57. }
  58. };
  59. return Controller;
  60. });