order.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: 'order/index' + location.search,
  8. add_url: 'order/add',
  9. edit_url: 'order/edit',
  10. del_url: 'order/del',
  11. multi_url: 'order/multi',
  12. import_url: 'order/import',
  13. table: 'order',
  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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. // {field: 'user_id', title: __('User_id')},
  29. {field: 'no', title: __('No'), operate: 'LIKE'},
  30. {field: 'customer', title: __('Customer'), operate: 'LIKE'},
  31. {field: 'product', title: __('Product'), operate: 'LIKE'},
  32. {field: 'specs', title: __('Specs'), operate: 'LIKE'},
  33. {field: 'unit', title: __('Unit'), operate: 'LIKE'},
  34. {field: 'number', title: __('Number')},
  35. {field: 'price', title: __('Price'), operate: 'LIKE'},
  36. {field: 'delivery_date', title: __('Delivery_date'), operate: 'LIKE'},
  37. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  38. {field: 'date', title: __('Date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  39. {field: 'user_name', title: __('User_name'), operate: 'LIKE'},
  40. {field: 'examine', title: __('Examine'), operate: 'LIKE'},
  41. {field: 'status', title: __('Status'), searchList: {"1":__('计划中'),"2":__('生产中'),"3":__('已完成')}, formatter: Table.api.formatter.status},
  42. // {field: 'create', title: __('Create'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  43. // {field: 'update', title: __('Update'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  44. // {field: 'company_id', title: __('Company_id')},
  45. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  46. ]
  47. ]
  48. });
  49. // 为表格绑定事件
  50. Table.api.bindevent(table);
  51. },
  52. add: function () {
  53. Controller.api.bindevent();
  54. },
  55. edit: function () {
  56. Controller.api.bindevent();
  57. },
  58. api: {
  59. bindevent: function () {
  60. Form.api.bindevent($("form[role=form]"));
  61. }
  62. }
  63. };
  64. return Controller;
  65. });