useridconfirm.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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: 'useridconfirm/index' + location.search,
  8. add_url: 'useridconfirm/add',
  9. //edit_url: 'useridconfirm/edit',
  10. //del_url: 'useridconfirm/del',
  11. multi_url: 'useridconfirm/multi',
  12. import_url: 'useridconfirm/import',
  13. table: 'user_idconfirm',
  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. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'user_id', title: __('User_id')},
  27. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  28. {field: 'truename', title: __('Truename'), operate: 'LIKE'},
  29. {field: 'idcard', title: __('Idcard'), operate: 'LIKE'},
  30. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
  31. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  32. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  33. {field: 'operate', title: __('Operate'), table: table,
  34. buttons:[
  35. {
  36. name:'audit',
  37. text:'取消实名',
  38. title:'取消实名',
  39. icon:'fa fa-exclamation-circle',
  40. classname:'btn btn-xs btn-danger btn-ajax',
  41. url:'Useridconfirm/audit/id/{ids}/status/3',
  42. target:'_self',
  43. refresh:true,
  44. hidden:function($row){
  45. if($row.status == 1){
  46. return false;
  47. }
  48. return true;
  49. }
  50. },
  51. {
  52. name:'audit',
  53. text:'恢复实名',
  54. title:'恢复实名',
  55. icon:'fa fa-exclamation-circle',
  56. classname:'btn btn-xs btn-success btn-ajax',
  57. url:'Useridconfirm/audit/id/{ids}/status/1',
  58. target:'_self',
  59. refresh:true,
  60. hidden:function($row){
  61. if($row.status == 3){
  62. return false;
  63. }
  64. return true;
  65. }
  66. },
  67. ],
  68. events: Table.api.events.operate, formatter: Table.api.formatter.operate
  69. }
  70. ]
  71. ]
  72. });
  73. // 为表格绑定事件
  74. Table.api.bindevent(table);
  75. },
  76. add: function () {
  77. Controller.api.bindevent();
  78. },
  79. edit: function () {
  80. Controller.api.bindevent();
  81. },
  82. audit: function () {
  83. Controller.api.bindevent();
  84. },
  85. api: {
  86. bindevent: function () {
  87. Form.api.bindevent($("form[role=form]"));
  88. }
  89. }
  90. };
  91. return Controller;
  92. });