feat(web-admin): wire list export on system user page
Pilot filtered and selected Excel export via ListExportDropdown. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3643a3b14e
commit
09827fdbf3
2 files changed
+36
No files matched your search
@@ -115,6 +115,15 @@ export function fetchUserList(params?: {
|
||||
})
|
||||
}
|
||||
|
||||
/** Excel 导出用户 */
|
||||
export function fetchExportUsers(data: Record<string, any>) {
|
||||
return request.post({
|
||||
url: '/web/admin/users/export',
|
||||
data,
|
||||
responseType: 'blob',
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchUserDetail(id: string) {
|
||||
return request.get<Api.User.UserItem>({
|
||||
url: `/web/admin/users/${id}`
|
||||
|
||||
@@ -96,6 +96,15 @@
|
||||
删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="fetchExportUsers"
|
||||
:get-filter-params="getUserExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="userExportColumns"
|
||||
filename="用户列表.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -403,9 +412,11 @@
|
||||
import RoleManageDialogs from '@/components/business/role-manage-dialogs/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import {
|
||||
fetchUserList,
|
||||
fetchExportUsers,
|
||||
fetchUserDetail,
|
||||
fetchCreateUser,
|
||||
fetchUpdateUser,
|
||||
@@ -486,6 +497,22 @@
|
||||
const { visibleColumns, checkAll, isIndeterminate, isColumnVisible, resetToDefault } =
|
||||
usePersistedListColumns('system-user-list-columns', listColumnDefs)
|
||||
|
||||
function getUserExportFilterParams() {
|
||||
const quickKeyword = quickSearchKeyword.value?.trim()
|
||||
return {
|
||||
keyword: quickKeyword || searchForm.keyword || undefined,
|
||||
status: searchForm.status || undefined,
|
||||
deptId: selectedDeptId.value || undefined
|
||||
}
|
||||
}
|
||||
|
||||
/** nickName 列始终展示,需并入导出 columns */
|
||||
const userExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('nickName')) cols.unshift('nickName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增用户')
|
||||
const isEdit = ref(false)
|
||||
|
||||
Reference in new issue
Block a user