agency.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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: 'agency/index' + location.search,
  8. // add_url: 'agency/add',
  9. edit_url: 'agency/edit',
  10. del_url: 'agency/del',
  11. multi_url: 'agency/multi',
  12. import_url: 'agency/import',
  13. table: 'agency',
  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: 'name', title: __('Name'), operate: 'LIKE'},
  29. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  30. {field: 'id_card', title: __('Id_card'), operate: 'LIKE'},
  31. {field: 'id_card', title: __('Id_card'), operate: 'LIKE'},
  32. {field: 'budget', title: __('投资预算'), operate: 'LIKE'},
  33. {
  34. field: 'license_images',
  35. title: __('License_images'),
  36. operate: false,
  37. events: Table.api.events.image,
  38. formatter: Table.api.formatter.images
  39. },
  40. {
  41. field: 'status',
  42. title: __('Status'),
  43. searchList: {"process": __('Process'), "reject": __('Reject'), "allow": __('Allow')},
  44. formatter: Table.api.formatter.status
  45. },
  46. {
  47. field: 'updatetime',
  48. title: __('Updatetime'),
  49. operate: 'RANGE',
  50. addclass: 'datetimerange',
  51. autocomplete: false,
  52. formatter: Table.api.formatter.datetime
  53. },
  54. {
  55. field: 'operate',
  56. title: __('Operate'),
  57. table: table,
  58. buttons: [
  59. {
  60. name: 'check_pass',
  61. text: '',
  62. title: '通过审核',
  63. classname: 'btn btn-xs btn-success btn-view btn-ajax',
  64. icon: 'fa fa-check',
  65. url: 'agency/check?id={id}&check=pass',
  66. visible: function (row) {
  67. return "default" === row["status"];
  68. },
  69. refresh: true
  70. },
  71. {
  72. name: 'check_reject',
  73. text: '',
  74. title: '拒绝审核',
  75. classname: 'btn btn-xs btn-warning btn-view btn-ajax',
  76. icon: 'fa fa-times',
  77. url: 'agency/check?id={id}&check=reject',
  78. visible: function (row) {
  79. return "default" === row["status"];
  80. },
  81. refresh: true
  82. },
  83. ],
  84. events: Table.api.events.operate,
  85. formatter: Table.api.formatter.operate
  86. }
  87. ]
  88. ]
  89. });
  90. // 为表格绑定事件
  91. Table.api.bindevent(table);
  92. },
  93. add: function () {
  94. Controller.api.bindevent();
  95. },
  96. edit: function () {
  97. Controller.api.bindevent();
  98. },
  99. api: {
  100. bindevent: function () {
  101. Form.api.bindevent($("form[role=form]"));
  102. }
  103. }
  104. };
  105. return Controller;
  106. });