|
|
@ -51,18 +51,18 @@
|
|
|
|
processData: false,
|
|
|
|
processData: false,
|
|
|
|
contentType: false,
|
|
|
|
contentType: false,
|
|
|
|
success: function (json) {
|
|
|
|
success: function (json) {
|
|
|
|
|
|
|
|
console.log("条码信息查询Json格式"+json);
|
|
|
|
var coulmnsData = [];
|
|
|
|
var coulmnsData = [];
|
|
|
|
var columnsArray = [];
|
|
|
|
var columnsArray = [];
|
|
|
|
columnsArray.push({field : "barcode",title : "产品条码",colspan: 1,rowspan: 2});
|
|
|
|
columnsArray.push({field : "barcode",title : "产品条码",align:"center"});
|
|
|
|
var columns = [];
|
|
|
|
var columns = [];
|
|
|
|
if(json.length>0){
|
|
|
|
if(json.length>0){
|
|
|
|
for (var i = 0; i < (Object.keys(json[0])).length; i++) {//Object.keys(obj) 获取key名称
|
|
|
|
for (var i = 0; i < (Object.keys(json[0])).length; i++) {//Object.keys(obj) 获取key名称
|
|
|
|
var property = (Object.keys(json[0]))[i];//id username
|
|
|
|
var property = (Object.keys(json[0]))[i];//id username
|
|
|
|
if(property!='barcode'&&!(property.endsWith("value"))){
|
|
|
|
if(property!='barcode'&&!(property.endsWith("value"))){
|
|
|
|
columns.push({
|
|
|
|
columnsArray.push({
|
|
|
|
"title": property,
|
|
|
|
"title": property,
|
|
|
|
"field": property+'value',
|
|
|
|
"field": property+"value",
|
|
|
|
switchable: true,
|
|
|
|
|
|
|
|
align:"center",
|
|
|
|
align:"center",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -70,21 +70,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
coulmnsData.push(columnsArray);
|
|
|
|
//coulmnsData.push(columnsArray);
|
|
|
|
coulmnsData.push(columns);
|
|
|
|
//coulmnsData.push(columns);
|
|
|
|
// console.log(columnsArray);
|
|
|
|
console.log(columnsArray);
|
|
|
|
$('#bootstrap-table').bootstrapTable('destroy').bootstrapTable({
|
|
|
|
$('#bootstrap-table').bootstrapTable('destroy').bootstrapTable({
|
|
|
|
id: "bootstrap-table",
|
|
|
|
id: "bootstrap-table",
|
|
|
|
data:json,
|
|
|
|
data:json,
|
|
|
|
toolbar: "#toolbar",
|
|
|
|
toolbar: "#toolbar",
|
|
|
|
singleSelect: false,
|
|
|
|
singleSelect: false,
|
|
|
|
// clickToSelect: true,
|
|
|
|
clickToSelect: true,
|
|
|
|
sortName: "barcode",
|
|
|
|
sortName: "barcode",
|
|
|
|
sortOrder: "desc",
|
|
|
|
sortOrder: "desc",
|
|
|
|
pageSize: 15,
|
|
|
|
pageSize: 15,
|
|
|
|
pageNumber: 1,
|
|
|
|
pageNumber: 1,
|
|
|
|
pageList: "[10, 15,25, 50, 100, All]",
|
|
|
|
pageList: "[10, 15,25, 50, 100, All]",
|
|
|
|
// showToggle: true,
|
|
|
|
showToggle: true,
|
|
|
|
showRefresh: true,
|
|
|
|
showRefresh: true,
|
|
|
|
showColumns: true,
|
|
|
|
showColumns: true,
|
|
|
|
search: false,
|
|
|
|
search: false,
|
|
|
@ -93,9 +93,9 @@
|
|
|
|
fixedColumns: true,
|
|
|
|
fixedColumns: true,
|
|
|
|
fixedNumber: 4,
|
|
|
|
fixedNumber: 4,
|
|
|
|
fixedLeftNumber: 4,
|
|
|
|
fixedLeftNumber: 4,
|
|
|
|
columns: coulmnsData
|
|
|
|
columns: columnsArray
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// columnsArray.push();
|
|
|
|
columnsArray.push();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
error: function () {
|
|
|
|
error: function () {
|
|
|
|
alert("错误");
|
|
|
|
alert("错误");
|
|
|
|