sun.js
4.1 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
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'sun/index' + location.search,
add_url: 'sun/add',
edit_url: 'sun/edit',
del_url: 'sun/del',
updateing_url: 'sun/updateing',
multi_url: 'sun/multi',
import_url: 'sun/import',
table: 'sun',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pageSize: 12,
pageList: [],
pk: 'id',
sortName: 'id',
commonSearch: false,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'plane.title', title: __('Plane_id'), operate: 'FALSE'},
{field: 'base_title', title: __('基地'), operate: 'LIKE'},
{field: 'time.title', title: __('Time.title'), operate: 'LIKE'},
// {field: 'time_id', title: __('Time_id')},
{
field: 'status',
title: __('Status'),
searchList: {"1": __('Status 1'), "2": __('Status 2'), "3": __('Status 3')},
formatter: Table.api.formatter.status
},
// {field: 'plane_id', title: __('Plane_id')},
// {field: 'user_id', title: __('User_id'), operate: 'LIKE'},
// {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{
field: 'createtime',
title: __('时间'),
operate: 'RANGE',
addclass: 'datetimerange',
autocomplete: false,
formatter: Table.api.formatter.datetime,
datetimeFormat: "YYYY-MM-DD"
},
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'user.nickname', title: __('预约人'), operate: 'LIKE'},
{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
//点击按钮获取选中的table中的数据
$("#button").on("click", function () {
var temp = Table.api.selectedids(table);
//发送给控制器
Fast.api.ajax({
url: "sun/Cache?temp=" + temp,
type: "GET",
data: {},
}, function (data, ret) {
return false;
}, function (data, ret) {
return false;
});
Fast.api.close();
});
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
updateing: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});