order.js 3.3 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: 'dispatch/order/index' + location.search,
  8. edit_url: 'dispatch/order/edit',
  9. multi_url: 'dispatch/order/multi',
  10. table: 'dispatch_order',
  11. }
  12. });
  13. var table = $("#table");
  14. // 初始化表格
  15. table.bootstrapTable({
  16. url: $.fn.bootstrapTable.defaults.extend.index_url,
  17. pk: 'id',
  18. sortName: 'id',
  19. columns: [
  20. [
  21. {checkbox: true},
  22. {field: 'id', title: __('Id')},
  23. {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
  24. {field: 'recive.u_id', title: __('Recive.u_id')},
  25. {field: 'recive.nickname', title: __('Recive.nickname'), operate: 'LIKE'},
  26. {field: 'user.u_id', title: __('User.u_id')},
  27. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  28. {field: 'price', title: __('Price')},
  29. {field: 'num', title: __('Num')},
  30. {field: 'skill_image', title: __('Skill_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  31. {field: 'skill_name', title: __('Skill_name'), operate: 'LIKE'},
  32. {field: 'skill_unit', title: __('Skill_unit'), operate: 'LIKE'},
  33. {field: 'make_time', title: __('预约时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  34. {field: 'describe', title: __('Describe'), operate: 'LIKE'},
  35. //{field: 'is_comment', title: __('Is_comment'), searchList: {"1":__('Is_comment 1'),"0":__('Is_comment 0')}, formatter: Table.api.formatter.normal},
  36. {field: 'status', title: __('Status'), searchList: {"-2":__('Status -2'),"-1":__('Status -1'),"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  37. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  40. ]
  41. ]
  42. });
  43. // 为表格绑定事件
  44. Table.api.bindevent(table);
  45. },
  46. add: function () {
  47. Controller.api.bindevent();
  48. },
  49. edit: function () {
  50. Controller.api.bindevent();
  51. },
  52. api: {
  53. bindevent: function () {
  54. Form.api.bindevent($("form[role=form]"));
  55. }
  56. }
  57. };
  58. return Controller;
  59. });