study.js
8.3 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'study/index' + location.search,
add_url: 'study/add',
edit_url: 'study/edit',
del_url: 'study/del',
multi_url: 'study/multi',
pass_list_url: 'study/pass_list',
class_list_url: 'classes/index',
table: 'study',
}
});
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: 'type_id', title: __('分类id'),operate:false},
{field: 'examname', title: __('Examname'),operate:'like'},
{field: 'workname', title: __('学业名称'),operate:'like'},
{field: 'class_hour', title: __('Class_hour'),operate:false},
{field: 'image', title: __('Image'),operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'yinimage', title: __('印章图片'),operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'pass_mark', title: __('及格分数'),operate:false},
{field: 'dan_num', title: __('单选题数量'),operate:false},
{field: 'dan_score', title: __('单选题分值'),operate:false},
{field: 'duo_num', title: __('多选题数量'),operate:false},
{field: 'duo_score', title: __('多选题分值'),operate:false},
{field: 'pan_num', title: __('判断题数量'),operate:false},
{field: 'pan_score', title: __('判断题分值'),operate:false},
{field: 'examdurationtime', title: __('考试时长/分钟'),operate:false},
{field: 'expirationtime', title: __('Expirationtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{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,
buttons: [
{
name: 'pass_list',
text: __('通过列表'),
title: __('通过列表'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: '',
url: $.fn.bootstrapTable.defaults.extend.pass_list_url+'?study_id={id}&type=1',
extend: "data-area='[\"90%\",\"95%\"]'",
},
{
name: 'pass_list',
text: __('未通过列表'),
title: __('未通过列表'),
classname: 'btn btn-xs btn-warning btn-dialog',
icon: '',
url: $.fn.bootstrapTable.defaults.extend.pass_list_url+'?study_id={id}&type=2',
extend: "data-area='[\"90%\",\"95%\"]'",
},
{
name: 'class_list',
text: __('培训课程列表'),
title: __('培训课程列表'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: $.fn.bootstrapTable.defaults.extend.class_list_url+'?study_id={id}',
extend: "data-area='[\"90%\",\"95%\"]'",
},
], formatter: Table.api.formatter.operate}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
pass_list: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'study/pass_list' + location.search,
table: 'user',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'updatetime',
exportTypes: ['excel'],
exportOptions: {
// type: 'excel',
mso:{
// fileFormat: 'xlsx',
//修复导出数字不显示为科学计数法
onMsoNumberFormat: function (cell, row, col) {
return !isNaN($(cell).text())?'\\@':'';
}
}
},
columns: [
[
{checkbox: true},
{field: 'user.id', title: __('Id'), sortable: true},
// {field: 'group.name', title: __('Group')},
{field: 'user.username', title: __('用户名'), operate:'LIKE'},
{field: 'user.nickname', title: __('真实姓名'), operate:'LIKE'},
{field: 'study.id', title: __('报考科目'), searchList: Config.studyList,formatter: Table.api.formatter.flag},
{field: 'score', title: __('成绩'), operate:false},
{field: 'is_pass', title: __('是否通过'), searchList: {"1":"通过","2":'未通过'},formatter: Table.api.formatter.flag},
{field: 'user.password', title: __('密码'), operate:false},
{field: 'user.card', title: __('身份证'), operate:false},
{field: 'user.phone', title: __('手机号'), operate:false},
{field: 'user.sex', title: __('性别'), searchList: {"1":"男","2":'女'},formatter: Table.api.formatter.flag},
{field: 'user.work_address', title: __('工作地点'), operate:'LIKE'},
{field: 'user.image', title: __('头像'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'user.studynum', title: __('学号'), operate:false},
{field: 'user.expirationtime', title: __('有效期'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('考试时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
{field: 'user.status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
]
]
});
// 为表格绑定事件
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;
});