comment.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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: 'service/order/comment/index' + location.search,
  8. del_url: 'service/order/comment/del',
  9. multi_url: 'service/order/comment/multi',
  10. import_url: 'service/order/comment/import',
  11. table: 'service_comment',
  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. fixedColumns: true,
  21. fixedRightNumber: 1,
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. //{field: 'user_id', title: __('User_id')},
  27. {field: 'user.nickname', title: __('Nickname'),operate: false},
  28. {field: 'skill.name', title: __('Skillname'),operate: false},
  29. {field: 'shop.name', title: __('Shopname'),operate: false},
  30. {field: 'order_id', title: __('Order_id')},
  31. // {field: 'skill_id', title: __('Skill_id')},
  32. // {field: 'shop_id', title: __('Shop_id')},
  33. {field: 'goodsname', title: __('Goodsname')},
  34. {field: 'score', title: __('Score')},
  35. {field: 'comment_label', title: __('Comment_label'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  36. {field: 'content', title: __('Content'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  37. {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  38. {field: 'state', title: __('State'), searchList: {"0":__('State 0'),"1":__('State 1')}, formatter: Table.api.formatter.normal},
  39. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  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. });