log.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'qingdong/customer/log/index',
  8. table: 'log'
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. sortName: 'id',
  16. columns: [
  17. [
  18. {field: 'state', checkbox: true},
  19. {field: 'staff.name', title: __('员工'),operate:false},
  20. {field: 'content', title: __('跟进内容')},
  21. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  22. ]
  23. ],
  24. //启用普通表单搜索
  25. commonSearch: true,
  26. searchFormVisible: true,
  27. onLoadSuccess:function(){
  28. // 这里就是数据渲染结束后的回调函数
  29. $(".btn-add").data("area",["80%","80%"]);
  30. $(".btn-edit").data("area",["80%","80%"]);
  31. }
  32. });
  33. // 为表格绑定事件
  34. Table.api.bindevent(table);
  35. $('.search').hide();
  36. $('.btn-import').hide();
  37. },
  38. add: function () {
  39. Controller.api.bindevent();
  40. },
  41. edit: function () {
  42. Controller.api.bindevent();
  43. },
  44. api: {
  45. bindevent: function () {
  46. Form.api.bindevent($("form[role=form]"));
  47. },
  48. formatter: {
  49. }
  50. }
  51. };
  52. return Controller;
  53. });