feat(pl): add Excel export for freight unsettled plans and settlement tabs

Support filtered and selected export across freight settlement board panels.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-21 18:17:10 +08:00
1 parent 8f1f08b284
commit b1f734dbb0
9 files changed
+303 -2

No files matched your search

+4
View File
@@ -1179,10 +1179,14 @@ export interface FreightSettlementUpdateBody {
export const freightApi = {
listUnsettledPlans: (params?: UnsettledPlanQuery) =>
request.get<UnsettledPlanListResponse>('/transport/freight/unsettled-plans', { params }),
exportUnsettledPlans: (data: Record<string, any>) =>
request.post('/transport/freight/unsettled-plans/export', data, { responseType: 'blob' }),
getByTransport: (transportId: string) =>
request.get<FreightSettlementBrief | null>(`/transport/freight/by-transport/${transportId}`),
list: (params?: FreightSettlementQuery) =>
request.get<FreightSettlementListResponse>('/transport/freight/', { params }),
export: (data: Record<string, any>) =>
request.post('/transport/freight/export', data, { responseType: 'blob' }),
get: (id: string) => request.get<FreightSettlement>(`/transport/freight/${id}`),
create: (data: { planIds?: string[]; transportIds?: string[] }) =>
request.post<FreightSettlement>('/transport/freight/', data),
@@ -39,6 +39,15 @@
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<ListExportDropdown
:export-fn="freightApi.export"
:get-filter-params="getSettlementExportFilterParams"
:has-selection="true"
:selected-ids="selectedRows.map((r) => r.id)"
:visible-columns="settlementExportColumns"
filename="已审批结算单.xlsx"
/>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
@@ -169,6 +178,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'
@@ -232,6 +242,22 @@ function getDoneStatCellValue(row: FreightSettlement, prop: string): unknown {
const loading = ref(false)
const selectedRows = ref<FreightSettlement[]>([])
function getSettlementExportFilterParams() {
return {
tab: 'approval_done',
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
carrierId: searchForm.carrierId || undefined,
settlementStatus: searchForm.settlementStatus || undefined
}
}
const settlementExportColumns = computed(() => {
const cols = [...visibleColumns.value]
if (!cols.includes('settlementNo')) cols.unshift('settlementNo')
return cols
})
const settlementList = ref<FreightSettlement[]>([])
const viewDialogRef = ref<InstanceType<typeof PlFreightSettlementViewDialog>>()
const quickSearchKeyword = ref('')
@@ -57,6 +57,15 @@
>
<el-icon><CircleClose /></el-icon>驳回
</el-button>
<ListExportDropdown
:export-fn="freightApi.export"
:get-filter-params="getSettlementExportFilterParams"
:has-selection="true"
:selected-ids="selectedRows.map((r) => r.id)"
:visible-columns="settlementExportColumns"
filename="待审批结算单.xlsx"
/>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
@@ -201,6 +210,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'
@@ -262,6 +272,20 @@ function getPendingStatCellValue(row: FreightSettlement, prop: string): unknown
const loading = ref(false)
const settlementList = ref<FreightSettlement[]>([])
const selectedRows = ref<FreightSettlement[]>([])
function getSettlementExportFilterParams() {
return {
tab: 'approval_pending',
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
}
}
const settlementExportColumns = computed(() => {
const cols = [...visibleColumns.value]
if (!cols.includes('settlementNo')) cols.unshift('settlementNo')
return cols
})
const viewingRow = ref<FreightSettlement | null>(null)
const viewDialogRef = ref<InstanceType<typeof PlFreightSettlementViewDialog>>()
const approvalDialogRef = ref<InstanceType<typeof PlFreightApprovalDialog>>()
@@ -41,6 +41,15 @@
>
<el-icon><Money /></el-icon>发放登记
</el-button>
<ListExportDropdown
:export-fn="freightApi.export"
:get-filter-params="getSettlementExportFilterParams"
:has-selection="true"
:selected-ids="selectedRows.map((r) => r.id)"
:visible-columns="settlementExportColumns"
filename="待发放结算单.xlsx"
/>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
@@ -165,6 +174,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'
@@ -226,6 +236,20 @@ function getDisburseStatCellValue(row: FreightSettlement, prop: string): unknown
const loading = ref(false)
const settlementList = ref<FreightSettlement[]>([])
const selectedRows = ref<FreightSettlement[]>([])
function getSettlementExportFilterParams() {
return {
tab: 'disburse',
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
}
}
const settlementExportColumns = computed(() => {
const cols = [...visibleColumns.value]
if (!cols.includes('settlementNo')) cols.unshift('settlementNo')
return cols
})
const viewingRow = ref<FreightSettlement | null>(null)
const viewDialogRef = ref<InstanceType<typeof PlFreightSettlementViewDialog>>()
const disburseDialogRef = ref<InstanceType<typeof PlFreightDisburseDialog>>()
@@ -33,6 +33,15 @@
@search="handleQuickSearch"
@clear="handleQuickSearchClear"
/>
<ListExportDropdown
:export-fn="freightApi.export"
:get-filter-params="getSettlementExportFilterParams"
:has-selection="true"
:selected-ids="selectedRows.map((r) => r.id)"
:visible-columns="settlementExportColumns"
filename="已结算.xlsx"
/>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
@@ -151,6 +160,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'
@@ -212,6 +222,20 @@ function getSettledStatCellValue(row: FreightSettlement, prop: string): unknown
const loading = ref(false)
const selectedRows = ref<FreightSettlement[]>([])
function getSettlementExportFilterParams() {
return {
tab: 'settled',
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
}
}
const settlementExportColumns = computed(() => {
const cols = [...visibleColumns.value]
if (!cols.includes('settlementNo')) cols.unshift('settlementNo')
return cols
})
const settlementList = ref<FreightSettlement[]>([])
const viewDialogRef = ref<InstanceType<typeof PlFreightSettlementViewDialog>>()
const quickSearchKeyword = ref('')
@@ -112,6 +112,15 @@
>
<el-icon><RefreshLeft /></el-icon>撤回
</el-button>
<ListExportDropdown
:export-fn="freightApi.export"
:get-filter-params="getSettlementExportFilterParams"
:has-selection="true"
:selected-ids="selectedRows.map((r) => r.id)"
:visible-columns="settlementExportColumns"
filename="结算单.xlsx"
/>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
@@ -320,6 +329,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'
@@ -413,6 +423,22 @@ const {
})
const settlementList = ref<FreightSettlement[]>([])
const selectedRows = ref<FreightSettlement[]>([])
function getSettlementExportFilterParams() {
return {
tab: 'bills',
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
carrierId: searchForm.carrierId || undefined,
settlementStatus: searchForm.settlementStatus || undefined
}
}
const settlementExportColumns = computed(() => {
const cols = [...visibleColumns.value]
if (!cols.includes('settlementNo')) cols.unshift('settlementNo')
return cols
})
const viewingRow = ref<FreightSettlement | null>(null)
const viewDialogRef = ref<InstanceType<typeof PlFreightSettlementViewDialog>>()
const formDialogRef = ref<InstanceType<typeof PlFreightSettlementFormDialog>>()
@@ -71,6 +71,15 @@
>
<el-icon><DocumentAdd /></el-icon>生成结算单
</el-button>
<ListExportDropdown
:export-fn="freightApi.exportUnsettledPlans"
:get-filter-params="getUnsettledExportFilterParams"
:has-selection="true"
:selected-ids="selectedRows.map((r) => r.id)"
:visible-columns="unsettledExportColumns"
filename="待结算计划.xlsx"
/>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
@@ -214,6 +223,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'
@@ -297,6 +307,22 @@ const vehicleOptions = ref<Vehicle[]>([])
const vehicleTrailerLookup = computed(() => buildVehicleTrailerLookup(vehicleOptions.value))
const planList = ref<UnsettledPlanItem[]>([])
const selectedRows = ref<UnsettledPlanItem[]>([])
function getUnsettledExportFilterParams() {
return {
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
carrierId: searchForm.carrierId || undefined,
planType: searchForm.planType || undefined,
licensePlate: searchForm.licensePlate || undefined
}
}
const unsettledExportColumns = computed(() => {
const cols = [...visibleColumns.value]
if (!cols.includes('planNo')) cols.unshift('planNo')
return cols
})
const planViewVisible = ref(false)
const viewPlanId = ref('')
const quickSearchKeyword = ref('')