password.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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: 'vip/admin/password/index',
  8. add_url: 'vip/admin/bind/add',
  9. edit_url: 'vip/admin/bind/edit',
  10. del_url: 'vip/admin/bind/del',
  11. multi_url: 'vip/admin/bind/multi',
  12. table: 'vip_admin_bind',
  13. },
  14. searchFormVisible: true,
  15. search: false,
  16. });
  17. var table = $("#table");
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. columns: [
  24. [
  25. {checkbox: true},
  26. {field: 'bind_id', title: __('Id'), visible: false, operate: false},
  27. {field: 'wx_nickname', title: __('公众号'),operate: false},
  28. {field: 'qds_id', title: __('账号ID'),operate: false},
  29. {field: 'qds_username', title: __('用户名')},
  30. {field: 'qds_nickname', title: __('用户昵称'),operate: false},
  31. {field: 'operator_nickname', title: __('运营者'), operate: false},
  32. {field: 'operator_username', title: __('修改密码'), formatter: Controller.api.edit_password, operate: false}
  33. ]
  34. ]
  35. });
  36. // 为表格绑定事件
  37. Table.api.bindevent(table);
  38. $(document).on('click','.btn-edit-batch',function () {
  39. var obj = $('#table tbody tr.selected');
  40. var len = obj.length;
  41. if (len == 0){
  42. layer.alert('请选择用户');
  43. }else{
  44. var ids = '';
  45. obj.find('td a').each(function (index,value) {
  46. ids += value.dataset.id+',';
  47. });
  48. Fast.api.open('/admin/vip/admin/password/edit_pwd_batch?ids='+ids, '批量修改密码', {});
  49. }
  50. });
  51. $(document).on('click', '.layer-open', function () {
  52. Fast.api.open($(this).attr('href'), '修改密码', {});
  53. return false;
  54. });
  55. },
  56. add: function () {
  57. Controller.api.bindevent();
  58. },
  59. edit: function () {
  60. Controller.api.bindevent();
  61. },
  62. edit_password: function () {
  63. Controller.api.bindevent();
  64. },
  65. edit_pwd_batch: function () {
  66. Controller.api.bindevent();
  67. },
  68. api: {
  69. bindevent: function () {
  70. Form.api.bindevent($("form[role=form]"));
  71. },
  72. formatter: {
  73. IncomeLink: function (value, row, index) {
  74. return '<a target="_blank" href="' + row['inComeUrl'] + '">进入</a>';
  75. }
  76. },
  77. edit_password: function (value, row, index) {
  78. return '<a data-id="'+row['qds_id']+'" href="/admin/vip/admin/password/edit_password?qds_id=' + row['qds_id'] + '" class="layer-open">修改</a>';
  79. }
  80. }
  81. };
  82. return Controller;
  83. });