16
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var friend = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
window.statuskOption= Config.statusList;
|
||||
window.filterData = {
|
||||
};
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'friend/select?userID='+Fast.api.query('userID'),
|
||||
add_url: 'friend/insert',
|
||||
edit_url: 'friend/update',
|
||||
del_url: 'friend/delete',
|
||||
multi_url: 'friend/multi',
|
||||
dragsort_url: null,
|
||||
table: 'user',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
var columns = [
|
||||
{checkbox: true},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
filter: "number",
|
||||
sortable: true,
|
||||
visible:false // 是否排序
|
||||
},
|
||||
{
|
||||
field: 'userID',
|
||||
title: 'userID',
|
||||
filter: "string"
|
||||
},
|
||||
// {
|
||||
// title: "上级",
|
||||
// field: "referrer.username"
|
||||
// },
|
||||
{
|
||||
title: "角色",
|
||||
field: "role_id",
|
||||
formatter:function(v,row){
|
||||
return row.role ? row.role.name : '用户';
|
||||
},
|
||||
filter: "select",
|
||||
filterOption:"roleOption"
|
||||
},
|
||||
{
|
||||
title: "用户名",
|
||||
field: "username"
|
||||
},
|
||||
{
|
||||
title: "昵称",
|
||||
field: "nickname"
|
||||
},
|
||||
{
|
||||
title: "头像",
|
||||
field: "avatar",
|
||||
formatter: function (v,d) {
|
||||
return '<img src="'+encodeURI(d['avatar'])+'" style="max-width:32px;max-height:32px;" alt="" />'
|
||||
},
|
||||
visible: false
|
||||
},
|
||||
// {
|
||||
// title: "等级",
|
||||
// field: "level",
|
||||
// visible: false,
|
||||
// },
|
||||
// {
|
||||
// title: "生日",
|
||||
// field: "birthday",
|
||||
// visible: false,
|
||||
// },
|
||||
// {
|
||||
// title: "后缀",
|
||||
// field: "decimal_part",
|
||||
// //visible: false,
|
||||
// },
|
||||
];
|
||||
var currencys = ['money','score','currency1','currency2','currency3','currency4','currency5','currency6','currency7','currency8','currency9'];
|
||||
for (let i = 0; i < currencys.length; i++) {
|
||||
if(Config.allow_currencys.indexOf(currencys[i])!==-1){
|
||||
columns.push({
|
||||
title: __(currencys[i]),
|
||||
field: currencys[i],
|
||||
formatter:Table.api.formatter.number,
|
||||
//sortable: true,
|
||||
//visible: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
columns.push({
|
||||
title: "注册时间",
|
||||
field: "created_at",
|
||||
filter:'datetime'
|
||||
});
|
||||
columns.push({
|
||||
title: "状态",
|
||||
field: "status",
|
||||
formatter: Table.api.formatter.switch
|
||||
});
|
||||
columns.push({
|
||||
field: 'operate', title: '操作',
|
||||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
buttons:[
|
||||
// {
|
||||
// text:"团队",
|
||||
// name:"team",
|
||||
// icon:"mdi mdi-account-group-outline",
|
||||
// classname:"btn btn-xs btn-info btn-dialog",
|
||||
// extend:' data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false"',
|
||||
// url:'user/team'
|
||||
// }
|
||||
]
|
||||
});
|
||||
var tableOptions = {
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
commonSearch: false,
|
||||
search: false,
|
||||
columns: [columns]
|
||||
};
|
||||
// 初始化表格
|
||||
table.bootstrapTable(tableOptions);
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
insert:function(){
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['upload_url'] = 'files/upload';
|
||||
var form = $('form');
|
||||
var that = this;
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
};
|
||||
return friend
|
||||
});
|
||||
Reference in New Issue
Block a user