goods_order.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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: 'goods_order/index' + location.search,
  8. add_url: 'goods_order/add',
  9. edit_url: 'goods_order/edit',
  10. del_url: 'goods_order/del',
  11. multi_url: 'goods_order/multi',
  12. import_url: 'goods_order/import',
  13. table: 'goods_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: 'category_name', title: __('Category_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  29. {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  30. {field: 'little_image', title: __('Little_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  31. {field: 'describe', title: __('Describe'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  32. {field: 'dynamic', title: __('Dynamic'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  33. {field: 'dynamic_neme', title: __('Dynamic_neme'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  34. {field: 'price', title: __('Price'), operate:'BETWEEN'},
  35. {field: 'num', title: __('Num')},
  36. {field: 'total_price', title: __('Total_price'), operate:'BETWEEN'},
  37. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'contact_name', title: __('Contact_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  39. {field: 'contact_phone', title: __('Contact_phone'), operate: 'LIKE'},
  40. {field: 'handle', title: __('Handle'), searchList: {"1":__('Handle 1'),"2":__('Handle 2')}, formatter: Table.api.formatter.normal},
  41. {field: 'remarks', title: __('Remarks'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  42. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  43. ]
  44. ]
  45. });
  46. // 为表格绑定事件
  47. Table.api.bindevent(table);
  48. },
  49. recyclebin: function () {
  50. // 初始化表格参数配置
  51. Table.api.init({
  52. extend: {
  53. 'dragsort_url': ''
  54. }
  55. });
  56. var table = $("#table");
  57. // 初始化表格
  58. table.bootstrapTable({
  59. url: 'goods_order/recyclebin' + location.search,
  60. pk: 'id',
  61. sortName: 'id',
  62. columns: [
  63. [
  64. {checkbox: true},
  65. {field: 'id', title: __('Id')},
  66. {field: 'title', title: __('Title'), align: 'left'},
  67. {
  68. field: 'deletetime',
  69. title: __('Deletetime'),
  70. operate: 'RANGE',
  71. addclass: 'datetimerange',
  72. formatter: Table.api.formatter.datetime
  73. },
  74. {
  75. field: 'operate',
  76. width: '140px',
  77. title: __('Operate'),
  78. table: table,
  79. events: Table.api.events.operate,
  80. buttons: [
  81. {
  82. name: 'Restore',
  83. text: __('Restore'),
  84. classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
  85. icon: 'fa fa-rotate-left',
  86. url: 'goods_order/restore',
  87. refresh: true
  88. },
  89. {
  90. name: 'Destroy',
  91. text: __('Destroy'),
  92. classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
  93. icon: 'fa fa-times',
  94. url: 'goods_order/destroy',
  95. refresh: true
  96. }
  97. ],
  98. formatter: Table.api.formatter.operate
  99. }
  100. ]
  101. ]
  102. });
  103. // 为表格绑定事件
  104. Table.api.bindevent(table);
  105. },
  106. add: function () {
  107. Controller.api.bindevent();
  108. },
  109. edit: function () {
  110. Controller.api.bindevent();
  111. },
  112. api: {
  113. bindevent: function () {
  114. Form.api.bindevent($("form[role=form]"));
  115. }
  116. }
  117. };
  118. return Controller;
  119. });