输入框自动补全
程序员文章站
2022-03-03 19:51:25
...
<%@page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>订单数据查询</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="<%=basePath %>css/searchbox.css">
<script type="text/javascript" src="<%=basePath %>js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=basePath %>jsp/five/ipm/plugin/auto.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath %>jsp/five/ipm/plugin/auto.css">
<script language="javascript" type="text/javascript" src="<%=basePath %>/js/My97DatePicker/WdatePicker.js"></script>
<style>
.auto_hidden {
width:204px;border-top: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #000;
border-right: 1px solid #000;
position:absolute;
display:none;
}
.auto_show {
width:204px;line-height:20px;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
border-left: 1px solid #000;
border-right: 1px solid #000;
position:absolute;
z-index:9999; /* 设置对象的层叠顺序 */
display:block;
}
.auto_onmouseover{
color:#ffffff;
background-color:highlight;
width:100%;
}
.auto_onmouseout{
color:#000000;
width:100%;
background-color:#ffffff;
}
.div{
width:350px;
height:35px;
line-height:35px;
}
.div .input{
height:25px;
}
.div .input120{
height:25px;
}
.button{
text-align:center;
}
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px white inset;
}
input{
outline: none;
background-color: transparent;
margin-left: 5px;
border-style: none;
border-bottom: 1px dotted #000;
margin-left: 10px;
}
</style>
</head>
<body>
<div class="body">
<fieldset style="color:#000;">
<legend>订单数据查询条件输入</legend>
<div class="div"> 产品型号:<input type="text" class="input" id="_protype" onkeyup="getKey('_protype','<%=basePath%>bom/getListByProtype.do');"></div>
<div class="_tishi" id="_protype_tishi"></div>
<div class="div"> 订单号:<input class="input" type="text" id="_dingdan" name="_dingdan" onkeyup="getKey('_dingdan','<%=basePath%>plan/getListByDingdan.do');"/></div>
<div class="_tishi" id="_dingdan_tishi"></div>
<div class="div"> 生产批号:<input class="input" type="text" id="_lot" name="_lot" onkeyup="getKey('_lot','<%=basePath%>plan/getListByLot.do');"/></div>
<div class="_tishi" id="_lot_tishi"></div>
<div class="div"> 晶圆批号:<input class="input" type="text" id="_pihao" name="_pihao" onkeyup="getKey('_pihao','<%=basePath%>plan/getListByPihao.do');"/></div>
<div class="_tishi" id="_pihao_tishi"></div>
<div class="div">下单时间_S:<input class="input120" type="text" onClick="WdatePicker()" id="_inputdateS" name="_inputdateS"/></div>
<div class="div">下单时间_E:<input class="input120" type="text" onClick="WdatePicker()" id="_inputdateE" name="_inputdateE"/></div>
<div class="div">结单时间_S:<input class="input120" type="text" onClick="WdatePicker()" id="_overTimeS" name="_overTimeS"/></div>
<div class="div">结单时间_S:<input class="input120" type="text" onClick="WdatePicker()" id="_overTimeE" name="_overTimeE"/></div>
<div class="button">
<input class="_link" type="button" onclick="check();" value="信息搜索"/> <input class="_fresh" type="button" onclick="javascript:window.location.reload();" value="刷新"/>
</div>
</fieldset>
</div>
</body>
<script type="text/javascript">
function check(){
console.log("xxx");
var _protype = $('#_protype').val();
var _dingdan = $('#_dingdan').val();
var _lot = $('#_lot').val();
var _pihao = $('#_pihao').val();
var _inputdateS = $('#_inputdateS').val();
var _inputdateE = $('#_inputdateE').val();
var _overTimeS = $('#_overTimeS').val();
var _overTimeE = $('#_overTimeE').val();
if((_protype == null || _protype == "") &&
(_dingdan == null || _dingdan == "") &&
(_lot == null || _lot == "") &&
(_pihao == null || _pihao == "") &&
(_inputdateS == null || _inputdateS == "") &&
(_inputdateE == null || _inputdateE == "") &&
(_overTimeS == null || _overTimeS == "") &&
(_overTimeE == null || _overTimeE == "")){
alert("请输入查询条件!");
return ;
}
var url = "ipmsearch/toSearchDDListUI.do?_pihao="+_pihao+"&_lot="+_lot+"&_dingdan="+_dingdan+"&_protype="+_protype+"&_inputdateS="+_inputdateS+"&_inputdateE="+_inputdateE+
"&_overTimeS="+_overTimeS+"&_overTimeE="+_overTimeE;
window.open(url,'SearchDDListUI');
}
</script>
</html>
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
public void toSearchDDList(HttpServletRequest request) {
List<String> title = new ArrayList<String>();
String _protype = res.getParameter(request, "_protype", "");
String _dingdan = res.getParameter(request, "_dingdan", "");
String _pihao = res.getParameter(request, "_pihao", "");
String _lot = res.getParameter(request, "_lot", "");
if (res.getParameter(request, "_lot", "").length() > 8) {
_lot = res.getParameter(request, "_lot", "").substring(0, 8);
} else {
_lot = res.getParameter(request, "_lot", "");
}
String _inputdateS = "".equals(res.getParameter(request, "_inputdateS", "")) ? ""
: res.getParameter(request, "tf_inputdateS", "") + " 08:30";
String _inputdateE = "".equals(res.getParameter(request, "_inputdateE", "")) ? ""
: res.getParameter(request, "tf_inputdateE", "") + " 08:30";
String _overTimeS = "".equals(res.getParameter(request, "_overTimeS", "")) ? ""
: res.getParameter(request, "tf_overTimeS", "") + " 08:30";
String _overTimeE = "".equals(res.getParameter(request, "_overTimeE", "")) ? ""
: res.getParameter(request, "tf_overTimeE", "") + " 08:30";
int len = title.size();
String sql = "select p.*,b._protype from _Plan p,_PlanBom b where p._dingdan = b._dingdan ";
if (!"".equals(_protype)) {
len++;
title.add(getIndex(len) + ":产品型号_" + _protype);
sql += " and b._protype = '" + _protype + "'";
}
if (!"".equals(_dingdan)) {
len++;
title.add(getIndex(len) + ":订单号_" + _dingdan);
sql += " and b._dingdan = '" + _dingdan + "'";
}
if (!"".equals(_lot)) {
len++;
title.add(getIndex(len) + ":生产批号_" + _lot);
sql += " and p._lot like '" + _dingdan + "%'";
}
if (!"".equals(_pihao)) {
len++;
title.add(getIndex(len) + ":晶圆批号_" + _pihao);
sql += " and p._zph = '" + _pihao + "'";
}
if (!"".equals(_inputdateS) && !"".equals(_inputdateE)) {
len++;
title.add(getIndex(len) + ":下单时间_" + _inputdateS + "~" + _inputdateE);
sql += " and p._inputdate between '" + _inputdateS + "' and '" + _inputdateE + "'";
}
if (!"".equals(_overTimeS) && !"".equals(_overTimeE)) {
len++;
title.add(getIndex(len) + ":结单时间_" + _overTimeS + "~" + _overTimeE);
sql += " and p._overdate between '" + _overTimeS + "' and '" + _overTimeE + "'";
}
String res = "查询条件列表:<br/>";
for (int j = 0; j < title.size(); j++) {
res = res + title.get(j) + "<br/>";
}
sql += " order by p._inputdate desc";
System.out.println(sql);
List<?> list = DBUtils.getListBy(sql, _Plan.class);
// JSONArray result = SearchUtils.getResult(Sql,
// "tf_id,tf_dingdan,tf_slot,tf_elot,tf_inputdate,tf_encfor,tf_protype,tf_overFlag,tf_jyaph,tf_jybph,tf_logo_src,tf_pro,tf_yw");
request.setAttribute("result", list);
request.setAttribute("title", res);
}