feat(pl): add Excel export for vehicle maintenance apply list
Support filtered and selected rows via backend export and ListExportDropdown. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6a89452f1a
commit
441e1fdae1
4 files changed
+117
-2
No files matched your search
@@ -1530,6 +1530,8 @@ export interface VehicleMaintenanceProcessBoardListResponse {
|
||||
|
||||
export const vehicleMaintenanceApplyApi = {
|
||||
list: (params?: Record<string, unknown>) =>
|
||||
export: (data: Record<string, any>) =>
|
||||
request.post('/transport/vehicle-maintenance-apply/export', data, { responseType: 'blob' }),
|
||||
request.get<VehicleMaintenanceApplyListResponse>('/transport/vehicle-maintenance-apply/', {
|
||||
params
|
||||
}),
|
||||
|
||||
@@ -86,6 +86,15 @@
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="vehicleMaintenanceApplyApi.export"
|
||||
:get-filter-params="getMaintApplyExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="maintApplyExportColumns"
|
||||
filename="维保申请.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -370,6 +379,7 @@
|
||||
<script setup lang="ts">
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
|
||||
import ListColumnStatsRow from '@/components/business/list-column-stats-row/index.vue'
|
||||
import type { StatsRowColumn } from '@/utils/list-column-stats'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
@@ -472,6 +482,23 @@ const submitLoading = ref(false)
|
||||
const cancelLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const tableData = ref<VehicleMaintenanceApply[]>([])
|
||||
const selectedRows = ref<VehicleMaintenanceApply[]>([])
|
||||
|
||||
function getMaintApplyExportFilterParams() {
|
||||
return {
|
||||
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
|
||||
maintenanceType: searchForm.maintenanceType || undefined,
|
||||
status: searchForm.status || undefined,
|
||||
applyDateFrom: dateRange.value?.[0],
|
||||
applyDateTo: dateRange.value?.[1]
|
||||
}
|
||||
}
|
||||
|
||||
const maintApplyExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('applyNo')) cols.unshift('applyNo')
|
||||
return cols
|
||||
})
|
||||
|
||||
const vehicleOptions = ref<Vehicle[]>([])
|
||||
const vehicleTrailerLookup = computed(() => buildVehicleTrailerLookup(vehicleOptions.value))
|
||||
const dateRange = ref<string[]>([])
|
||||
|
||||
Reference in new issue
Block a user