优化主子表单删方法

pull/382/head
RuoYi 2022-04-17 10:18:19 +08:00
parent 977ceb562e
commit 53bb1da7a1
4 changed files with 7 additions and 5 deletions

View File

@ -465,9 +465,8 @@ var sub = {
}
$("#" + table.options.id).bootstrapTable('remove', { field: subColumn, values: ids });
},
delRowByIndex: function(defindex, index) {
delRowByIndex: function(value) {
sub.editRow();
var value = $.common.isNotEmpty(index) ? index : defindex;
$("#" + table.options.id).bootstrapTable('remove', { field: "index", values: [value] });
sub.editRow();
},

View File

@ -171,7 +171,8 @@
title: '操作',
align: 'center',
formatter: function(value, row, index) {
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + $.table.serialNumber(index) + '\', \'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a>';
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
}
}]
};

View File

@ -351,7 +351,8 @@
title: '操作',
align: 'center',
formatter: function(value, row, index) {
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + $.table.serialNumber(index) + '\', \'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a>';
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
}
}]
};

View File

@ -363,7 +363,8 @@
title: '操作',
align: 'center',
formatter: function(value, row, index) {
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + $.table.serialNumber(index) + '\', \'' + row.index + '\')"><i class="fa fa-remove"></i>删除</a>';
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
}
}]
};