feat(system): add Excel export for operlog and dict type lists
Wire ListExportDropdown with filtered/selected backend xlsx export. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1053e24896
commit
b3b6ec187a
8 files changed
+228
-3
No files matched your search
@@ -223,6 +223,14 @@ export function fetchDictTypeList(params?: { page?: number; pageSize?: number; k
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchExportDictTypes(data: Record<string, any>) {
|
||||
return request.post({
|
||||
url: '/web/admin/dict-types/export',
|
||||
data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchCreateDictType(data: {
|
||||
dictName: string
|
||||
dictType: string
|
||||
|
||||
@@ -5,6 +5,15 @@ export function list(data?: Record<string, any>) {
|
||||
return request.post({ url: '/web/monitor/operlog/list', data })
|
||||
}
|
||||
|
||||
/** 操作日志导出 */
|
||||
export function exportOperLog(data?: Record<string, any>) {
|
||||
return request.post({
|
||||
url: '/web/monitor/operlog/export',
|
||||
data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
/** 操作日志详情 */
|
||||
export function getDetail(data: { id: string }) {
|
||||
return request.post({ url: '/web/monitor/operlog/detail', data })
|
||||
|
||||
@@ -72,6 +72,15 @@
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="fetchExportDictTypes"
|
||||
:get-filter-params="getDictTypeExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="dictTypeExportColumns"
|
||||
filename="字典类型.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -514,6 +523,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, onMounted, computed } from 'vue'
|
||||
@@ -535,6 +545,7 @@ import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
|
||||
import {
|
||||
fetchDictTypeList,
|
||||
fetchExportDictTypes,
|
||||
fetchCreateDictType,
|
||||
fetchUpdateDictType,
|
||||
fetchDeleteDictType,
|
||||
@@ -580,6 +591,20 @@ import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
const selectedRows = ref<Api.Dict.DictTypeItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
function getDictTypeExportFilterParams() {
|
||||
const quickKeyword = quickSearchKeyword.value?.trim()
|
||||
return {
|
||||
keyword: quickKeyword || searchForm.keyword || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const dictTypeExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('dictName')) cols.unshift('dictName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增字典类型')
|
||||
const isEdit = ref(false)
|
||||
|
||||
@@ -60,6 +60,15 @@
|
||||
查看详情
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="exportOperLog"
|
||||
:get-filter-params="getOperLogExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="visibleColumns"
|
||||
filename="操作日志.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -236,10 +245,11 @@
|
||||
|
||||
<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 { RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import { list as listOperLog, detail as getOperLogDetail } from '@/api/monitor/operlog'
|
||||
import { list as listOperLog, exportOperLog, detail as getOperLogDetail } from '@/api/monitor/operlog'
|
||||
import type { OperLogVO, OperLogQuery } from '@/api/monitor/operlog/types'
|
||||
import {
|
||||
OPER_LOG_BUSINESS_TYPE_OPTIONS,
|
||||
@@ -303,6 +313,16 @@ function buildQuery(): OperLogQuery {
|
||||
}
|
||||
}
|
||||
|
||||
function getOperLogExportFilterParams() {
|
||||
const q = buildQuery()
|
||||
return {
|
||||
title: q.title,
|
||||
businessType: q.businessType,
|
||||
operName: q.operName,
|
||||
status: q.status
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user