visa.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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: 'massager/visa/index' + location.search,
  8. multi_url: 'massager/visa/multi',
  9. import_url: 'massager/visa/import',
  10. table: 'massager_visa',
  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. fixedColumns: true,
  20. fixedRightNumber: 1,
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. {field: 'massager_id', title: __('Massager_id')},
  26. {field: 'massager.name', title: __('Massager.name'), operate: 'LIKE'},
  27. {field: 'old_area_name', title: __('Old_area_code')},
  28. {field: 'new_area_name', title: __('New_area_code')},
  29. {field: 'description', title: __('Description'), operate: 'LIKE'},
  30. {
  31. field: 'status',
  32. title: __('Status'),
  33. searchList: {"default": __('Default'), "reject": __('Reject'), "pass": __('Pass')},
  34. formatter: Table.api.formatter.status
  35. },
  36. {
  37. field: 'updatetime',
  38. title: __('Updatetime'),
  39. operate: 'RANGE',
  40. addclass: 'datetimerange',
  41. autocomplete: false,
  42. formatter: Table.api.formatter.datetime
  43. },
  44. {
  45. field: 'operate',
  46. title: __('Operate'),
  47. table: table,
  48. buttons:[
  49. {
  50. name: 'check_pass',
  51. text: '',
  52. title: '通过审核',
  53. classname: 'btn btn-xs btn-success btn-view btn-ajax',
  54. icon: 'fa fa-check',
  55. url: 'massager/visa/check?id={id}&check=pass',
  56. visible: function (row) {
  57. return "default" === row["status"];
  58. },
  59. refresh: true
  60. },
  61. {
  62. name: 'check_reject',
  63. text: '',
  64. title: '拒绝审核',
  65. classname: 'btn btn-xs btn-warning btn-view btn-ajax',
  66. icon: 'fa fa-times',
  67. url: 'massager/visa/check?id={id}&check=reject',
  68. visible: function (row) {
  69. return "default" === row["status"];
  70. },
  71. refresh: true
  72. },
  73. ],
  74. events: Table.api.events.operate,
  75. formatter: Table.api.formatter.operate
  76. }
  77. ]
  78. ]
  79. });
  80. // 为表格绑定事件
  81. Table.api.bindevent(table);
  82. },
  83. add: function () {
  84. Controller.api.bindevent();
  85. },
  86. edit: function () {
  87. Controller.api.bindevent();
  88. },
  89. api: {
  90. bindevent: function () {
  91. Form.api.bindevent($("form[role=form]"));
  92. }
  93. }
  94. };
  95. return Controller;
  96. });