orderkouya.js 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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: 'orderkouya/index' + location.search,
  8. add_url: 'orderkouya/add',
  9. // edit_url: 'orderkouya/edit',
  10. // del_url: 'orderkouya/del',
  11. multi_url: 'orderkouya/multi',
  12. import_url: 'orderkouya/import',
  13. table: 'order_kouya',
  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: 'order_id', title: __('Order_id')},
  29. {field: 'orderno', title: __('Orderno'), operate: 'LIKE'},
  30. {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3'),"4":__('Type 4'),"5":__('Type 5')}, formatter: Table.api.formatter.normal},
  31. {field: 'company_id', title: __('Company_id')},
  32. {field: 'company.name', title: __('Company.name'), operate: 'LIKE'},
  33. // {field: 'user_id', title: __('User_id')},
  34. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  35. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  36. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  37. {field: 'remark', title: __('Remark'), operate:false},
  38. {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  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: 'audit_status', title: __('Audit_status'), searchList: {"0":__('Audit_status 0'),"1":__('Audit_status 1'),"2":__('Audit_status 2')}, formatter: Table.api.formatter.status},
  42. {field: 'audittime', title: __('Audittime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'auditremark', title: __('Auditremark'), operate: 'LIKE'},
  44. {field: 'operate', title: __('Operate'), table: table,
  45. buttons:[
  46. {
  47. name:'audit',
  48. text:'审核',
  49. title:'审核',
  50. icon:'fa fa-exclamation-circle',
  51. classname:'btn btn-xs btn-info btn-dialog',
  52. url:'orderkouya/audit/id/{ids}?dialog=1',
  53. target:'_self',
  54. hidden:function(row){
  55. return row.audit_status == 0 ? false : true;
  56. }
  57. }
  58. ],
  59. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  60. ]
  61. ]
  62. });
  63. // 为表格绑定事件
  64. Table.api.bindevent(table);
  65. },
  66. add: function () {
  67. Controller.api.bindevent();
  68. },
  69. edit: function () {
  70. Controller.api.bindevent();
  71. },
  72. audit: function () {
  73. Controller.api.bindevent();
  74. },
  75. api: {
  76. bindevent: function () {
  77. Form.api.bindevent($("form[role=form]"));
  78. }
  79. }
  80. };
  81. return Controller;
  82. });