128 lines
6.2 KiB
JavaScript
128 lines
6.2 KiB
JavaScript
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||
|
|
||
|
var Controller = {
|
||
|
index: function () {
|
||
|
// 初始化表格参数配置
|
||
|
Table.api.init({
|
||
|
extend: {
|
||
|
index_url: 'user/user/index' + location.search,
|
||
|
add_url: 'user/user/add',
|
||
|
edit_url: 'user/user/edit',
|
||
|
del_url: 'user/user/del',
|
||
|
multi_url: 'user/user/multi',
|
||
|
import_url: 'user/user/import',
|
||
|
table: 'user',
|
||
|
}
|
||
|
});
|
||
|
|
||
|
var table = $("#table");
|
||
|
|
||
|
// 初始化表格
|
||
|
table.bootstrapTable({
|
||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||
|
pk: 'id',
|
||
|
sortName: 'id',
|
||
|
columns: [
|
||
|
[
|
||
|
{checkbox: true},
|
||
|
|
||
|
{field: 'operate', title: __('Operate'), table: table , buttons: [
|
||
|
{
|
||
|
name: 'classes_order',
|
||
|
text: __('课程购买记录'),
|
||
|
title: __('课程购买记录'),
|
||
|
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
|
||
|
icon: 'fa fa-list',
|
||
|
url: classes_order_url,
|
||
|
callback: function (data) {
|
||
|
|
||
|
},
|
||
|
// visible: function (row) {
|
||
|
// return row.status == '2'||row.status == '3';
|
||
|
// }
|
||
|
},
|
||
|
|
||
|
{
|
||
|
name: 'classes_hourorder',
|
||
|
text: __('课时预约记录'),
|
||
|
title: __('课时预约记录'),
|
||
|
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
|
||
|
icon: 'fa fa-list',
|
||
|
url: classes_hourorder_url,
|
||
|
callback: function (data) {
|
||
|
|
||
|
},
|
||
|
// visible: function (row) {
|
||
|
// return row.status == '2'||row.status == '3';
|
||
|
// }
|
||
|
},
|
||
|
|
||
|
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
|
||
|
|
||
|
|
||
|
|
||
|
{field: 'id', title: __('Id')},
|
||
|
// {field: 'group_id', title: __('Group_id')},
|
||
|
// {field: 'username', title: __('Username'), operate: 'LIKE'},
|
||
|
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
|
||
|
{field: 'realname', title: __('Realname'), operate: 'LIKE'},
|
||
|
{field: 'work', title: __('Work'), operate: 'LIKE'},
|
||
|
// {field: 'password', title: __('Password'), operate: 'LIKE'},
|
||
|
// {field: 'salt', title: __('Salt'), operate: 'LIKE'},
|
||
|
// {field: 'email', title: __('Email'), operate: 'LIKE'},
|
||
|
{field: 'bio', title: __('Bio'), operate: 'LIKE'},
|
||
|
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
|
||
|
{field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||
|
// {field: 'level', title: __('Level')},
|
||
|
// {field: 'gender', title: __('Gender')},
|
||
|
// {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||
|
// {field: 'bio', title: __('Bio'), operate: 'LIKE'},
|
||
|
// {field: 'money', title: __('Money'), operate:'BETWEEN'},
|
||
|
// {field: 'score', title: __('Score')},
|
||
|
// {field: 'successions', title: __('Successions')},
|
||
|
// {field: 'maxsuccessions', title: __('Maxsuccessions')},
|
||
|
// {field: 'prevtime', title: __('Prevtime')},
|
||
|
// {field: 'logintime', title: __('Logintime')},
|
||
|
// {field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
|
||
|
// {field: 'loginfailure', title: __('Loginfailure')},
|
||
|
// {field: 'loginfailuretime', title: __('Loginfailuretime')},
|
||
|
// {field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
|
||
|
// {field: 'jointime', title: __('Jointime')},
|
||
|
// {field: 'createtime', title: __('Createtime')},
|
||
|
// {field: 'updatetime', title: __('Updatetime')},
|
||
|
// {field: 'token', title: __('Token'), operate: 'LIKE'},
|
||
|
// {field: 'status', title: __('Status'), operate: 'LIKE', formatter: Table.api.formatter.status},
|
||
|
// {field: 'verification', title: __('Verification'), operate: 'LIKE'},
|
||
|
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||
|
]
|
||
|
]
|
||
|
});
|
||
|
|
||
|
// 为表格绑定事件
|
||
|
Table.api.bindevent(table);
|
||
|
},
|
||
|
add: function () {
|
||
|
Controller.api.bindevent();
|
||
|
},
|
||
|
edit: function () {
|
||
|
Controller.api.bindevent();
|
||
|
},
|
||
|
api: {
|
||
|
bindevent: function () {
|
||
|
Form.api.bindevent($("form[role=form]"));
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
var classes_order_url = function (row,dom) {
|
||
|
return 'school/classes/order/order/index?user_id='+row.id;
|
||
|
}
|
||
|
//classes_hourorder_url
|
||
|
var classes_hourorder_url = function (row,dom) {
|
||
|
return 'school/classes/hourorder/order/index?user_id='+row.id;
|
||
|
}
|
||
|
|
||
|
return Controller;
|
||
|
});
|