1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'vip/admin/password/index',
- add_url: 'vip/admin/bind/add',
- edit_url: 'vip/admin/bind/edit',
- del_url: 'vip/admin/bind/del',
- multi_url: 'vip/admin/bind/multi',
- table: 'vip_admin_bind',
- },
- searchFormVisible: true,
- search: false,
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'bind_id', title: __('Id'), visible: false, operate: false},
- {field: 'wx_nickname', title: __('公众号'),operate: false},
- {field: 'qds_id', title: __('账号ID'),operate: false},
- {field: 'qds_username', title: __('用户名')},
- {field: 'qds_nickname', title: __('用户昵称'),operate: false},
- {field: 'operator_nickname', title: __('运营者'), operate: false},
- {field: 'operator_username', title: __('修改密码'), formatter: Controller.api.edit_password, operate: false}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- $(document).on('click','.btn-edit-batch',function () {
- var obj = $('#table tbody tr.selected');
- var len = obj.length;
- if (len == 0){
- layer.alert('请选择用户');
- }else{
- var ids = '';
- obj.find('td a').each(function (index,value) {
- ids += value.dataset.id+',';
- });
- Fast.api.open('/admin/vip/admin/password/edit_pwd_batch?ids='+ids, '批量修改密码', {});
- }
- });
- $(document).on('click', '.layer-open', function () {
- Fast.api.open($(this).attr('href'), '修改密码', {});
- return false;
- });
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- edit_password: function () {
- Controller.api.bindevent();
- },
- edit_pwd_batch: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- formatter: {
- IncomeLink: function (value, row, index) {
- return '<a target="_blank" href="' + row['inComeUrl'] + '">进入</a>';
- }
- },
- edit_password: function (value, row, index) {
- return '<a data-id="'+row['qds_id']+'" href="/admin/vip/admin/password/edit_password?qds_id=' + row['qds_id'] + '" class="layer-open">修改</a>';
- }
- }
- };
- return Controller;
- });
|