2024-11-04 10:49:10 +08:00
|
|
|
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
|
|
|
|
|
|
var Controller = {
|
|
|
|
|
index: function () {
|
|
|
|
|
// 初始化表格参数配置
|
|
|
|
|
Table.api.init({
|
|
|
|
|
extend: {
|
|
|
|
|
index_url: 'user/user/index',
|
|
|
|
|
add_url: 'user/user/add',
|
|
|
|
|
edit_url: 'user/user/edit',
|
|
|
|
|
del_url: 'user/user/del',
|
|
|
|
|
multi_url: 'user/user/multi',
|
|
|
|
|
table: 'user',
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var table = $("#table");
|
|
|
|
|
|
|
|
|
|
// 初始化表格
|
|
|
|
|
table.bootstrapTable({
|
|
|
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
|
|
pk: 'id',
|
|
|
|
|
sortName: 'user.id',
|
|
|
|
|
columns: [
|
|
|
|
|
[
|
|
|
|
|
{checkbox: true},
|
|
|
|
|
{field: 'id', title: __('Id'), sortable: true},
|
|
|
|
|
{field: 'group.name', title: __('Group')},
|
|
|
|
|
{field: 'username', title: __('Username'), operate: 'LIKE'},
|
|
|
|
|
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
|
|
|
|
|
{field: 'email', title: __('Email'), operate: 'LIKE'},
|
|
|
|
|
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
|
|
|
|
|
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
|
|
|
|
|
{field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
|
|
|
|
|
{field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
|
|
|
|
|
{field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
|
|
|
|
|
{field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
|
|
|
|
|
{field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
|
|
|
|
|
{field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
|
|
|
|
{field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
|
|
|
|
|
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
|
|
|
|
|
{field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
|
|
|
|
|
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
|
|
|
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 为表格绑定事件
|
|
|
|
|
Table.api.bindevent(table);
|
2024-11-20 18:05:45 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发放y预约订单
|
|
|
|
|
* cc
|
|
|
|
|
* 2020年8月5日
|
|
|
|
|
*/
|
|
|
|
|
$(document).on('click', '.btn-changeuser', function (event) {
|
|
|
|
|
var url = $(this).attr('data-url');
|
|
|
|
|
if(!url) return false;
|
|
|
|
|
var title = $(this).attr('title');
|
|
|
|
|
var width = $(this).attr('data-width');
|
|
|
|
|
var height = $(this).attr('data-height');
|
|
|
|
|
var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%'];
|
|
|
|
|
var options = {
|
|
|
|
|
shadeClose: false,
|
|
|
|
|
shade: [0.3, '#393D49'],
|
|
|
|
|
area: area,
|
|
|
|
|
callback:function(ret){//回调方法,需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
Fast.api.open(url,title,options);
|
|
|
|
|
});
|
2024-11-04 10:49:10 +08:00
|
|
|
|
},
|
|
|
|
|
add: function () {
|
|
|
|
|
Controller.api.bindevent();
|
|
|
|
|
},
|
|
|
|
|
edit: function () {
|
|
|
|
|
Controller.api.bindevent();
|
|
|
|
|
},
|
2024-11-20 18:05:45 +08:00
|
|
|
|
changeuser: function(){
|
|
|
|
|
$("#changeuser").on('click', function() {
|
|
|
|
|
$("#changeuser-form").attr("action",'user/user/changeuser').submit();
|
|
|
|
|
});
|
|
|
|
|
Controller.api.bindevent();
|
|
|
|
|
},
|
2024-11-04 10:49:10 +08:00
|
|
|
|
api: {
|
|
|
|
|
bindevent: function () {
|
|
|
|
|
Form.api.bindevent($("form[role=form]"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return Controller;
|
|
|
|
|
});
|