packagemove.js 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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: 'packagemove/index' + location.search,
  8. add_url: 'packagemove/add',
  9. // edit_url: 'packagemove/edit',
  10. // del_url: 'packagemove/del',
  11. multi_url: 'packagemove/multi',
  12. import_url: 'packagemove/import',
  13. table: 'package_move',
  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: 'usera.firstname', title: __('Usera.firstname'), operate: 'LIKE'},
  30. // {field: 'usera.lastname', title: __('Usera.lastname'), operate: 'LIKE'},
  31. {field: 'name', title: __('Name'), operate: 'LIKE'},
  32. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  33. {field: 'email', title: __('Email'), operate: 'LIKE'},
  34. {field: 'reason', title: __('Reason'), operate: 'LIKE'},
  35. // {field: 'reason_files', title: __('Reason_files'), operate: false, formatter: Table.api.formatter.files},
  36. {field: 'package_order_id', title: __('Package_order_id')},
  37. {field: 'order.order_no', title: __('Order.order_no'), operate: 'LIKE'},
  38. {field: 'sessions', title: __('Sessions')},
  39. {field: 'to_name', title: __('To_name'), operate: 'LIKE'},
  40. {field: 'to_mobile', title: __('To_mobile'), operate: 'LIKE'},
  41. {field: 'to_email', title: __('To_email'), operate: 'LIKE'},
  42. {field: 'to_user_id', title: __('To_user_id')},
  43. /*{field: 'userb.firstname', title: __('Userb.firstname'), operate: 'LIKE'},
  44. {field: 'userb.lastname', title: __('Userb.lastname'), operate: 'LIKE'},*/
  45. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  46. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  47. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  48. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
  49. {field: 'audittime', title: __('Audittime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. {field: 'auditremark', title: __('Auditremark'), operate: 'LIKE'},
  51. {field: 'operate', title: __('Operate'), table: table,
  52. buttons:[
  53. {
  54. name:'audit',
  55. text:'审核',
  56. title:'审核',
  57. icon:'fa fa-exclamation-circle',
  58. classname:'btn btn-xs btn-info btn-dialog',
  59. url:'packagemove/audit/id/{ids}?dialog=1',
  60. target:'_self',
  61. refresh:true,
  62. hidden:function(row){
  63. return row.status==0 ? false : true;
  64. }
  65. }
  66. ],
  67. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  68. ]
  69. ]
  70. });
  71. // 为表格绑定事件
  72. Table.api.bindevent(table);
  73. },
  74. add: function () {
  75. Controller.api.bindevent();
  76. },
  77. edit: function () {
  78. Controller.api.bindevent();
  79. },
  80. audit: function () {
  81. Controller.api.bindevent();
  82. },
  83. api: {
  84. bindevent: function () {
  85. Form.api.bindevent($("form[role=form]"));
  86. }
  87. }
  88. };
  89. return Controller;
  90. });