修改测试问题
This commit is contained in:
@@ -74,6 +74,7 @@ import { useConfig } from '@/stores/config'
|
||||
import type TableStoreClass from '@/utils/tableStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||
import { buildExportBaseName } from '@/utils/echartMethod'
|
||||
|
||||
const config = useConfig()
|
||||
const tableRef = ref<VxeTableInstance>()
|
||||
@@ -150,6 +151,16 @@ const selectChangeEvent: VxeTableEvents.CheckboxChange<any> = ({ checked }) => {
|
||||
const getRef = () => {
|
||||
return tableRef.value
|
||||
}
|
||||
const getTableExportFilename = () => {
|
||||
const exportName = tableStore.exportName
|
||||
if (exportName && typeof exportName === 'object') {
|
||||
return buildExportBaseName(exportName)
|
||||
}
|
||||
const feature =
|
||||
exportName || (document.querySelectorAll('.ba-nav-tab.active')[0] as HTMLElement | undefined)?.textContent || '导出'
|
||||
return buildExportBaseName({ feature })
|
||||
}
|
||||
|
||||
watch(
|
||||
() => tableStore.table.allFlag,
|
||||
newVal => {
|
||||
@@ -157,7 +168,7 @@ watch(
|
||||
console.log('🚀 ~ tableStore.table.allData:', tableStore.table.allData)
|
||||
|
||||
tableRef.value?.exportData({
|
||||
filename: tableStore.exportName || document.querySelectorAll('.ba-nav-tab.active')[0].textContent || '', // 文件名字
|
||||
filename: getTableExportFilename(), // 文件名字
|
||||
sheetName: 'Sheet1',
|
||||
type: 'xlsx', //导出文件类型 xlsx 和 csv
|
||||
useStyle: true,
|
||||
|
||||
Reference in New Issue
Block a user