表格导出新增提示文本

pull/462/MERGE
Karson 2024-03-28 11:16:38 +08:00
parent b7eef593a3
commit 6dd941e168
1 changed files with 7 additions and 1 deletions

View File

@ -14,7 +14,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索 titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
idTable: 'commonTable', idTable: 'commonTable',
showExport: true, showExport: true,
exportDataType: "auto", exportDataType: "auto", //支持auto,selected,all 当设定为auto时自动时有选中则导出选中没有选中则导出全部
exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'], exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
exportOptions: { exportOptions: {
fileName: 'export_' + Moment().format("YYYY-MM-DD"), fileName: 'export_' + Moment().format("YYYY-MM-DD"),
@ -326,9 +326,15 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
options.selectedIds = selectedIds; options.selectedIds = selectedIds;
options.selectedData = selectedData; options.selectedData = selectedData;
} }
//如果导出类型为auto时则自动判断 //如果导出类型为auto时则自动判断
if (exportDataType === 'auto') { if (exportDataType === 'auto') {
options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all'; options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
if ($(".export .exporttips").length === 0) {
$(".export .dropdown-menu").prepend("<li class='exporttips alert alert-warning-light mb-0 no-border p-2'></li>")
}
$(".export .exporttips").html("导出记录:" + (selectedIds.length > 0 ? "选中" : "全部"));
} }
$(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length); $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
}); });