companycomment.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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: 'companycomment/index' + location.search,
  8. add_url: 'companycomment/add',
  9. // edit_url: 'companycomment/edit',
  10. del_url: 'companycomment/del',
  11. multi_url: 'companycomment/multi',
  12. import_url: 'companycomment/import',
  13. table: 'company_comment',
  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. search:false,
  23. columns: [
  24. [
  25. {checkbox: true},
  26. {field: 'id', title: __('Id')},
  27. // {field: 'user_id', title: __('User_id')},
  28. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  29. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  30. {field: 'company_id', title: __('Company_id')},
  31. {field: 'company.name', title: __('Company.name'), operate: 'LIKE'},
  32. {field: 'info', title: __('Info'), operate: 'LIKE'},
  33. {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  34. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  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. },
  42. add: function () {
  43. Controller.api.bindevent();
  44. },
  45. edit: function () {
  46. Controller.api.bindevent();
  47. },
  48. api: {
  49. bindevent: function () {
  50. Form.api.bindevent($("form[role=form]"));
  51. }
  52. }
  53. };
  54. return Controller;
  55. });