|
|
@ -51,17 +51,18 @@
|
|
|
|
processData: false,
|
|
|
|
processData: false,
|
|
|
|
contentType: false,
|
|
|
|
contentType: false,
|
|
|
|
success: function (json) {
|
|
|
|
success: function (json) {
|
|
|
|
var coulmnsData = [];
|
|
|
|
// var coulmnsData = [];
|
|
|
|
var columnsArray = [];
|
|
|
|
var columnsArray = [];
|
|
|
|
columnsArray.push({field : "barcode",title : "产品条码",colspan: 1,rowspan: 2});
|
|
|
|
columnsArray.push({field : "barcode",title : "产品条码",colspan: 1,rowspan: 1});
|
|
|
|
var columns = [];
|
|
|
|
// var columns = [];
|
|
|
|
if(json.length>0){
|
|
|
|
if(json.length>0){
|
|
|
|
|
|
|
|
// console.log(Object.keys(json[0]).length);
|
|
|
|
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'){
|
|
|
|
columns.push({
|
|
|
|
columnsArray.push({
|
|
|
|
"title": property,
|
|
|
|
"title": property,
|
|
|
|
"field": property+'value',
|
|
|
|
"field": property,
|
|
|
|
switchable: true,
|
|
|
|
switchable: true,
|
|
|
|
align:"center",
|
|
|
|
align:"center",
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -70,8 +71,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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",
|
|
|
@ -93,7 +94,7 @@
|
|
|
|
fixedColumns: true,
|
|
|
|
fixedColumns: true,
|
|
|
|
fixedNumber: 4,
|
|
|
|
fixedNumber: 4,
|
|
|
|
fixedLeftNumber: 4,
|
|
|
|
fixedLeftNumber: 4,
|
|
|
|
columns: coulmnsData
|
|
|
|
columns: columnsArray
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// columnsArray.push();
|
|
|
|
// columnsArray.push();
|
|
|
|
},
|
|
|
|
},
|
|
|
|