{field: 'reason', title: '申请原因', align: 'center',
formatter: function (value, row, index) {
return ''
}
}
function changeReason(e) {
var value = $(e).val();
var index = $(e).attr("data-index");
dataList[index].reason = value;
}
其中dataList是一个全局变量
var dataList = [];
onLoadSuccess: function(){
dataList = $table.bootstrapTable("getData", true);
if(type == 2){
$table.bootstrapTable('hideColumn', 'abstractName');//隐藏abstractName列
}else {
$('#table').bootstrapTable('showColumn', 'abstractName');
}
}
function saveOrSubmit(type) {
$.ajax({
type: "post",
url: "/admin/warning/apply/save",
data: {
saveType: type,
dataListStr: JSON.stringify(dataList),
bzy: $("#bzy").val(),
kj: $("#kj").val(),
cn: $("#cn").val(),
},
dataType: "json",
success: function (msg) {
// msg = JSON.parse(msg);
console.log(msg);
if (msg.code == 0) {
layer.msg(msg.message, {icon: 1, time: 2000}, function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg(msg.message, {icon: 2, time: 2000})
}
}
});
}
var dataList = [];
var $table = $('#table');
var type = '${type}';
$table.bootstrapTable({
method: "POST",
url: "${ctx!}/admin/warning/apply/getConfirmCostApplicationList/" + type,
contentType: "application/x-www-form-urlencoded",
striped: true,
pagination: true,
pageSize: 1000,
pageList: [1000],
pageNumber: 1,
sidePagination: "server",
queryParamsType: "undefined",
paginationPreText: '上一页',
paginationNextText: '下一页',
height: $(window).height() * 0.58,
responseHandler: function (res) {
return {
"rows": res.content,
"total": res.totalElements,
};
},
columns: [
{field: 'subjectCode', title: '科目代码', align: 'center',},
{field: 'subject', title: '科目名称', align: 'center',},
{field: 'abstractName', title: '摘要', align: 'center',},
{field: 'limitAmount', title: '限制金额', align: 'center',},
{field: 'appliedAmount', title: '申请金额', align: 'center',},
{field: 'reason', title: '申请原因', align: 'center',
formatter: function (value, row, index) {
return ''
}
}
],
onLoadSuccess: function(){
dataList = $table.bootstrapTable("getData", true);
if(type == 2){
$table.bootstrapTable('hideColumn', 'abstractName');
}else {
$('#table').bootstrapTable('showColumn', 'abstractName');
}
}
});
function changeReason(e) {
var value = $(e).val();
var index = $(e).attr("data-index");
dataList[index].reason = value;
}
function saveOrSubmit(type) {
$.ajax({
type: "post",
url: "/admin/warning/apply/save",
data: {
saveType: type,
dataListStr: JSON.stringify(dataList),
bzy: $("#bzy").val(),
kj: $("#kj").val(),
cn: $("#cn").val(),
},
dataType: "json",
success: function (msg) {
console.log(msg);
if (msg.code == 0) {
layer.msg(msg.message, {icon: 1, time: 2000}, function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg(msg.message, {icon: 2, time: 2000})
}
}
});
}