Commit 7b233cfe by 吴善钰

网侦预警,添加最后活动地查询条件,添加导出excel功能

parent 35ca8a8b
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<if test="yjqd!=null and yjqd!=''">and YJQD=#{yjqd}</if> <if test="yjqd!=null and yjqd!=''">and YJQD=#{yjqd}</if>
<if test="zplx!=null and zplx!=''">and ZPLX=#{zplx}</if> <if test="zplx!=null and zplx!=''">and ZPLX=#{zplx}</if>
<if test="fkje!=null and fkje!=''">and FKJE=#{fkje}</if> <if test="fkje!=null and fkje!=''">and FKJE=#{fkje}</if>
<if test="zhhdd!=null and zhhdd!=''">and zhhdd like '%' || #{zhhdd} || '%'</if>
ORDER BY JSSJ DESC,YJQD DESC,RKSJ DESC) t ORDER BY JSSJ DESC,YJQD DESC,RKSJ DESC) t
WHERE ROWNUM <![CDATA[<=]]> #{end} WHERE ROWNUM <![CDATA[<=]]> #{end}
) WHERE RN > #{begin} ) WHERE RN > #{begin}
...@@ -50,6 +51,7 @@ ...@@ -50,6 +51,7 @@
<if test="yjqd!=null and yjqd!=''">and YJQD=#{yjqd}</if> <if test="yjqd!=null and yjqd!=''">and YJQD=#{yjqd}</if>
<if test="zplx!=null and zplx!=''">and ZPLX=#{zplx}</if> <if test="zplx!=null and zplx!=''">and ZPLX=#{zplx}</if>
<if test="fkje!=null and fkje!=''">and FKJE=#{fkje}</if> <if test="fkje!=null and fkje!=''">and FKJE=#{fkje}</if>
<if test="zhhdd!=null and zhhdd!=''">and zhhdd like '%' || #{zhhdd} || '%'</if>
</select> </select>
<select id="getWzyjXxById" parameterType="java.lang.String" resultType="com.founder.model.TbStDxzp"> <select id="getWzyjXxById" parameterType="java.lang.String" resultType="com.founder.model.TbStDxzp">
......
...@@ -94,7 +94,7 @@ body{ ...@@ -94,7 +94,7 @@ body{
font-weight:normal; font-weight:normal;
font-size:12px; font-size:12px;
} }
.btn_qk{ .btn_qk{
padding:5px 12px; padding:5px 12px;
border:1px solid #b92c28; border:1px solid #b92c28;
background-color:#d9534f; background-color:#d9534f;
...@@ -122,6 +122,20 @@ body{ ...@@ -122,6 +122,20 @@ body{
font-size:12px; font-size:12px;
margin-left:25px; margin-left:25px;
} }
.btn_export{
padding:5px 12px;
border:1px solid #00D405;
background-color:#427708;
color:#fff;
background-image:linear-gradient(to bottom, #4fd966 0%, #2b8a13 100%);
background-repeat:repeat-x;
text-shadow:0 -1px 0 rgba(0, 0, 0, .2);
box-shadow:inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
border-radius:4px;
font-weight:normal;
font-size:12px;
margin-left:25px;
}
.btn_cx:hover{ .btn_cx:hover{
background:#2c689d; background:#2c689d;
color:#fff; color:#fff;
...@@ -136,7 +150,12 @@ body{ ...@@ -136,7 +150,12 @@ body{
background:#4fb9d9; background:#4fb9d9;
color:#fff; color:#fff;
text-decoration:none; text-decoration:none;
} }
.btn_export:hover{
background:#558026;
color:#fff;
text-decoration:none;
}
/*.table-cx-th td input.ra{ /*.table-cx-th td input.ra{
margin-top:5px; margin-top:5px;
}*/ }*/
......
(function($){
function getRows(target){
var state = $(target).data('datagrid');
if (state.filterSource){
return state.filterSource.rows;
} else {
return state.data.rows;
}
}
function toHtml(target, rows){
rows = rows || getRows(target);
var dg = $(target);
var data = ['<table border="1" rull="all" style="border-collapse:collapse">'];
var fields = dg.datagrid('getColumnFields',true).concat(dg.datagrid('getColumnFields',false));
var trStyle = 'height:32px';
var tdStyle0 = 'vertical-align:middle;padding:0 4px';
data.push('<tr style="'+trStyle+'">');
for(var i=1; i<fields.length; i++){
var col = dg.datagrid('getColumnOption', fields[i]);
var tdStyle = tdStyle0 + ';width:'+col.boxWidth+'px;';
data.push('<th style="'+tdStyle+'">'+col.title+'</th>');
}
data.push('</tr>');
$.map(rows, function(row){
data.push('<tr style="'+trStyle+'">');
for(var i=1; i<fields.length; i++){
var field = fields[i];
//将空值的null,替换为空字符串
if (null == row[field]) {
data.push(
'<td style="'+tdStyle0+'"></td>'
);
} else {
data.push(
'<td style="'+tdStyle0+'">'+row[field]+'</td>'
);
}
}
data.push('</tr>');
});
data.push('</table>');
return data.join('');
}
function toArray(target, rows){
rows = rows || getRows(target);
var dg = $(target);
var fields = dg.datagrid('getColumnFields',true).concat(dg.datagrid('getColumnFields',false));
var data = [];
var r = [];
for(var i=0; i<fields.length; i++){
var col = dg.datagrid('getColumnOption', fields[i]);
r.push(col.title);
}
data.push(r);
$.map(rows, function(row){
var r = [];
for(var i=0; i<fields.length; i++){
r.push(row[fields[i]]);
}
data.push(r);
});
return data;
}
function print(target, param){
var title = null;
var rows = null;
if (typeof param == 'string'){
title = param;
} else {
title = param['title'];
rows = param['rows'];
}
var newWindow = window.open('', '', 'width=800, height=500');
var document = newWindow.document.open();
var content =
'<!doctype html>' +
'<html>' +
'<head>' +
'<meta charset="utf-8">' +
'<title>'+title+'</title>' +
'</head>' +
'<body>' + toHtml(target, rows) + '</body>' +
'</html>';
document.write(content);
document.close();
newWindow.print();
}
function b64toBlob(data){
var sliceSize = 512;
var chars = atob(data);
var byteArrays = [];
for(var offset=0; offset<chars.length; offset+=sliceSize){
var slice = chars.slice(offset, offset+sliceSize);
var byteNumbers = new Array(slice.length);
for(var i=0; i<slice.length; i++){
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
return new Blob(byteArrays, {
type: ''
});
}
function toExcel(target, param){
var filename = null;
var rows = null;
var worksheet = 'Worksheet';
if (typeof param == 'string'){
filename = param;
} else {
filename = param['filename'];
rows = param['rows'];
worksheet = param['worksheet'] || 'Worksheet';
}
var dg = $(target);
var uri = 'data:application/vnd.ms-excel;base64,'
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>{table}</body></html>'
, base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }) }
var table = toHtml(target, rows);
var ctx = { worksheet: worksheet, table: table };
var data = base64(format(template, ctx));
if (window.navigator.msSaveBlob){
var blob = b64toBlob(data);
window.navigator.msSaveBlob(blob, filename);
} else {
var alink = $('<a style="display:none"></a>').appendTo('body');
alink[0].href = uri + data;
alink[0].download = filename;
alink[0].click();
alink.remove();
}
}
$.extend($.fn.datagrid.methods, {
toHtml: function(jq, rows){
return toHtml(jq[0], rows);
},
toArray: function(jq, rows){
return toArray(jq[0], rows);
},
toExcel: function(jq, param){
return jq.each(function(){
toExcel(this, param);
});
},
print: function(jq, param){
return jq.each(function(){
print(this, param);
});
}
});
})(jQuery);
...@@ -122,4 +122,5 @@ function doClear() { ...@@ -122,4 +122,5 @@ function doClear() {
$("#bpfSjhm").textbox('setValue', "") $("#bpfSjhm").textbox('setValue', "")
$("#zplx").textbox('setValue', "") $("#zplx").textbox('setValue', "")
$("#fkje").textbox('setValue', "") $("#fkje").textbox('setValue', "")
} $("#zhhdd").textbox('setValue', "")
\ No newline at end of file }
...@@ -102,6 +102,11 @@ ...@@ -102,6 +102,11 @@
<td width="20%"> <td width="20%">
<input class="easyui-textbox" style="height:26px;width:184px;" type="text" name="zplx" id="zplx"> <input class="easyui-textbox" style="height:26px;width:184px;" type="text" name="zplx" id="zplx">
</td > </td >
<td class="ar" width="13.3%">最后活动地:</td>
<td width="20%">
<input class="easyui-textbox" type="text" style="height:26px;width:184px;" name="zhhdd" id="zhhdd">
</tr>
<tr>
<td class="ar" width="13.3%">处置状态:</td> <td class="ar" width="13.3%">处置状态:</td>
<td width="20%"> <td width="20%">
<input type="radio" style="margin: 0px;" name="czzt" id="jqyx_y" value="0" checked="checked" onclick="doQuery()"><label for="jqyx_y" style='cursor:pointer;background:none;padding-top: 4px;'>未处置&nbsp;&nbsp;&nbsp;</label></input> <input type="radio" style="margin: 0px;" name="czzt" id="jqyx_y" value="0" checked="checked" onclick="doQuery()"><label for="jqyx_y" style='cursor:pointer;background:none;padding-top: 4px;'>未处置&nbsp;&nbsp;&nbsp;</label></input>
...@@ -112,7 +117,7 @@ ...@@ -112,7 +117,7 @@
<td style="text-align:center;line-height:18px;" colspan="6"> <td style="text-align:center;line-height:18px;" colspan="6">
<a class="btn_cx" onclick="doQuery()">查询</a> <a class="btn_cx" onclick="doQuery()">查询</a>
<a class="btn_qk" onclick="doClear()">清空</a> <a class="btn_qk" onclick="doClear()">清空</a>
<a href="javascript:;" class="btn_export" onclick="$('#wzyjtable').datagrid('toExcel','wzyj.xls')">导出Excel</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -145,6 +150,9 @@ ...@@ -145,6 +150,9 @@
<!--- 日期时间--> <!--- 日期时间-->
<script type="text/javascript" src="/common/datepicker/WdatePicker.js"></script> <script type="text/javascript" src="/common/datepicker/WdatePicker.js"></script>
<script type="text/javascript" src="/common/datepicker/calendar.js"></script> <script type="text/javascript" src="/common/datepicker/calendar.js"></script>
<%-- 表格导出excel --%>
<script type="text/javascript" src="/js/datagrid-export.js?1234564"></script>
<%-- 专有js --%>
<script type="text/javascript" src="/js/wzyj.js"></script> <script type="text/javascript" src="/js/wzyj.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var mainUrl="${mainUrl}"; var mainUrl="${mainUrl}";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment