软件需求与分析大作业进度三
一、说在前面
1、今日工作
1)完成网络审核员的审核业务。
2)完成分类检索的功能。
3)完成综合检索。
2、明日目标任务
1)完成统计图表。
2)修补漏洞。
3、遇到的问题
1)昨日问题:2)在改变角色权限是,选中该角色后回显他的原始权限时不需清除上次选择的残留(已解决)
2)在综合检索中,在查出结果后(servlet)返回界面是不能回到第二个选项卡!(已解决)
二、成果:
三、源代码
1、网络审核-报表回显+审核(jsp)
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script src="../js/jquery-1.11.3.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="../css/zTreeStyle/zTreeStyle.css" type="text/css">
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script src="../js/jquery.ztree.all.min.js"></script>
<style type="text/css">
table {
margin: auto;
width: 80%;
text-align: center;
background-color: #E8F6FF;
}
input[type="text"]{
height:30px;
width: 100%;
}
input[type="checkbox"]{
zoom:1.5;
}
input[type="radio"]{
zoom:1.2;
}
h5{
color: #E8F6FF;
}
td{
width: 24%;
font-size:10pt;
}
</style>
<script>
$(function () {
$("#btyx").hide();
$("#tj").hide();
});
function bty() {
$("#btyx").show();
$("#sub").hide();
$("#tj").show();
$("#sfsh").val(2);
}
</script>
</head>
<body style="background-color: #E8F6FF;">
<!-- <form action="${pageContext.request.contextPath }/xvqiu?method=createXvQiu" method="post"> -->
<form action="sh?method=shenhe" method="post">
<input type="text" value="${xvqiu.wjid}" name="wjid" hidden="hidden">
<input type="text" value="1" name="sfsh" id="sfsh" hidden="hidden">
<div style="align-content: center;margin-top: 20px;width: 90%;margin-left: 4%">
<table class="table" border="1">
<tr>
<td colspan="4" ><h1 align="center">河北省重大技术需求征集表</h1></td>
</tr>
<tr>
<td><h3 align="center">机构全称 </h3></td>
<td><input type="text" name="jgmc" id="jgmc" value="${xvqiu.jgmc }" class="form-control"></td>
<td><h3 align="center">通讯地址 </h3></td>
<td><input type="text" name="txdz" id="txdz" value="${xvqiu.txdz }" class="form-control"></td>
</tr>
<tr>
<td><h3 align="center">归口管理部门 </h3></td>
<td><input type="text" name="gkglbm" id="gkglbm" value="${xvqiu.gkglbm }" class="form-control"></td>
<td><h3 align="center">所在地域 </h3></td>
<td>
<input type="text" name="szdy" value="${xvqiu.szdy }" class="form-control">
</td>
</tr>
<tr>
<td><h3 align="center">网 址 </h3></td>
<td><input type="text" name="dwwz" id="dwwz" value="${xvqiu.dwwz }" class="form-control"></td>
<td><h3 align="center">电子信箱 </h3></td>
<td><input type="text" name="dzyx" id="dzyx" value="${xvqiu.dzyx }" class="form-control"></td>
</tr>
<tr>
<td><h3 align="center">法人代表 </h3></td>
<td><input type="text" name="frdb" id="frdb" value="${xvqiu.frdb }" class="form-control"></td>
<td><h3 align="center">邮政编码 </h3></td>
<td><input type="text" name="yzbm" id="yzbm" value="${xvqiu.yzbm }" class="form-control"></td>
</tr>
<tr>
<td><h3 align="center">联 系 人 </h3></td>
<td><input type="text" name="lxr" id="lxr" value="${xvqiu.lxr }" class="form-control"></td>
<td><h3 align="center">固定电话: </h3></td>
<td><input type="text" name="gddh" id="gddh" value="${xvqiu.gddh }" class="form-control"></td>
</tr>
<tr>
<td><h3 align="center">手 机 </h3></td>
<td><input type="text" name="yddh" id="yddh" value="${xvqiu.yddh }" class="form-control"></td>
<td><h3 align="center">机构属性 </h3></td>
<td>
<input type="text" name="jgsx" id="jgsx" value="${xvqiu.jgsx }" class="form-control">
</td>
</tr>
<tr>
<td><h3 align="center">机构简介: </h3></td>
<td colspan="3" align="center">
<textarea style="height: 100px;width: 100%" name="jgjj" id="content"
maxlength="500" onchange="this.value=this.value.substring(0,500)" onkeydown="this.value=this.value.substring(0,500)" onkeyup="this.value=this.value.substring(0,500)"
>${xvqiu.jgjj }
</textarea>
</td>
</tr>
<tr>
<td><h3 align="center">技术需求名称 </h3></td>
<td><input type="text" name="jsxqmc" id="jsxqmc" value="${xvqiu.jsxqmc }" class="form-control"></td>
<td><h3 align="center">传 真 </h3></td>
<td><input type="text" name="cz" id="cz" value="${xvqiu.cz }" class="form-control"></td>
</tr>
<tr>
<td><h3 align="center">起始需求年份 </h3></td>
<td><input type="text" name="qsxqnf" id="qsxqnf" value="${xvqiu.qsxqnf }" class="form-control"></td>
<td><h3 align="center">截至需求年份 </h3></td>
<td><input type="text" name="jzxqnf" id="jzxqnf" value="${xvqiu.jzxqnf }" class="form-control"></td>
</tr>
<tr >
<td><h3 align="center">1、主要问题 </h3></td>
<td colspan="3" align="center">
<textarea style="height: 200px;width: 100%" name="zywt" id="zywt" class="form-control"
maxlength="500" onchange="this.value=this.value.substring(0,500)" onkeydown="this.value=this.value.substring(0,500)" onkeyup="this.value=this.value.substring(0,500)"
>
${xvqiu.zywt }
</textarea></td>
</tr>
<tr>
<td><h3 align="center">2、技术关键 </h3></td>
<td colspan="3" align="center">
<textarea style="height: 200px;width: 100%" name="jsgj" id="jsgj" class="form-control"
maxlength="500" onchange="this.value=this.value.substring(0,500)" onkeydown="this.value=this.value.substring(0,500)" onkeyup="this.value=this.value.substring(0,500)"
>
${xvqiu.jsgj }
</textarea></td>
</tr>
<tr>
<td><h3 align="center"> 3、预期目标 </h3></td>
<td colspan="3" align="center">
<textarea style="height: 200px;width: 100%" name="tqmb" id="yqmb" class="form-control"
maxlength="500" onchange="this.value=this.value.substring(0,500)" onkeydown="this.value=this.value.substring(0,500)" onkeyup="this.value=this.value.substring(0,500)"
>
${xvqiu.tqmb }
</textarea></td>
</tr>
<tr>
<td><h3 align="center">关 键 字 </h3></td>
<td>
<input type="text" name="gjz" id="gjz" value="${xvqiu.gjz }" class="form-control">
</td>
<td align="center"><h3 >科技活动类型 </h3></td>
<td >
<input type="text" name="yjlx" id="jcyj" value="${xvqiu.yjlx }" class="form-control">
</td>
</tr>
<tr id="xkflx">
<td align="center"><h3 >学科分类 </h3></td>
<td >
<input type="text" name="xkfl" value="${xvqiu.xkfl }" class="form-control">
</td>
<td align="center"><h3 >需求技术所属领域 </h3></td>
<td >
<input type="text" id="xqjsssly" name="xqjsssly" value="${xvqiu.xqjsssly }" class="form-control">
</td>
</tr>
<tr id="xqjsyyhyx">
<td align="center"><h3 >需求技术应用行业 </h3></td>
<td>
<input type="text" name="xqjsyyhy" value="${xvqiu.xqjsyyhy }" class="form-control">
</td>
<td align="center"><h3 >技术需求解决方式 </h3></td>
<td >
<input type="text" id="dl" name="jsxqhzms" value="${xvqiu.jsxqhzms }" class="form-control">
</td>
</tr>
<tr>
<td align="center"><h3 >资金需求总额 </h3></td>
<td><input type="text" name="zjxqze" id="zjxqze" value="${xvqiu.zjxqze }" class="form-control"></td>
<td><h3 >拟投入自有资金总额 </h3></td>
<td><input type="text" name="zyzj" id="zyzj" value="${xvqiu.zyzj }" class="form-control"></td>
</tr>
<tr id="btyx">
<td><h3 align="center"> 意见和建议 </h3></td>
<td colspan="3" align="center">
<textarea style="height: 200px;width: 100%" name="yj" id="yj" class="form-control"
maxlength="500" onchange="this.value=this.value.substring(0,500)" onkeydown="this.value=this.value.substring(0,500)" onkeyup="this.value=this.value.substring(0,500)"
>请说明不同意的原因!
</textarea></td>
</tr>
<tr>
<td colspan="2" id="sub"> <input type="submit" value="同意" class="btn btn-default" ></td>
<td colspan="2"> <input type="button" value="不同意" class="btn btn-default" onclick="bty()"></td>
<td colspan="2" id="tj"> <input type="submit" value="提交" class="btn btn-default" ></td>
</tr>
</table>
</div>
</form>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
<h5>111111111111</h5>
</body>
</html>
2、统计查询(jsp)
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<title>首页</title>
<!-- Bootstrap -->
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
rel="stylesheet">
<!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
<!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
<script
src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
<style>
p {
font-size: 16px;
margin-top: 10px;
}
</style>
<script>
$(function () {
//document.getElementById("here").click();
var location_id='${kid}';
if(location_id!=''){
document.getElementById(location_id).click();
}
});
</script>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="tabbable" id="tabs-451449">
<ul class="nav nav-tabs">
<li class="active">
<a href="#panel-169507" data-toggle="tab">分类检索</a>
</li>
<li>
<a id="here" href="#panel-638308" data-toggle="tab">综合检索</a>
</li>
<li>
<a href="#panel-638309" data-toggle="tab">统计图表</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="panel-169507">
<div class="row-fluid">
<div class="span12">
<form method="post" action="cx?method=flcx">
<p>
时效状态:
<select name="sxzt" id="sxzt" class="form-control"
style="width: 100px;display: inline">
<option>选择</option>
<option value="1">有效</option>
<option value="0">无效</option>
</select>
标引条件:
<select name="bytj" id="bytj" class="form-control"
style="width: 200px;display: inline">
<option value="jgmc">机构全称</option>
<option value="gkglbm">归口管理单位</option>
<option value="szdy">所在地域</option>
<option value="frdb">法人代表</option>
<option value="lxr">联系人</option>
<option value="jgsx">机构属性</option>
<option value="jsxqmc">技术需求名称</option>
<option value="gjz">关键字</option>
<option value="zjxqze">拟投入资金总额</option>
<option value="jsxqhzms">技术需求解决方式</option>
<option value="yjlx">科技活动类型</option>
<option value="xkfl">学科分类</option>
<option value="xqjsssly">需求技术所属领域</option>
<option value="xqjsyyhy">需求技术应用行业</option>
</select>
<input type="text" name="bytjz" class="form-control"
style="width: 150px;display: inline">
<select name="sfmh" id="sfmh" class="form-control"
style="width: 150px;display: inline">
<option value="1">模糊查询</option>
<option value="0">精准查询</option>
</select>
</p>
<p>
日期条件:
从
<input type="date" name="qxsj" class="form-control"
style="width: 150px;display: inline">
到
<input type="date" name="jzsj" class="form-control"
style="width: 150px;display: inline">
<input type="submit" value="查询" class="form-control"
style="width: 100px;display: inline">
</p>
</form>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<table class="table table-hover table-bordered">
<!-- class="table table-bordered" -->
<thead>
<tr>
<th>需求编号</th>
<th>技术需求名称</th>
<th>机构属性</th>
<th>所在地域</th>
<th>机构全称</th>
<th>法人代表</th>
<th>归口管理单位</th>
<th>拟投入资金总额</th>
<th>科技活动类型</th>
</tr>
</thead>
<tbody>
<c:forEach var="item" items="${xvQiuList}">
<tr>
<td>${item.wjid}</td>
<td><a href="xvqiu?method=queryById&wjid=${item.wjid}">${item.jsxqmc}</a>
</td>
<td>${item.jgsx}</td>
<td>${item.szdy}</td>
<td>${item.jgmc}</td>
<td>${item.frdb}</td>
<td>${item.gkglbm}</td>
<td>${item.zjxqze}</td>
<td>${item.yjlx}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane" id="panel-638308">
<div class="row-fluid">
<div class="span12">
<table class="table table-bordered">
<tr>
<td width="15%">控制条件</td>
<td width="84%">
<table name="tbl" id="tbl" class="table table-bordered">
<tr>
<td>
<button onclick="insert_row()" style="width: 130px;display: inline" class="form-control">添加查询条件</button>
<button onclick="deleteRow(this)" style="width: 130px;display: inline" class="form-control">删除查询条件</button>
</td>
</tr>
<tr>
<td>
<select id="h1" name="h" class="form-control"
style="width: 100px;display: inline">
<option value="1">并且</option>
<option value="2">或者</option>
<option value="3">不含</option>
</select>
<select id="type1" name="type1" class="form-control"
style="width: 150px;display: inline">
<option value='jgmc'>机构全称</option>
<option value='gkglbm'>归口管理单位</option>
<option value='szdy'>所在地域</option>
<option value='frdb'>法人代表</option>
<option value='lxr'>联系人</option>
<option value='jgsx'>机构属性</option>
<option value='jsxqmc'>技术需求名称</option>
<option value='gjz'>关键字</option>
<option value='zjxqze'>拟投入资金总额</option>
<option value='jsxqhzms'>技术需求解决方式</option>
<option value='yjlx'>科技活动类型</option>
<option value='xkfl'>学科分类</option>
<option value='xqjsssly'>需求技术所属领域</option>
<option value='xqjsyyhy'>需求技术应用行业</option>
</select>
<input type="text" id="SearchBox1" name="SearchBox1"
class="form-control"
style="width: 150px;display: inline">
<select id="t1" name="t1" class="form-control"
style="width: 100px;display: inline">
<option value='1'>模糊</option>
<option value='0'>精确</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<form action="cx?method=zhjs" method="post" onsubmit="return Submit()">
<tr>
<td width="15%">时间条件</td>
<td width="84%">
<p>
日期条件:
从
<input type="date" name="qxsj" class="form-control"
style="width: 150px;display: inline">
到
<input type="date" name="jzsj" class="form-control"
style="width: 150px;display: inline">
</p>
</td>
</tr>
<tr>
<td colspan="2">
<input type="text" name="sql" id="sql" hidden="hidden" style="width: 80%">
<input type="submit" value="查询" class="form-control"
style="width: 150px;display: inline;margin-left: 85%">
</td>
</tr>
</table>
</form>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<table class="table table-hover table-bordered">
<!-- class="table table-bordered" -->
<thead>
<tr>
<th>需求编号</th>
<th>技术需求名称</th>
<th>机构属性</th>
<th>所在地域</th>
<th>机构全称</th>
<th>法人代表</th>
<th>归口管理单位</th>
<th>拟投入资金总额</th>
<th>科技活动类型</th>
</tr>
</thead>
<tbody>
<c:forEach var="item" items="${xvQiuList}">
<tr>
<td>${item.wjid}</td>
<td><a href="xvqiu?method=queryById&wjid=${item.wjid}">${item.jsxqmc}</a>
</td>
<td>${item.jgsx}</td>
<td>${item.szdy}</td>
<td>${item.jgmc}</td>
<td>${item.frdb}</td>
<td>${item.gkglbm}</td>
<td>${item.zjxqze}</td>
<td>${item.yjlx}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane" id="panel-638309">
<div class="row-fluid">
<div class="span12">
<table class="table table-hover table-bordered">
<!-- class="table table-bordered" -->
<thead>
<tr>
<th>需求编号</th>
<th>技术需求名称</th>
<th>机构属性</th>
<th>所在地域</th>
<th>机构全称</th>
<th>法人代表</th>
<th>归口管理单位</th>
<th>拟投入资金总额</th>
<th>科技活动类型</th>
</tr>
</thead>
<tbody>
<c:forEach var="item" items="${xvQiuList}">
<tr>
<td>${item.wjid}</td>
<td><a href="xvqiu?method=queryById&wjid=${item.wjid}">${item.jsxqmc}</a>
</td>
<td>${item.jgsx}</td>
<td>${item.szdy}</td>
<td>${item.jgmc}</td>
<td>${item.frdb}</td>
<td>${item.gkglbm}</td>
<td>${item.zjxqze}</td>
<td>${item.yjlx}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
<div class="row-fluid">
<div class="span12">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
var i = 1;
var first = 1;
function insert_row() {
if (i - first >= 5) {
alert("不能再加了");
return;
}
i++;
R = tbl.insertRow() //insertRow() 方法用于在表格中的指定位置插入一个新行。
C1 = R.insertCell() //insertCell() 方法用于在 HTML 表的一行的指定位置插入一个空的 <td> 元素。
//C2 = R.insertCell()
C1.innerHTML = "<select id='h" + i + "' name='h" + i + "' class='form-control' style='width: 100px;display: inline'>" +
"<option value='1' >并且</option>" +
"<option value='2' >或者</option>" +
"<option value='3'>不含</option>" +
"</select>" + "<select id='type" + i + "' name='type" + i + "' class='form-control' style='width: 150px;display: inline;margin-left: 5px'>" +
"<option value='jgmc'>机构全称</option>" +
"<option value='gkglbm'>归口管理单位</option>" +
"<option value='szdy'>所在地域</option>" +
"<option value='frdb'>法人代表</option>" +
"<option value='lxr'>联系人</option>" +
"<option value='jgsx'>机构属性</option>" +
"<option value='gjz'>关键字</option>" +
"<option value='zjxqze'>拟投入资金总额</option>" +
"<option value='jsxqhzms'>技术需求解决方式</option>" +
"<option value='yjlx'>科技活动类型</option>" +
"<option value='xkfl'>学科分类</option>" +
"<option value='xqjsssly'>需求技术所属领域</option>" +
"<option value='xqjsyyhy'>需求技术应用行业</option>" +
"</select>" + " <input id='SearchBox" + i + "' name='SearchBox" + i + "' class='form-control' style='width: 150px;display: inline'/>"+
"<select id='t" + i + "' name='t" + i + "' class='form-control' style='width: 100px;display: inline;margin-left: 5px'>" +
"<option value='1' >模糊</option>" +
"<option value='0' >精确</option>" +
"</select>"
if (i % 14 == 2) {
$("#type" + i + " option[value='gkglbm']").prop("selected", true);
} else if (i % 14 == 3) {
$("#type" + i + " option[value='szdy']").prop("selected", true);
} else if (i % 14 == 4) {
$("#type" + i + " option[value='frdb']").prop("selected", true);
} else if (i % 14 == 5) {
$("#type" + i + " option[value='lxr']").prop("selected", true);
} else if (i % 14 == 6) {
$("#type" + i + " option[value='jgsx']").prop("selected", true);
} else if (i % 14 == 7) {
$("#type" + i + " option[value='jsxqmc']").prop("selected", true);
} else if (i % 14 == 8) {
$("#type" + i + " option[value='gjz']").prop("selected", true);
} else if (i % 14 == 9) {
$("#type" + i + " option[value='zjxqze']").prop("selected", true);
} else if (i % 14 == 0) {
$("#type" + i + " option[value='jsxqhzms']").prop("selected", true);
}
/*else if (i % 14 == 3) {
$("#type" + i + " option[value='yjlx']").prop("selected", true);
} else if (i % 14 == 4) {
$("#type" + i + " option[value='xkfl']").prop("selected", true);
} else if (i % 14 == 5) {
$("#type" + i + " option[value='xqjsssly']").prop("selected", true);
} else if (i % 14 == 0) {
$("#type" + i + " option[value='xqjsyyhy']").prop("selected", true);
}*/
}
function deleteRow(obj) {
alert("确定删除一行吗?");
if (i - first < 1) {
alert("不能再删除了");
return;
}
tbl.deleteRow(obj.parentElement.parentElement.rowIndex);
first++;
}
function Submit() {
var url = "chaxun?sql = ";
var sql = "select * from t_dcwjxx where 1=1 "
for (var j = first; j <= i; j++) {
var y = $("#type" + j + " option:selected").val();
var box = "SearchBox" + j;
var t = $("#t" + j + " option:selected").val();
var h = $("#h" + j + " option:selected").text();
//alert(t);
var input = document.getElementById(box).value;
if (j <= i) {
if (h == "并且") {
sql += " and ";
}
if (h == "或者") {
sql += " or ";
}
}
if (h == "不含") {
sql += " and " + y +" != '"+ input + "' ";
} else {
if(t=="1"){
sql += y+" like '%" + input + "%'";
}else {
sql += y+"= '" + input + "' ";
}
}
}
//alert(sql);
$("#sql").attr("value", sql);
//alert(sql);
//url+=sql;
//window.location.href = url;<button id="Button" type="button" onclick="Submit()">查询</button>
//return true;
}
</script>
</html>
3、网络审核(servlet)
package com.me.servlet;
import com.me.dao.ShenHeDao;
import com.me.domain.XvQiu;
import org.apache.commons.beanutils.BeanUtils;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
/**
* @Auther: wzs
* @Date: 2020/10/21 18:22
* @Description:
*/
@WebServlet("/templete/sh")
public class ShenHeServlet extends HttpServlet {
private ShenHeDao dao = new ShenHeDao();
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request,response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String method = request.getParameter("method");
System.out.println(method);
if(method.equals("shenhe")){
shenhe(request,response);
}
}
private void shenhe(HttpServletRequest request, HttpServletResponse response) {
Map<String, String[]> map = request.getParameterMap();
XvQiu xvQiu = new XvQiu();
try {
BeanUtils.populate(xvQiu, map);
boolean f = dao.shenhe(xvQiu);
request.getRequestDispatcher("mywj.jps").forward(request,response);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
4、网络审核(dao)
package com.me.dao;
import com.me.domain.XvQiu;
import com.me.utils.DBUtils;
import org.apache.commons.dbutils.QueryRunner;
import java.sql.SQLException;
/**
* @Auther: wzs
* @Date: 2020/10/21 18:39
* @Description:
*/
public class ShenHeDao {
public boolean shenhe(XvQiu xvQiu) {
QueryRunner qr =new QueryRunner(DBUtils.getDataSource());
String sql="update t_dcwjxx set sfsh = ?,yj=? where wjid=? ";
int n = 0;
try {
n = qr.update(sql,xvQiu.getSfsh(),xvQiu.getYj(),xvQiu.getWjid());
} catch (SQLException e) {
e.printStackTrace();
}
if (n > 0) {
return true;
} else {
return false;
}
}
}
5、统计查询(servlet)
package com.me.servlet;
import com.me.dao.ChaXunDao;
import com.me.domain.XvQiu;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @Auther: wzs
* @Date: 2020/10/21 19:54
* @Description:
*/
@WebServlet("/templete/cx")
public class ChaXunServlet extends HttpServlet {
private ChaXunDao dao = new ChaXunDao();
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request,response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String method = request.getParameter("method");
System.out.println(method);
if(method.equals("flcx")){
flcx(request,response);
}else if(method.equals("zhjs")){
zhjs(request,response);
}
}
private void zhjs(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String sql = request.getParameter("sql");
String qxsj = request.getParameter("qxsj");
String jzsj = request.getParameter("jzsj");
List<XvQiu> list = dao.zhjs(sql,qxsj,jzsj);
request.setAttribute("xvQiuList", list);
request.setAttribute("kid","here");
//System.out.println(xvQiuList.get(0).getModel()+"123");
if(list==null) {
response.getWriter().write("加载失败!");
}else {
request.getRequestDispatcher("tongji.jsp").forward(request, response);
}
}
private void flcx(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String sxzt = request.getParameter("sxzt");
String bytj = request.getParameter("bytj");
String bytjz = request.getParameter("bytjz");
String sfmh = request.getParameter("sfmh");
String qxsj = request.getParameter("qxsj");
String jzsj = request.getParameter("jzsj");
List<XvQiu> list = dao.flcx(sxzt,bytj,bytjz,sfmh,qxsj,jzsj);
request.setAttribute("xvQiuList", list);
//System.out.println(xvQiuList.get(0).getModel()+"123");
if(list==null) {
response.getWriter().write("加载失败!");
}else {
request.getRequestDispatcher("tongji.jsp").forward(request, response);
}
}
}
6、统计查询(dao)
package com.me.dao;
import com.me.domain.XvQiu;
import com.me.utils.DBUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import java.sql.SQLException;
import java.util.List;
/**
* @Auther: wzs
* @Date: 2020/10/21 20:05
* @Description:
*/
public class ChaXunDao {
public List<XvQiu> flcx(String sxzt, String bytj, String bytjz, String sfmh, String qxsj, String jzsj) {
QueryRunner qr = new QueryRunner(DBUtils.getDataSource());
String sql = "select * from t_dcwjxx where 1=1 ";
if(sfmh.equals("1")){
if(bytj!=null){
sql += " and "+bytj +" like '%"+bytjz+"%'";
}
}else {
if(bytj!=null){
sql += " and "+bytj +" = '"+bytjz+"'";
}
}
if(qxsj!=null&&!qxsj.equals("")){
sql += "and date > '" +qxsj+"' and date < '"+jzsj+"'";
}
List<XvQiu> query = null;
try {
query = qr.query(sql, new BeanListHandler<XvQiu>(XvQiu.class));
} catch (SQLException e) {
e.printStackTrace();
}
return query;
}
public List<XvQiu> zhjs(String sql, String qxsj, String jzsj) {
QueryRunner qr = new QueryRunner(DBUtils.getDataSource());
if(qxsj!=null&&!qxsj.equals("")){
sql += " and date > '" +qxsj+"' and date < '"+jzsj+"'";
}
List<XvQiu> query = null;
try {
query = qr.query(sql, new BeanListHandler<XvQiu>(XvQiu.class));
} catch (SQLException e) {
e.printStackTrace();
}
return query;
}
}