ad5081d3
孙向锦
初始化项目
|
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
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="<%=basePath%>">
<!-- jsp文件头和头部 -->
<%@ include file="../../system/index/top.jsp"%>
</head>
<body class="no-skin">
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
<!-- /section:basics/sidebar -->
<div class="main-content">
<div class="main-content-inner">
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<div id="accordion" class="accordion-style1 panel-group" style="margin-top:20px;width: 100%;">
<c:if test="${QX.edit == 1 }">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false">
<i class="bigger-110 ace-icon fa fa-angle-right" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i>
SQL脚本编辑语句
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseOne" aria-expanded="false" style="height: 0px;">
<div class="panel-body">
<div style="float: left;width: 89%;">
<textarea title="INSERT、UPDATE 或 DELETE 语句" style="width: 100%;" id="updateSQL"></textarea>
</div>
<div style="float: right;margin-top:10px;">
<a class="btn btn-success btn-sm" onclick="executeUpdate();">
<i class="ace-icon glyphicon glyphicon-play"></i>
</a>
</div>
</div>
</div>
</div>
</c:if>
<c:if test="${QX.cha == 1 }">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false">
<i class="bigger-110 ace-icon fa fa-angle-right" data-icon-hide="ace-icon fa fa-angle-down" data-icon-show="ace-icon fa fa-angle-right"></i>
SQL脚本查询语句
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="collapseTwo" aria-expanded="false" style="height: 0px;">
<div class="panel-body">
<div style="float: left;width: 89%;">
<textarea title="SELECT语句" style="width: 100%;" id="querySQL"></textarea>
</div>
<div style="float: right;margin-top:10px;">
<a class="btn btn-success btn-sm" onclick="executeQuery();">
<i class="ace-icon glyphicon glyphicon-play" ></i>
</a>
</div>
</div>
</div>
</div>
</c:if>
</div>
<div style="overflow: scroll; scrolling: yes;width: 100%;">
<table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:0px;">
<thead id="theadid">
<tr id="columnList">
<th>字段</th>
</tr>
</thead>
<tbody id="valuelist">
<tr class='center'>
<td>数据显示区</td>
</tr>
</tbody>
</table>
</div>
<table style="margin-top:10px;">
<tr bgcolor="#F1F8FD" style="height:26px;">
<td class="center">
<div style="width:120px;" id="theadid2">查询时间 s</div>
</td>
<td class="center">
<div style="width:120px;" id="fhcount">共 条</div>
</td>
<td class="center">
<div id="exceldiv">
<c:if test="${QX.toExcel == 1 }"><td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="toExcel();" title="导出到EXCEL"><i id="nav-search-icon" class="ace-icon fa fa-download bigger-110 nav-search-icon blue"></i></a></td></c:if>
</div>
</td>
</tr>
</table>
<textarea rows="" cols="" id="sqlstrforExcel" style="display: none;"></textarea>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.page-content -->
</div>
</div>
<!-- /.main-content -->
<!-- 返回顶部 -->
<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
</a>
</div>
<!-- /.main-container -->
<!-- basic scripts -->
<!-- 页面底部js¨ -->
<%@ include file="../../system/index/foot.jsp"%>
<!-- ace scripts -->
<script src="static/ace/js/ace/ace.js"></script>
<!-- 确认窗口 -->
<script src="static/ace/js/bootbox.js"></script>
<!--提示框-->
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
<script type="text/javascript">
$(top.hangge());
</script>
<c:if test="${QX.edit == 1 }">
<script type="text/javascript">
//执行编辑语句
function executeUpdate(){
var sql = $("#updateSQL").val();
if("" == sql){
$("#updateSQL").tips({
side:1,
msg:'什么也没输入!',
bg:'#cc0033',
time:3
});
return;
}
top.jzts();
$.ajax({
type: "POST",
url: '<%=basePath%>sqledit/executeUpdate.do?tm='+new Date().getTime(),
data: {sql:sql},
dataType:'json',
//beforeSend: validateData,
cache: false,
success: function(data){
$.each(data.list, function(i, list){
if("ok" == list.msg){
$("#updateSQL").tips({
side:1,
msg:'执行成功, 查询时间:'+list.rTime+' s',
bg:'#009933',
time:10
});
}else{
$("#updateSQL").tips({
side:3,
msg:'查询失败,sql语句错误或非查询语句or查询数据库连接错误',
bg:'#cc0033',
time:15
});
}
top.hangge();
});
}
});
}
</script>
</c:if>
<c:if test="${QX.cha == 1 }">
<script type="text/javascript">
//执行查询语句
function executeQuery(){
var sql = $("#querySQL").val();
if("" == sql){
$("#querySQL").tips({
side:1,
msg:'什么也没输入!',
bg:'#cc0033',
time:3
});
return;
}
top.jzts();
$.ajax({
type: "POST",
url: '<%=basePath%>sqledit/executeQuery.do?tm='+new Date().getTime(),
data: {sql:sql},
dataType:'json',
//beforeSend: validateData,
cache: false,
success: function(data){
$.each(data.list, function(i, list){
if("ok" == list.msg){
$("#theadid").tips({
side:1,
msg:'查询时间:'+list.rTime+' s',
bg:'#009933',
time:15
});
$("#theadid2").html('查询时间:'+list.rTime+' s');
$("#columnList").html(''); //初始清空字段名称
$("#valuelist").html(''); //初始清空值列表
$.each(data.columnList, function(m, column){ //列出字段名
$("#columnList").append(
'<th>'+column+'</th>'
);
});
var fhcount = 0;
$.each(data.dataList, function(n, fhdata){ //列出每条记录
var str1 = '<tr>';
var str2 = '';
$.each(fhdata, function(f, fhvalue){ //列出字段名
str2 += '<td>'+fhvalue+'</d>';
});
var str3 = '</tr>';
$("#valuelist").append(str1+str2+str3);
fhcount ++;
});
$("#fhcount").html('共 '+fhcount+' 条');
$("#sqlstrforExcel").val(sql);
}else{
$("#querySQL").tips({
side:1,
msg:'查询失败,sql语句错误或非查询语句or查询数据库连接错误',
bg:'#cc0033',
time:15
});
}
top.hangge();
});
}
});
}
//导出excel
function toExcel(){
var sqlstrforExcel = $("#sqlstrforExcel").val();
if("" == sqlstrforExcel){
bootbox.dialog({
message: "<span class='bigger-110'>什么数据都没有,你导出什么?</span>",
buttons:
{
"button" :
{
"label" : "确定",
"className" : "btn-sm btn-success"
}
}
});
return
}else{
window.location.href='<%=basePath%>sqledit/excel.do?sql='+sqlstrforExcel;
}
}
</script>
</c:if>
</body>
</html>
|