Преглед изворни кода

经销商添加搜索功能 生产线数据添加生产线筛选条件

pete пре 1 година
родитељ
комит
62f8cb0115

+ 1 - 0
src/main/java/com/qlm/controller/common/CommonController.java

@@ -157,6 +157,7 @@ public class CommonController extends Controller{
 					}else{
 						whereSql+= " where ";
 					}
+					para = para.replace("\n","");
 					if("input".equals(type)){
 						whereSql += " "+nameKey+" like '%"+para+"%'";	
 					}else if("select".equals(type)){

+ 11 - 1
src/main/webapp/page/jinzai/jxs.jsp

@@ -2,6 +2,11 @@
 	pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
 <c:set var="title" value="经销商列表"></c:set>
+<style>
+	.col-sm-1{
+		width:100px !important;
+	}
+</style>
 <script>
 var dataFormat = [
                   {
@@ -43,8 +48,13 @@ var dataFormat = [
                     
                    
             ];
-var config = { isEdit:true,isDel:false,isAdd:true};
+var config = { isEdit:true,isDel:false,isAdd:true,
+toolBar:[{type:"input",title:"编码",key:"code"},
+	{type:"input",title:"经销商",key:"jxs"},
+	{type:"input",title:"省份",key:"province"},
+	{type:"input",title:"城市",key:"city"}
 
+]};
 </script>
 <%@include file="../common/table.jsp"%>
 

+ 1 - 1
src/main/webapp/page/jinzai/order.jsp

@@ -176,7 +176,7 @@ function initTable(){
 
         queryParams: queryParams,//前端调用服务时,会默认传递上边提到的参数,如果需要添加自定义参数,可以自定义一个函数返回请求参数
         sidePagination: "server",   //分页方式:client客户端分页,server服务端分页(*)
-        search: true,      //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
+        // search: true,      //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
         strictSearch: false,
         //showColumns: true,     //是否显示所有的列
 //         showRefresh: true,     //是否显示刷新按钮

+ 241 - 86
src/main/webapp/page/jinzai/upload.jsp

@@ -1,96 +1,251 @@
 <%@ page language="java" contentType="text/html; charset=UTF-8"
 	pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
-<c:set var="title" value="订单列表"></c:set>
-<script>
-var dataFormat = [
-
-                   {
-                       field:"task_no",
-                       title:"任务单号",
-                       dataType:"string",/*string;datetime,date*/
-                       edit:true,
-                       isNull:false,
-					   formatter:function(value,data){
-						  return "<div style='word-wrap: normal;word-wrap: break-word;width:150px'>"+value+"</div>"
-					   }
-                    },
-	{
-		field:"id",
-		title:"箱码",
-		dataType:"string",/*string;datetime,date*/
-		edit:true,
-		isNull:false,
-		formatter:function(value,data){
-			return "<div style='word-wrap: normal;word-wrap: break-word;width:150px'>"+value+"</div>"
+<c:set value="<%=request.getContextPath()%>" var="ctx"></c:set>
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+	<title>表单</title>
+	<meta name="keywords" content="关键字台">
+	<meta name="description" content="描述">
+	<link href="${ctx}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
+	<link href="${ctx}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
+	<link href="${ctx}/css/bootstrap-select.min.css" rel="stylesheet">
+	<link href="${ctx}/css/plugins/bootstrap-table/bootstrap-table.min.css"	rel="stylesheet">
+	<link href="${ctx}/css/animate.css" rel="stylesheet">
+	<link href="${ctx}/css/style.css?v=4.1.0" rel="stylesheet">
+	<style>
+		.col-sm-1{
+			width:100px !important;
 		}
-	},{
-		field:"duo_code",
-		title:"托码",
-		dataType:"string",/*string;datetime,date*/
-		edit:true,
-		isNull:false,
-		formatter:function(value,data){
-			return "<div style='word-wrap: normal;word-wrap: break-word;width:150px'>"+value+"</div>"
+	</style>
+</head>
+<body>
+<div class="wrapper wrapper-content animated fadeInRight">
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox">
+				<div class="ibox-title">
+					<div class="row">
+						<div class="col-sm-10">
+							<h3>产线数据</h3>
+						</div>
+						<div class="col-sm-2">
+							<div class="ibox-tools">
+								<!--                                     <button class="btn btn-success"  onclick="addUser();"> -->
+								<!-- 						    			<i class="glyphicon glyphicon-plus"></i> 添加用户 -->
+								<!-- 						  			</button> -->
+							</div>
+						</div>
+					</div>
+				</div>
+
+				<div class="ibox-content">
+
+					<div class="row row-lg">
+						<form class="form-horizontal m-t" >
+							<div id="condition">
+								<div>
+									<label class="col-sm-1 control-label"><span class="text-danger"></span>箱码:</label>
+									<div class="col-sm-2">
+										<input id="id" class="form-control" placeholder="箱码"/>
+
+									</div>
+
+
+								</div>
+								<div>
+									<label class="col-sm-1 control-label"><span class="text-danger"></span>任务单号:</label>
+									<div class="col-sm-2">
+										<input id="task_no" class="form-control" placeholder="任务单号"/>
+
+									</div>
+								</div>
+
+								<div>
+									<label class="col-sm-1 control-label"><span class="text-danger"></span>托码:</label>
+									<div class="col-sm-2">
+										<input id="duo_code" class="form-control " placeholder="托码"/>
+
+									</div>
+								</div>
+								<div>
+									<label class="col-sm-1 control-label"><span class="text-danger"></span>生产线:</label>
+									<div class="col-sm-2">
+										<select id="lineName" class="form-control " placeholder="生产线">
+
+										</select>
+
+									</div>
+								</div>
+							</div>
+
+							<button style="" type="button" id="searchBtn" class="btn btn-success" onclick="search();return false;">搜索</button>
+
+						</form>
+					</div>
+					<div class="row row-lg">
+						<div class="col-sm-12">
+							<table id="table" data-toggle="table"  data-mobile-responsive="true">
+							</table>
+						</div>
+					</div>
+
+
+				</div>
+
+			</div>
+		</div>
+	</div>
+	<!-- 全局js -->
+	<script src="${ctx}/js/jquery.min.js?v=2.1.4"></script>
+	<script src="${ctx}/js/bootstrap.min.js?v=3.3.6"></script>
+	<script src="${ctx}/js/bootstrap-select.min.js"></script>
+	<!-- 自定义js -->
+	<script src="${ctx}/js/content.js?v=1.0.0"></script>
+	<!-- jQuery Validation plugin javascript-->
+	<script src="${ctx}/js/plugins/validate/jquery.validate.min.js"></script>
+	<script src="${ctx}/js/plugins/validate/messages_zh.min.js"></script>
+	<script src="${ctx}/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
+	<script	src="${ctx}/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
+	<script	src="${ctx}/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
+	<script src="${ctx}/js/common.js"></script>
+	<script src="${ctx}/js/plugins/layer/layer.min.js"></script>
+	<script src="${ctx}/js/Math.uuid.js"></script>
+	<script src="${ctx}/js/laydate/laydate.js"></script>
+</div>
+</body>
+<script>
+
+var table = null;
+$(document).ready(function(){
+	table = $('#table').bootstrapTable("destroy");//通过AJAX必须先destroy不知道为啥
+	initTable();
+	lineData();
+});
+function queryParams(param){
+	let id = $("#id").val();
+	let task_no = $("#task_no").val();
+	let duo_code = $("#duo_code").val();
+
+	let lineName = $("#lineName").val();
+	param["key"] = 'jinzai_upload_master';
+	param['toolBarConfig'] = JSON.stringify([{type:"input",key:"id"},
+		{type:"input",key:"task_no"},
+		{type:"input",key:"duo_code"},
+		{type:"input",key:"device_no"}]);
+	if(id){
+		param['id'] = id;
+	}
+	if(task_no){
+		param['task_no'] = task_no;
+	}
+	if(duo_code){
+		param['duo_code'] = duo_code;
+	}
+	if(lineName){
+		param['device_no'] = lineName;
+	}
+	return param;
+}
+function lineData(){
+	var param = {"pageSize":100,"pageNumber":1,"sortOrder":"asc",key:"t_jz_device"}
+	$.ajax({
+		url:"${ctx}/uploadData/query",
+		data:param,
+		success:function(data){
+			$("#lineName").html('<option value="">全部</option>');
+			for(var i=0;i<data.rows.length;i++){
+				$("#lineName").append('<option value="'+data.rows[i].device_no+'">'+data.rows[i].lineName+'</option>')
+			}
 		}
-	},{
-		field:"lineName",
-		title:"产线",
-		dataType:"string",/*string;datetime,date*/
-		edit:true,
-		isNull:false
-	},
-                    {
-                        field:"pinxiang",
-                        title:"品项",
-                        dataType:"string",/*string;datetime,date*/
-                        edit:true,
-                        isNull:false
-                     }, {
-                         field:"kouwei",
-                         title:"口味",
-                         dataType:"string",/*string;datetime,date*/
-                         edit:true,
-                         isNull:false
-					  },{
-						field:"produce_date",
-						title:"生产日期",
-						dataType:"string",/*string;datetime,date*/
-						edit:true,
-						isNull:false
-					},
-
-                    {
-                        field:"sku",
-                        title:"sku",
-                        dataType:"string",/*string;datetime,date*/
-                        edit:true,
-                        isNull:false
-                     }
-
-
-
-                    ,
-                    {
-                        field:"guo_time",
-                        title:"绑定时间",
-                        dataType:"string",/*string;datetime,date*/
-                        edit:false,
-                     }
-
-
-
-            ];
-var config = { isEdit:false,isDel:false,isAdd:false,
-	toolBar:[{type:"input",title:"箱码",key:"id"},
-		{type:"input",title:"任务单号",key:"task_no"},
-		{type:"input",title:"托码",key:"duo_code"}
-
-	],
-};
+	})
+}
+function search(){
+	table = $('#table').bootstrapTable("destroy");
+	initTable();
+}
+function initTable(){
+	var index = 1;
+	table = $('#table').bootstrapTable({
+		method: 'get',
+		sortable : true,
+		toolbar: '#toolbar',    //工具按钮用哪个容器
+		striped: true,      //是否显示行间隔色
+		cache: false,      //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+		pagination: true,     //是否显示分页(*)
+		pageNumber:1,      //初始化加载第一页,默认第一页
+		pageSize: 10,      //每页的记录行数(*)
+		pageList: [10, 25, 50, 100],  //可供选择的每页的行数(*)
+		url: "${ctx}/uploadData/query",//这个接口需要处理bootstrap table传递的固定参数
+		queryParamsType:'', //默认值为 'limit' ,在默认情况下 传给服务端的参数为:offset,limit,sort
+							// 设置为 ''  在这种情况下传给服务器的参数为:pageSize,pageNumber
+
+		queryParams: queryParams,//前端调用服务时,会默认传递上边提到的参数,如果需要添加自定义参数,可以自定义一个函数返回请求参数
+		sidePagination: "server",   //分页方式:client客户端分页,server服务端分页(*)
+		// search: true,      //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
+		strictSearch: false,
+		//showColumns: true,     //是否显示所有的列
+//         showRefresh: true,     //是否显示刷新按钮
+		minimumCountColumns: 2,    //最少允许的列数
+		clickToSelect: true,    //是否启用点击选中行
+		searchOnEnterKey: true,
+		idField : "id",
+		columns: [{
+			field:"task_no",
+			title:"任务单号",
+			formatter:function(value,data){
+				return "<div style='word-wrap: normal;word-wrap: break-word;width:150px'>"+value+"</div>"
+			}
+		},
+			{
+				field:"id",
+				title:"箱码",
+				formatter:function(value,data){
+					return "<div style='word-wrap: normal;word-wrap: break-word;width:150px'>"+value+"</div>"
+				}
+			},{
+				field:"duo_code",
+				title:"托码",
+				formatter:function(value,data){
+					return "<div style='word-wrap: normal;word-wrap: break-word;width:150px'>"+value+"</div>"
+				}
+			},{
+				field:"lineName",
+				title:"产线",
+			},
+			{
+				field:"pinxiang",
+				title:"品项",
+			}, {
+				field:"kouwei",
+				title:"口味",
+			},{
+				field:"produce_date",
+				title:"生产日期",
+			},
+
+			{
+				field:"sku",
+				title:"sku",
+			}
+
+
+
+			,
+			{
+				field:"guo_time",
+				title:"绑定时间",
+			}
+
 
+		],
+	});
+}
 </script>
-<%@include file="../common/table.jsp"%>
+<%--<%@include file="../common/table.jsp"%>--%>
 
 <script>