room_order.js
7.5 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
define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, undefined, Backend, Table, Form,Layer) {
var Controller = {
index: function () {
//修改弹框大小
// $(".btn-add").data("area",["100%","100%"]);
// $(".btn-edit").data("area",["100%","100%"]);
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'project_appointment/room_order/index' + location.search,
auth_url: 'project_appointment/room_order/verify',
table: 'room',
}
});
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: 'apply_name', title: __('申请人'),operate: 'LIKE'},
{field: 'room_name', title: __('房间名称'),operate: 'LIKE'},
{field: 'apply_date', title: __('预约日期'),operate: false},
{field: 'start_time', title: __('预约结束时间'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'end_time', title: __('预约结束时间'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'use_count', title: __('使用人数'),operate: false},
{field: 'apply_desc', title: __('预约说明'),operate: false},
{field: 'status_text', title: __('审核状态'),operate: false},
{field: 'createtime', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate,
buttons:[
{
name: 'btn',
text: '审核',
title: '审核',
classname: 'btn btn-xs btn-success 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/room_order/verify',
data:{id:id,status:2},
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
$('#table').bootstrapTable('updateRow', {
index: row_index,
row: {
status_text: '审核通过',
}
});
}
layer.msg(res.msg, {icon: 1});
},
error:function(error){
console.log(error);
}
});
}, function(){
$.ajax({
type:'post',
url:'project_appointment/room_order/verify',
data:{id:id,status:3},
dataType:'json',
success:function(res){
if(parseInt(res.code) !=0){
$('#table').bootstrapTable('updateRow', {
index: row_index,
row: {
status_text: '已驳回',
}
});
}
layer.msg(res.msg, {icon: 1});
},
error:function(error){
console.log(error);
}
});
});
},
/* visible: function (val) {
if(val.status != 1) {
return false;
}else{
return true;
}
}*/
},
]
},
]
],
});
$('.search input').attr('placeholder','搜索');
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
Controller.api.linkage();
},
edit: function () {
Controller.api.bindevent();
//绑定事件
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { // 为tab按钮绑定事件
var panel = $($(this).attr("href"));
if (panel.size() > 0) {
Controller.tabbar[panel.attr("id")].call(this);
}
//移除绑定的事件
$(this).unbind('shown.bs.tab');
});
//必须默认触发shown.bs.tab事件
$('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
Controller.api.linkage();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});