feat(system): add Excel export for tenant, role, post and site lists

Reuse list filters with ids/columns support and ListExportDropdown UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-21 17:21:50 +08:00
1 parent 5c7210facc
commit 82d8cb7f64
10 files changed
+356 -6

No files matched your search

+25
View File
@@ -73,6 +73,15 @@
批量删除
</el-button>
<ListExportDropdown
:export-fn="fetchExportPosts"
:get-filter-params="getPostExportFilterParams"
:has-selection="true"
:selected-ids="selectedRows.map((r) => r.id)"
:visible-columns="postExportColumns"
filename="职位列表.xlsx"
/>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
@@ -353,6 +362,7 @@
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
@@ -377,6 +387,7 @@ import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import { useDictStore } from '@/store/modules/dict'
import {
fetchPostList,
fetchExportPosts,
fetchCreatePost,
fetchUpdatePost,
fetchDeletePost,
@@ -411,6 +422,20 @@ import { useDictStore } from '@/store/modules/dict'
const selectedRows = ref<Api.Post.PostItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
function getPostExportFilterParams() {
const quickKeyword = quickSearchKeyword.value?.trim()
return {
keyword: quickKeyword || searchForm.keyword || undefined
}
}
const postExportColumns = computed(() => {
const cols = [...visibleColumns.value]
if (!cols.includes('postName')) cols.unshift('postName')
return cols
})
const dialogVisible = ref(false)
const dialogTitle = ref('新增职位')
const isEdit = ref(false)