|
|
|
@ -21,7 +21,7 @@
|
|
|
|
|
<input type="text" id="barcode" name="barcode"/>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="searchAll()"><i class="fa fa-search"></i> 搜索</a>
|
|
|
|
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="searchpara()"><i class="fa fa-search"></i> 搜索</a>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
@ -34,44 +34,107 @@
|
|
|
|
|
</div>
|
|
|
|
|
<th:block th:include="include :: footer" />
|
|
|
|
|
<script th:inline="javascript">
|
|
|
|
|
function searchAll(){
|
|
|
|
|
function searchpara(){
|
|
|
|
|
// console.log("点击查询按钮事件执行...");
|
|
|
|
|
var url = ctx + "nanjing/reportData/report";
|
|
|
|
|
$('#bootstrap-table').bootstrapTable('destroy');
|
|
|
|
|
$('#bootstrap-table').bootstrapTable({
|
|
|
|
|
method:"post",
|
|
|
|
|
url: url,
|
|
|
|
|
pagination: true,
|
|
|
|
|
search: true,
|
|
|
|
|
contentType : "application/x-www-form-urlencoded",
|
|
|
|
|
queryParams: {
|
|
|
|
|
begin:$('#beginTime').val(),
|
|
|
|
|
end:$('#endTime').val(),
|
|
|
|
|
barcode:$('#barcode').val()
|
|
|
|
|
// //方式1:行转列
|
|
|
|
|
var formData = new FormData();
|
|
|
|
|
formData.append("begin",$('#beginTime').val());
|
|
|
|
|
formData.append("end",$('#endTime').val());
|
|
|
|
|
formData.append("barcode",$('#barcode').val());
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "post",
|
|
|
|
|
url: ctx + "nanjing/reportData/report",
|
|
|
|
|
data: formData,
|
|
|
|
|
contentType: "application/json;charset=utf-8",
|
|
|
|
|
dataType: "json",
|
|
|
|
|
json: 'callback',
|
|
|
|
|
processData: false,
|
|
|
|
|
contentType: false,
|
|
|
|
|
success: function (json) {
|
|
|
|
|
var coulmnsData = [];
|
|
|
|
|
var columnsArray = [];
|
|
|
|
|
columnsArray.push({field : "barcode",title : "产品条码",colspan: 1,rowspan: 2});
|
|
|
|
|
var columns = [];
|
|
|
|
|
if(json.length>0){
|
|
|
|
|
for (var i = 0; i < (Object.keys(json[0])).length; i++) {//Object.keys(obj) 获取key名称
|
|
|
|
|
var property = (Object.keys(json[0]))[i];//id username
|
|
|
|
|
if(property!='barcode'&&!(property.endsWith("value"))){
|
|
|
|
|
columns.push({
|
|
|
|
|
"title": property,
|
|
|
|
|
"field": property+'value',
|
|
|
|
|
switchable: true,
|
|
|
|
|
align:"center",
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
coulmnsData.push(columnsArray);
|
|
|
|
|
coulmnsData.push(columns);
|
|
|
|
|
// console.log(columnsArray);
|
|
|
|
|
$('#bootstrap-table').bootstrapTable('destroy').bootstrapTable({
|
|
|
|
|
id: "bootstrap-table",
|
|
|
|
|
data:json,
|
|
|
|
|
toolbar: "#toolbar",
|
|
|
|
|
singleSelect: false,
|
|
|
|
|
// clickToSelect: true,
|
|
|
|
|
sortName: "barcode",
|
|
|
|
|
sortOrder: "desc",
|
|
|
|
|
pageSize: 15,
|
|
|
|
|
pageNumber: 1,
|
|
|
|
|
pageList: "[10, 15,25, 50, 100, All]",
|
|
|
|
|
// showToggle: true,
|
|
|
|
|
showRefresh: true,
|
|
|
|
|
showColumns: true,
|
|
|
|
|
search: false,
|
|
|
|
|
pagination: true,
|
|
|
|
|
showExport: false,//工具栏上显示导出按钮
|
|
|
|
|
fixedColumns: true,
|
|
|
|
|
fixedNumber: 4,
|
|
|
|
|
fixedLeftNumber: 4,
|
|
|
|
|
columns: coulmnsData
|
|
|
|
|
});
|
|
|
|
|
// columnsArray.push();
|
|
|
|
|
},
|
|
|
|
|
modalName: "条码信息查询",
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
field: 'id',
|
|
|
|
|
title: '序号'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'barcode',
|
|
|
|
|
title: '系统条码'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'parameaning',
|
|
|
|
|
title: '参数名'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field:'value',
|
|
|
|
|
title:'参数值'
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
// onLoadSuccess:function(data){
|
|
|
|
|
// mergeTable(data,"table");
|
|
|
|
|
// },
|
|
|
|
|
})
|
|
|
|
|
error: function () {
|
|
|
|
|
alert("错误");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 方式2 不进行行转列
|
|
|
|
|
// var url = ctx + "nanjing/reportData/report";
|
|
|
|
|
// $('#bootstrap-table').bootstrapTable('destroy');
|
|
|
|
|
// $('#bootstrap-table').bootstrapTable({
|
|
|
|
|
// method:"post",
|
|
|
|
|
// url: url,
|
|
|
|
|
// pagination: true,
|
|
|
|
|
// search: true,
|
|
|
|
|
// contentType : "application/x-www-form-urlencoded",
|
|
|
|
|
// queryParams: {
|
|
|
|
|
// begin:$('#beginTime').val(),
|
|
|
|
|
// end:$('#endTime').val(),
|
|
|
|
|
// barcode:$('#barcode').val()
|
|
|
|
|
// },
|
|
|
|
|
// modalName: "条码信息查询",
|
|
|
|
|
// columns: [
|
|
|
|
|
// {
|
|
|
|
|
// field: 'id',
|
|
|
|
|
// title: '序号'
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// field: 'barcode',
|
|
|
|
|
// title: '系统条码'
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// field: 'parameaning',
|
|
|
|
|
// title: '参数名'
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// field:'value',
|
|
|
|
|
// title:'参数值'
|
|
|
|
|
// },
|
|
|
|
|
// ],
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|