building_enter_verify.js
23.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, undefined, Backend, Table, Form,Layer) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'project_appointment/building_enter_verify/index' + location.search,
table: 'building_enter',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
pageSize:10,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'),operate: false},
{field: 'username', title: __('申请人'),operate: 'LIKE'},
{field: 'mobile', title: __('手机号码'),operate: false},
{field: 'createtime', title: __('申请时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'station_num', title: __('所需工位数'),operate: false},
{field: 'enter_type', title: __('入驻类型'),operate: false,
formatter: function (val, row)
{
return row.enter_type == 1 ? '团队' : '公司';
}
},
{field: 'enter_project_name', title: __('项目名称'),operate: 'LIKE'},
{
field: 'enter_project_name', title: '项目名称及编号', operate: false, align: 'left', formatter: function (val, row) {
return row.enter_project_name + '<br/>' + row.enter_no;
}
},
{field: 'enter_project_desc', title: __('项目简介'),operate: false},
{field: 'v_type_text', title: __('申请类型'),operate: false},
{field: 'v_status_text', title: __('审核状态'),operate: false},
{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
{
name:'btn',
text:'通过',
title:'通过',
icon: 'fa fa-share',
classname: 'btn btn-xs btn-success btn-click',
click: function (val, row) {
var id = row.id;
var row_index = val.rowIndex;
var type = row.verify_type;
var type_text = row.v_type_text;
layer.confirm('确认同意'+type_text+'?', {
btn: ['确认','取消'] //按钮
}, function(){
$.ajax({
type:'post',
url:'project_appointment/building_enter_verify/agree',
data:{id:id},
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
location.reload();
/* $('#table').bootstrapTable('updateRow', {
index: row_index,
row: {
v_status_text: '审核通过',
}
});*/
}
layer.msg(res.msg, {icon: 1});
},
error:function(error){
console.log(error);
}
});
}, function(){
});
},
visible:function(row) {
if(row.verify_status == 1) {
return true;
}else{
return false;
}
},
},
{
name:'btn',
text:'驳回',
title:'驳回',
icon: 'fa fa-share',
classname: 'btn btn-xs btn-danger btn-click',
click: function (val, row) {
var id = row.id;
var row_index = val.rowIndex;
layer.confirm('确认驳回申请?', {
btn: ['确认','取消'] //按钮
}, function(){
$.ajax({
type:'post',
url:'project_appointment/building_enter_verify/reject',
data:{id:id},
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
location.reload();
}
layer.msg(res.msg, {icon: 1});
},
error:function(error){
console.log(error);
}
});
}, function(){
});
},
visible:function(row) {
if(row.verify_status == 1) {
return true;
}else{
return false;
}
},
},
{
name:'btn',
text:'已通过',
title:'已通过',
icon: 'fa fa-share',
classname: 'btn btn-xs btn-success btn-click',
visible:function(row) {
if(row.verify_status == 2) {
return true;
}else{
return false;
}
},
},
{
name:'btn',
text:'已驳回',
title:'已驳回',
icon: 'fa fa-share',
classname: 'btn btn-xs btn-danger btn-click',
visible:function(row) {
if(row.verify_status == 3) {
return true;
}else{
return false;
}
},
},
{
name:'btn',
text:'审核已取消',
title:'审核已取消',
icon: 'fa fa-share',
classname: 'btn btn-xs btn-danger btn-click',
visible:function(row) {
if(row.verify_status == 4) {
return true;
}else{
return false;
}
},
},
{
name: 'projectView',
text: '查看项目',
classname: 'btn btn-xs btn-success btn-addtabs',
url: function (row) {
return '/school/project_appointment/building_enter/enter_detail?id='+row.id
}
}
]
},
]
],
});
$('.search input').attr('placeholder','搜索');
// 为表格绑定事件
Table.api.bindevent(table);
// Controller.api.bindevent($("form[role=form]"));
},
company_index:function() {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'project_appointment/building_enter/company_index' + location.search,
table: 'company_index',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
pageSize:10,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'),operate: false},
{field: 'username', title: __('申请人'),operate: 'LIKE'},
{field: 'mobile', title: __('手机号码'),operate: false},
{field: 'createtime', title: __('申请时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'station_num', title: __('所需工位数'),operate: false},
{field: 'enter_type_text', title: __('入驻类型'),operate: false},
{
field: 'room_name', title: '分配场地', operate: false, align: 'left', formatter: function (val, row) {
return row.building_name + '<br/>' + row.floor_name + '</br>' + row.room_name;
}
},
{field: 'enter_project_name', title: __('项目名称'),operate: 'LIKE'},
{
field: 'enter_project_name', title: '项目名称及编号', operate: false, align: 'left', formatter: function (val, row) {
return row.enter_project_name + '<br/>' + row.enter_no;
}
},
{field: 'enter_project_desc', title: __('项目简介'),operate: false},
{field: 'start_time', title: __('使用开始时间'),operate: false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'end_time', title: __('到期时间'),operate: false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
// {field: 'company_name', title: __('公司名称'),operate: false},
// {
// field: 'legal_person_name', title: '法人名称及手机号码', operate: false, align: 'left', formatter: function (val, row) {
// return row.legal_person_name + '<br/>' + row.legal_person_mobile;
// }
// },
// {field: 'company_annex_url', title: __('公司上传附件'), formatter: Controller.api.formatter.company_annex_url, operate: false},
// {field: 'company_register_address', title: __('公司注册地址'), operate: false},
// {
// field: 'company_register_capital', title: '项目名称及编号', operate: false, align: 'left', formatter: function (val, row) {
// return row.company_register_capital + '万元';
// }
// },
{field: 'expire_type', title: __('状态'),operate: false},
{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
{
name:'btn',
text:'到期',
title:'到期',
icon: 'fa fa-share',
classname: 'btn btn-xs btn-danger btn-click',
click: function (val, row) {
var id = row.id;
var row_index = val.rowIndex;
layer.confirm('确认将该纪录设置到期吗?', {
btn: ['确认','取消'] //按钮
}, function(){
$.ajax({
type:'post',
url:'project_appointment/building_enter/expire',
data:{id:id},
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
location.reload();
// $('#table').bootstrapTable('updateRow', {
// index: row_index,
// row: {
// expire_type: '已到期',
// }
// });
}
layer.msg(res.msg, {icon: 1});
},
error:function(error){
console.log(error);
}
});
}, function(){
});
},
},
{
name: 'projectView',
text: '查看',
classname: 'btn btn-xs btn-success btn-addtabs',
url: function (row) {
return '/school/project_appointment/building_enter/enter_detail?id='+row.id
}
}
]
},
]
],
});
$('.search input').attr('placeholder','搜索');
// 为表格绑定事件
Table.api.bindevent(table);
},
enter_detail:function(){
//绑定事件
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { // 为tab按钮绑定事件
var panel = $($(this).attr("href"));
if (panel.size() > 0) {
Controller.tab[panel.attr("id")].call(this);
// 如需切换tab时就刷新table,就打开下面注释
// $(this).on('click', function (e) {
// $($(this).attr("href")).find(".btn-refresh").trigger("click");
// });
}
//移除绑定的事件
$(this).unbind('shown.bs.tab');
});
//必须默认触发shown.bs.tab事件
$('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
},
tab: {
reg: function () {
Form.api.bindevent($("form.form-reg"));
},
members: function () {
Table.api.init({
extend: {
index_url: '/school/project_appointment/building_enter/get_members' + location.search,
}
});
var table = $("#table-members");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
toolbar: '#toolbar-members',
// pk: 'id',
// sortName: 'weigh',
// 是否显示快速搜索(搜索框)
search: false,
// 是否显示切换视图按钮
showToggle: false,
// 是否显示隐藏列按钮
showColumns: false,
// 是否显示导出按钮
showExport: false,
// 是否开启通用搜索功能(表格右上角的放大镜)
commonSearch: false,
// 是否隐藏通用搜索按钮
showSearch: false,
columns: [
[
{ field: 'student_no', title: '学号' },
{ field: 'username', title: '姓名' },
{ field: 'mobile', title: '手机号' },
{ field: 'college_text', title: '学院' },
{ field: 'specialty_text', title: '专业' },
{ field: 'entry_year', title: '年级' },
{ field: 'email', title: '邮箱' },
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
teachers: function () {
Table.api.init({
extend: {
index_url: '/school/project_appointment/building_enter/get_teachers' + location.search,
}
});
var table = $("#table-teachers");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
toolbar: '#toolbar-teachers',
// pk: 'id',
// sortName: 'weigh',
// 是否显示快速搜索(搜索框)
search: false,
// 是否显示切换视图按钮
showToggle: false,
// 是否显示隐藏列按钮
showColumns: false,
// 是否显示导出按钮
showExport: false,
// 是否开启通用搜索功能(表格右上角的放大镜)
commonSearch: false,
// 是否隐藏通用搜索按钮
showSearch: false,
columns: [
[
{ field: 'job_num', title: '工号' },
{ field: 'username', title: '教师姓名' },
{ field: 'degree_text', title: '学位' },
{ field: 'education_text', title: '学历' },
{ field: 'position_text', title: '职称' },
{ field: 'mobile', title: '手机号' },
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
},
room_allocation:function() {
$(document).on('change', '#term_type', function () {
var type = $(this).val();
if(type == 4) {
$("#end_time").show();
}else{
$("#end_time").hide();
}
})
//为表单绑定事件
Form.api.bindevent($("#verify_from"), function (data, ret) {
console.log(ret.url);
setTimeout(function () {
window.location.href = ret.url ? ret.url : "/";
}, 1000);
});
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
},
formatter: {
annex_url: function (val,row) {
return '<a href="' + val + '" target="_blank" class="label bg-green">' + row.annex_name + '</a>';
},
company_annex_url: function (val,row) {
return '<a href="' + row.company_annex_url + '" target="_blank" class="label bg-green">' + val + '</a>';
},
}
}
};
return Controller;
});