teacher.js
5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'teacher/index' + location.search,
add_url: 'teacher/add',
edit_url: 'teacher/edit',
del_url: 'teacher/del',
multi_url: 'teacher/multi',
table: 'teacher',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'), operate:false},
{field: 'user.nickname', title: __('User.nickname'), operate:false},
{field: 'name', title: __('Name'), operate:false},
{field: 'sex', title: __('Sex'),formatter: Table.api.formatter.label,searchList:{'1': '男','2':'女'}},
{field: 'birth', title: __('Birth'), operate:false},
{field: 'idcard', title: __('Idcard'), operate:false},
{field: 'before', title: __('Before'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'behind', title: __('Behind'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'phone', title: __('Phone'), operate:false},
{field: 'thumbnail', title: __('Thumbnail'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'address', title: __('Address'), operate:false},
{field: 'honor', title: __('Honor'), operate:false},
{field: 'online', title: __('Online'), operate:false},
{field: 'status', title: __('Status'),formatter: Table.api.formatter.status,searchList:{'0':'待审核','1': '审核通过','2':'审核未通过'}},
{field: 'is_recommend', title: __('Is_recommend'),formatter: Table.api.formatter.toggle,yes:'1',no:'0',searchList:{'0': '不推荐','1':'推荐'}},
{field: 'is_forbid', title: __('是否封禁'),formatter: Table.api.formatter.toggle,yes:'1',no:'0',searchList:{'0': '正常','1':'封禁'}},
{field: 'is_stick', title: __('是否置顶'),formatter: Table.api.formatter.status,searchList:{'0':'不置顶','1': '置顶'}},
// {field: 'territory_id', title: __('Territory_id'), operate:false},
{field: 'territory_id', title: __('按钮组'), table: table, events: Table.api.events.operate, buttons:
[
{
text: '擅长领域',
title: '擅长领域',
icon: 'fa fa-list',
classname: 'btn btn-xs btn-primary btn-dialog',
url: 'hobby/index1',
extend: 'data-area=\'["80%","80%"]\''
},
{
text: '收益记录',
title: '收益记录',
icon: 'fa fa-list',
classname: 'btn btn-xs btn-primary btn-dialog',
url: 'jilu/index1',
extend: 'data-area=\'["80%","80%"]\''
},
], operate:false, formatter: Table.api.formatter.buttons
},
{field: 'proportion', title: __('佣金比例'), operate:false},
{field: 'income', title: __('总收入'), operate:false},
{field: 'withdraw', title: __('提现金额'), operate:false},
{field: 'balance', title: __('账号余额'), operate:false},
{field: 'count', title: __('总订单数'), operate:false},
// {field: 'level', title: __('Level'), operate:false},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{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]"));
}
}
};
return Controller;
});