-
+
-
+
-
+
@@ -27,11 +47,16 @@
@@ -125,6 +150,7 @@ watch(
() => tableStore.table.allFlag,
newVal => {
if (tableStore.table.allFlag) {
+ console.log('🚀 ~ tableStore.table.allData:', tableStore.table.allData)
tableRef.value?.exportData({
filename: tableStore.exportName || document.querySelectorAll('.ba-nav-tab.active')[0].textContent || '', // 文件名字
diff --git a/src/utils/tableStore.ts b/src/utils/tableStore.ts
index c08503f..0c5d4e9 100644
--- a/src/utils/tableStore.ts
+++ b/src/utils/tableStore.ts
@@ -18,6 +18,7 @@ interface TableStoreParams {
publicHeight?: number //计算高度
resetCallback?: () => void // 重置
loadCallback?: () => void // 接口调用后的回调
+ exportProcessingData?: () => void //导出处理数据
beforeSearchFun?: () => void // 接口调用前的回调
}
@@ -47,6 +48,7 @@ export default class TableStore {
column: [],
loadCallback: null,
resetCallback: null,
+ exportProcessingData: null,
beforeSearchFun: null,
height: '',
publicHeight: 0
@@ -64,6 +66,7 @@ export default class TableStore {
this.table.publicHeight = options.publicHeight || 0
this.table.resetCallback = options.resetCallback || null
this.table.loadCallback = options.loadCallback || null
+ this.table.exportProcessingData = options.exportProcessingData || null
this.table.beforeSearchFun = options.beforeSearchFun || null
Object.assign(this.table.params, options.params)
this.table.height = mainHeight(20 + (this.showPage ? 58 : 0) + this.table.publicHeight).height as string
@@ -187,26 +190,21 @@ export default class TableStore {
[
'export',
() => {
- ElMessage({
- message: '正在导出,请稍等...',
- type: 'info',
- duration: 1000
- })
+ // this.index()
let params = { ...this.table.params, pageNum: 1, pageSize: this.table.total }
- setTimeout(() => {
- 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
- })
- }, 1500)
+ 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.exportProcessingData && this.table.exportProcessingData()
+ this.table.allFlag = data.showAllFlag || true
+ })
}
]
])
diff --git a/src/views/auth/role/index.vue b/src/views/auth/role/index.vue
index f3ada40..aab5dc2 100644
--- a/src/views/auth/role/index.vue
+++ b/src/views/auth/role/index.vue
@@ -1,162 +1,164 @@
-