feat(wms/report): 新增自定义报表导出列配置缓存功能
在入库报表页面中新增导出列配置的本地缓存功能,用户自定义的列顺序将被保存至localStorage,避免重复配置。调整前,每次打开自定义导出弹窗均需重新选择列;调整后,自动读取上次保存的配置,提升用户体验。
This commit is contained in:
@@ -391,12 +391,28 @@ export default {
|
||||
openCustomExport() {
|
||||
getExportColumns().then(res => {
|
||||
this.exportColumns = res.data
|
||||
// 读缓存:上次保存的列顺序
|
||||
const cached = localStorage.getItem('custom-export-columns-coil-report-receive')
|
||||
if (cached) {
|
||||
try {
|
||||
const arr = JSON.parse(cached)
|
||||
if (Array.isArray(arr) && arr.length) {
|
||||
this.selectedColumns = [...arr]
|
||||
this.orderedColumns = [...arr]
|
||||
this.customExportVisible = true
|
||||
return
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
this.selectedColumns = []
|
||||
this.orderedColumns = []
|
||||
this.customExportVisible = true
|
||||
})
|
||||
},
|
||||
// 执行自定义导出(按 orderedColumns 顺序)
|
||||
doCustomExport() {
|
||||
// 缓存当前配置
|
||||
localStorage.setItem('custom-export-columns-coil-report-receive', JSON.stringify(this.orderedColumns))
|
||||
this.customExportVisible = false
|
||||
this.download('wms/materialCoil/exportCustomOrdered', {
|
||||
coilIds: this.coilIds,
|
||||
|
||||
Reference in New Issue
Block a user