全局添加导出表格配置

This commit is contained in:
GGJ
2024-12-27 08:47:47 +08:00
parent 1f94ac5267
commit 0994a52699
28 changed files with 3264 additions and 200 deletions

View File

@@ -3,6 +3,7 @@ import createAxios from '@/utils/request'
import { requestPayload } from '@/utils/request'
import { Method } from 'axios'
import { mainHeight } from '@/utils/layout'
import { filtration } from './tableMethod'
interface TableStoreParams {
url: string // 请求地址
@@ -31,6 +32,8 @@ export default class TableStore {
ref: null,
selection: [],
data: [],
allData: [],
allFlag: false,
webPagingData: [],
total: 0,
params: {
@@ -175,6 +178,25 @@ export default class TableStore {
() => {
console.warn('No action defined')
}
],
[
'export',
() => {
// this.index()
let params = { ...this.table.params, pageNum: 1, pageSize: this.table.total }
createAxios(
Object.assign(
{
url: this.url,
method: this.method
},
requestPayload(this.method, params, this.paramsPOST)
)
).then(res => {
this.table.allData = filtration(res.data.records || res.data)
this.table.allFlag = data.showAllFlag || true
})
}
]
])
const action = actionFun.get(event) || actionFun.get('default')