235 lines
8.9 KiB
JavaScript
235 lines
8.9 KiB
JavaScript
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
|
var User = {
|
|
//Do setup work hereAction
|
|
index: function () {
|
|
window.filterData = {
|
|
"order_id":{value1:Fast.api.query('ids'),symbol:'=','value2':''}
|
|
};
|
|
window.groupOption=Config.groupList;
|
|
window.roleOption=Config.roleList;
|
|
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: '/app/admin/workrecord/select',
|
|
add_url: null,
|
|
edit_url: '/app/admin/workrecord/update',
|
|
del_url: null,
|
|
multi_url: '/app/admin/workrecord/multi',
|
|
dragsort_url: null,
|
|
table: 'work_record',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
var tableOptions = {
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
commonSearch: false,
|
|
search: false,
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{
|
|
field: 'id',
|
|
title: 'ID',
|
|
filter: "number",
|
|
sortable: true // 是否排序
|
|
},
|
|
{
|
|
title: "订单号",
|
|
field: "order_id"
|
|
},
|
|
{
|
|
title: "开始时间",
|
|
field: "start_time",
|
|
formatter:Table.api.formatter.datetime
|
|
},
|
|
{
|
|
title: "结束时间",
|
|
field: "end_time",
|
|
formatter:Table.api.formatter.datetime
|
|
},
|
|
{
|
|
title: "状态",
|
|
field: "status",
|
|
formatter: Table.api.formatter.switch
|
|
},
|
|
{
|
|
field: 'operate', title: '操作',
|
|
table: table, events: Table.api.events.operate,
|
|
formatter: Table.api.formatter.operate
|
|
}
|
|
]
|
|
]
|
|
};
|
|
// 初始化表格
|
|
table.bootstrapTable(tableOptions);
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
update:function(){
|
|
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
|
var form = $('form');
|
|
Form.api.bindevent(form)
|
|
this.getRole();
|
|
},
|
|
insert:function(){
|
|
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
|
var form = $('form');
|
|
Form.api.bindevent(form)
|
|
this.getRole();
|
|
},
|
|
getRole:function(){
|
|
Fast.api.ajax({
|
|
url: "/app/admin/UserRole/select?format=tree",
|
|
dataType: "json",
|
|
success: function (res) {
|
|
Layer.closeAll();
|
|
var html = "";
|
|
var selected=$('#roles').data('value');
|
|
for (let index = 0; index < res.data.length; index++) {
|
|
const element = res.data[index];
|
|
if(selected == element.id){
|
|
html+='<option value="'+element.id+'" selected>'+element.name+'</option>';
|
|
}else{
|
|
html+='<option value="'+element.id+'">'+element.name+'</option>';
|
|
}
|
|
}
|
|
$('#roles').append(html);
|
|
}
|
|
});
|
|
},
|
|
team:function(){
|
|
window.filterData = {
|
|
"user_id":{value1:Fast.api.query('ids'),symbol:'=','value2':''},
|
|
'type' : {value1:'child',symbol:'=','value2':''}
|
|
};
|
|
|
|
$('.nav-tabs li').on('click',function(){
|
|
$('.nav-tabs li').removeClass('active');
|
|
$(this).addClass('active');
|
|
window.filterData['type'] = {value1:$(this).data('type'),symbol:'=','value2':''};
|
|
table.bootstrapTable('selectPage', 1);
|
|
});
|
|
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: '/app/admin/team/select',
|
|
add_url: null,
|
|
edit_url: null,
|
|
del_url: null,
|
|
multi_url: null,
|
|
dragsort_url: null,
|
|
table: 'team',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
var tableOptions = {
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
commonSearch: false,
|
|
search: false,
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
{
|
|
title: "深度",
|
|
field: "depth",
|
|
},
|
|
{
|
|
field: 'id',
|
|
title: 'ID',
|
|
filter: "number",
|
|
sortable: true // 是否排序
|
|
},
|
|
{
|
|
title: "角色",
|
|
field: "role",
|
|
visible: false,
|
|
},
|
|
{
|
|
title: "用户名",
|
|
field: "username",
|
|
filter: "string",
|
|
},
|
|
// {
|
|
// title: "等级",
|
|
// field: "level",
|
|
// visible: false,
|
|
// },
|
|
{
|
|
title: "余额",
|
|
field: "money",
|
|
formatter:Table.api.formatter.number,
|
|
sortable: true,
|
|
//visible: false,
|
|
},
|
|
{
|
|
title: "积分",
|
|
field: "score",
|
|
sortable: true,
|
|
formatter:Table.api.formatter.number
|
|
},
|
|
{
|
|
title: "待结算",
|
|
field: "currency1",
|
|
formatter:Table.api.formatter.number
|
|
},
|
|
{
|
|
title: "失效算力",
|
|
field: "currency2",
|
|
sortable: true,
|
|
formatter:Table.api.formatter.number
|
|
},
|
|
{
|
|
title: "登录时间",
|
|
field: "last_time",
|
|
formatter:Table.api.formatter.datetime,
|
|
visible: false,
|
|
},
|
|
{
|
|
title: "登录ip",
|
|
field: "last_ip",
|
|
visible: false,
|
|
},
|
|
{
|
|
title: "注册时间",
|
|
field: "join_time",
|
|
formatter:Table.api.formatter.datetime,
|
|
filter:'datetime'
|
|
},
|
|
{
|
|
title: "注册ip",
|
|
field: "join_ip",
|
|
visible: false,
|
|
},
|
|
{
|
|
title: "创建时间",
|
|
field: "created_at",
|
|
visible: false,
|
|
},
|
|
{
|
|
title: "更新时间",
|
|
field: "updated_at",
|
|
formatter:Table.api.formatter.datetime,
|
|
visible: false,
|
|
},
|
|
{
|
|
title: "状态",
|
|
field: "status",
|
|
formatter: Table.api.formatter.switch
|
|
}
|
|
]
|
|
]
|
|
};
|
|
// 初始化表格
|
|
table.bootstrapTable(tableOptions);
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
}
|
|
};
|
|
return User
|
|
}); |