优化列表导出功能

移除relationSearch参数
修复导出全部BUG
pull/237/MERGE
Karson 2020-09-16 22:23:43 +08:00
parent d0f71f4f1d
commit f9b29e4fad
4 changed files with 27 additions and 16 deletions

View File

@ -9,7 +9,7 @@
"jquery": "^2.1.4",
"bootstrap": "^3.3.7",
"font-awesome": "^4.6.1",
"bootstrap-table": "fastadmin-bootstraptable#~1.11.3",
"bootstrap-table": "fastadmin-bootstraptable#~1.11.5",
"jstree": "~3.3.2",
"moment": "^2.20.1",
"toastr": "~2.1.3",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,10 +14,16 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
idTable: 'commonTable',
showExport: true,
exportDataType: "all",
exportDataType: "auto",
exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
exportOptions: {
fileName: 'export_' + Moment().format("YYYY-MM-DD"),
preventInjection: false,
mso: {
onMsoNumberFormat: function (cell, row, col) {
return !isNaN($(cell).text()) ? '\\@' : '';
},
},
ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
},
pageSize: localStorage.getItem("pagesize") || 10,
@ -237,6 +243,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
});
}
});
var exportDataType = options.exportDataType;
// 处理选中筛选框后按钮的状态统一变更
table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table', function (e) {
var allIds = table.bootstrapTable("getData").map(function (item) {
@ -262,6 +269,10 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
options.selectedIds = selectedIds;
options.selectedData = selectedData;
}
//如果导出类型为auto时则自动判断
if (exportDataType === 'auto') {
options.exportDataType = selectedIds.length > 0 ? 'selected' : 'all';
}
$(Table.config.disabledbtn, toolbar).toggleClass('disabled', !options.selectedIds.length);
});