-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
230 lines (204 loc) · 7.06 KB
/
index.html
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
<!DOCTYPE html>
<!-- saved from url=(0023)https://datatables.net/ -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>KIPIC项目管理系统 | the fast & easy way</title>
<link rel="shortcut icon" type="image/png" href="https://datatables.net/media/images/favicon.png">
<link rel="stylesheet" href="site.css">
<!--[if lte IE 9]>
<link rel="stylesheet" type="text/css" href="/media/css/ie.css" />
<![endif]-->
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.1/css/responsive.dataTables.min.css">
<style>
div.fw-container div.fw-body div.content {
margin-top: 5em;
}
div.fw-body h1 {
display: none;
}
div.fw-container {
z-index: 1;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/responsive/2.2.1/js/dataTables.responsive.min.js"></script>
<script>
var currentSource = "https://runkit.io/baiheinet/5aeffc183271ba001234c770/branches/master/drawindex";
var dtconfig ={
processing: true,
serverSide: true,
//searching: false, //禁用原生搜索
orderMulti: false, //启用多列排序
order: [], //取消默认排序查询,否则复选框一列会出现小箭头
deferRender: true,
responsive: true,
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/Chinese.json'
},
columnDefs: [
{ targets: [-1, -3], className: 'dt-body-right' }
],
ajax: function (data, callback, settings) {
//封装请求参数
var param = {};
param.limit = data.length;//页面显示记录条数,在页面显示每页显示多少项的时候
param.start = data.start;//开始的记录序号
param.page = (data.start / data.length)+1;//当前页码
//console.log(param);
//ajax请求数据
$.ajax({
url: currentSource,
//dataSrc: "",
cache: false, //禁用缓存
data: param, //传入组装的参数
dataType: "json",
success: function (result) {
//封装返回数据
var returnData = {};
returnData.draw = data.draw;//这里直接自行返回了draw计数器,应该由后台返回
returnData.recordsTotal = result.total;//返回数据全部记录
returnData.recordsFiltered = result.total;//后台不实现过滤功能,每次查询均视作全部结果
returnData.data = result.data;//返回的数据列表
//console.log(returnData);
//调用DataTables提供的callback方法,代表数据已封装完成并传回DataTables进行渲染
//此时的数据需确保正确无误,异常判断应在执行此回调前自行处理完毕
callback(returnData);
}
});
},
columns: [
{ data: "ISO" },
{ data: "RecieveDate" },
{ data: "Rev" },
{ data: "Link"}
],
columnDefs: [
{
render: function(data, type, row, meta) {
//渲染 把数据源中的标题和url组成超链接
return '<a href="' + row.Link + '" target="_blank">' + data + '</a>';
},
//指定是一列
targets: 0
},
{ "visible": false, "targets": [ 3 ] }
]
};
$(document).ready(function () {
table = $('#example').addClass('nowrap').dataTable(dtconfig);
//更换数据源(相同格式,但是数据内容不同)
$("#Draw_Index").click(function() {
//table.ajax.url('').load()
currentSource = "https://runkit.io/baiheinet/5aeffc183271ba001234c770/branches/master/drawindex";
table.fnDraw(); //or fnReloadAjax()
});
$("#WeldMap_Index").on( "click", function( event ) {
currentSource = "https://runkit.io/baiheinet/5aeffc183271ba001234c770/branches/master/weldmapindex";
table.fnDraw(); //or fnReloadAjax()
});
});
</script>
</head>
<body class="wide hero" style="">
<a name="top"></a>
<div class="fw-background">
<div>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<div class="fw-container">
<div class="fw-header">
<div class="nav-master">
<div class="nav-item active">
<a href="/">KIPIC项目管理系统-INDEX速查</a>
</div>
</div>
</div>
<div class="fw-hero">
<h1></h1>
<div class="grid">
<div class="unit w-1-3">
<div class="hero-item">
Include these files
<span class="icon i-arrow-down"></span>
</div>
<div class="hero-item">
<span class="number">0</span>
<button id="TestPackage_Index">TestPackage_Index</button>
<span class="icon i-arrow-right"></span>
</div>
<div class="hero-item">
<span class="number">1</span>
<button id="Draw_Index">Draw_Index</button>
<span class="icon i-arrow-right"></span>
</div>
<div class="hero-item">
<span class="number">2</span>
<button id="WeldMap_Index">WeldMap_Index</button>
<span class="icon i-arrow-right"></span>
</div>
<div class="hero-item">
<span class="number">3</span>
Transmittal_Index
<span class="icon i-arrow-right"></span>
</div>
<div class="hero-item">
<span class="number">4</span>
Letter_Index
<span class="icon i-arrow-right"></span>
</div>
<div class="hero-item">
<span class="number">5</span>
Regulation_Index
<span class="icon i-arrow-right"></span>
</div>
</div>
<div class="unit w-2-3">
<div class="hero-callout">
<div id="example_wrapper" class="dataTables_wrapper">
<table id="example" class="display dataTable dtr-inline collapsed" style="width: 100%;" role="grid" aria-describedby="example_info">
<thead>
<tr>
<th>ISO</th>
<th>Date</th>
<th>Rev</th>
<th>Link</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ISO</th>
<th>Date</th>
<th>Rev</th>
<th>Link</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="fw-footer">
<div class="skew"></div>
<div class="skew-bg"></div>
<div class="copyright">
<h4>DataTables表格UI</h4>
<p>
DataTables designed and created by <a href="//sprymedia.co.uk">SpryMedia Ltd</a>.<br>
© 2007-2018 Sinopec Fifth Construction Company Limited.
</p>
</div>
</div>
</div>