feat(pl): add Excel export for vehicle, personnel, driver and address lists
Wire backend /export endpoints and ListExportDropdown on master-data list pages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
85c96f0a5d
commit
b06fb6ac56
8 files changed
+467
-1
No files matched your search
@@ -138,6 +138,8 @@ export interface VehicleQuery {
|
||||
|
||||
export const vehicleApi = {
|
||||
list: (params?: VehicleQuery) =>
|
||||
export: (data: Record<string, any>) =>
|
||||
request.post('/transport/vehicle/export', data, { responseType: 'blob' }),
|
||||
request.get<PlListResponse<Vehicle>>('/transport/vehicle', { params }),
|
||||
get: (id: string) => request.get<VehicleDetail>(`/transport/vehicle/${id}`),
|
||||
create: (data: VehiclePayload) => request.post<VehicleDetail>('/transport/vehicle', data),
|
||||
@@ -192,6 +194,8 @@ export interface PersonnelQuery {
|
||||
|
||||
export const personnelApi = {
|
||||
list: (params?: PersonnelQuery) =>
|
||||
export: (data: Record<string, any>) =>
|
||||
request.post('/transport/personnel/export', data, { responseType: 'blob' }),
|
||||
request.get<PlListResponse<Personnel>>('/transport/personnel', { params }),
|
||||
get: (id: string) => request.get<PersonnelDetail>(`/transport/personnel/${id}`),
|
||||
create: (data: PersonnelPayload) => request.post<PersonnelDetail>('/transport/personnel', data),
|
||||
@@ -293,6 +297,8 @@ export interface TransportAddressPayload {
|
||||
export const transportAddressApi = {
|
||||
list: (params?: TransportAddressQuery) =>
|
||||
request.get<PlListResponse<TransportAddress>>('/transport/address', { params }),
|
||||
export: (data: Record<string, any>) =>
|
||||
request.post('/transport/address/export', data, { responseType: 'blob' }),
|
||||
listAll: (params?: { q?: string }) =>
|
||||
/** 选择器:仅按地址名称、详细地址模糊检索(不含联系人/电话) */
|
||||
request.get<PlListResponse<TransportAddress>>('/transport/address/all', { params }),
|
||||
@@ -348,6 +354,8 @@ function driverToPersonnelPayload(data: Partial<Driver>): PersonnelPayload {
|
||||
}
|
||||
|
||||
export const driverApi = {
|
||||
export: (data: Record<string, any>) =>
|
||||
request.post('/transport/driver/export', data, { responseType: 'blob' }),
|
||||
list: async (params?: DriverQuery) => {
|
||||
const res = await personnelApi.list({
|
||||
q: params?.q,
|
||||
|
||||
@@ -57,6 +57,15 @@
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="driverApi.export"
|
||||
:get-filter-params="getDriverExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="driverExportColumns"
|
||||
filename="司机列表.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -285,6 +294,7 @@ import { driverApi, type Driver } from '@/api/pl'
|
||||
import SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
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 { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { pickBxPageResult } from '@/utils/http/bx'
|
||||
@@ -321,6 +331,19 @@ const {
|
||||
})
|
||||
|
||||
const selectedRows = ref<Driver[]>([])
|
||||
|
||||
function getDriverExportFilterParams() {
|
||||
return {
|
||||
q: quickSearchKeyword.value.trim() || searchForm.q || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const driverExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('driverName')) cols.unshift('driverName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formRef = ref()
|
||||
|
||||
@@ -70,6 +70,15 @@
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="personnelApi.export"
|
||||
:get-filter-params="getPersonnelExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="personnelExportColumns"
|
||||
filename="人员列表.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -427,6 +436,7 @@ import SystemViewDialog, {
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
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 { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
@@ -497,6 +507,21 @@ const {
|
||||
const submitLoading = ref(false)
|
||||
const personnelRows = ref<Personnel[]>([])
|
||||
const selectedRows = ref<Personnel[]>([])
|
||||
|
||||
function getPersonnelExportFilterParams() {
|
||||
return {
|
||||
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
|
||||
status: searchForm.status || undefined,
|
||||
personnelAffiliation: affiliationMode.value
|
||||
}
|
||||
}
|
||||
|
||||
const personnelExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('personnelName')) cols.unshift('personnelName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const pasteVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
|
||||
@@ -81,6 +81,15 @@
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="vehicleApi.export"
|
||||
:get-filter-params="getSelfVehicleExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="selfVehicleExportColumns"
|
||||
filename="自有车列表.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -459,6 +468,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 AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
@@ -584,6 +594,22 @@ const { handlePersonnelFormSaved } = usePlVehiclePersonnelQuickCreate({
|
||||
onSelect: handlePersonnelSelect
|
||||
})
|
||||
const selectedRows = ref<Vehicle[]>([])
|
||||
|
||||
function getSelfVehicleExportFilterParams() {
|
||||
return {
|
||||
vehicleType: VEHICLE_TYPE_SELF,
|
||||
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
|
||||
vehicleStatus: searchForm.vehicleStatus || undefined,
|
||||
carrierId: searchForm.carrierId || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const selfVehicleExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('licensePlate')) cols.unshift('licensePlate')
|
||||
return cols
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formRef = ref()
|
||||
|
||||
@@ -61,6 +61,15 @@
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="transportAddressApi.export"
|
||||
:get-filter-params="getAddressExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="addressExportColumns"
|
||||
filename="运输地址.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -268,6 +277,7 @@ import {
|
||||
import AmapAddressPicker from '@/components/business/amap-address-picker/index.vue'
|
||||
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 SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
@@ -298,6 +308,20 @@ const {
|
||||
const submitLoading = ref(false)
|
||||
const addressRows = ref<TransportAddress[]>([])
|
||||
const selectedRows = ref<TransportAddress[]>([])
|
||||
|
||||
function getAddressExportFilterParams() {
|
||||
return {
|
||||
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
|
||||
status: searchForm.status || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const addressExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('addressName')) cols.unshift('addressName')
|
||||
return cols.filter((c) => c !== 'coordinates')
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formRef = ref()
|
||||
|
||||
@@ -86,6 +86,15 @@
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="vehicleApi.export"
|
||||
:get-filter-params="getVehicleExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="vehicleExportColumns"
|
||||
filename="车辆列表.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -477,6 +486,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 AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
@@ -601,6 +611,22 @@ const { handlePersonnelFormSaved } = usePlVehiclePersonnelQuickCreate({
|
||||
onSelect: handlePersonnelSelect
|
||||
})
|
||||
const selectedRows = ref<Vehicle[]>([])
|
||||
|
||||
function getVehicleExportFilterParams() {
|
||||
return {
|
||||
q: quickSearchKeyword.value.trim() || searchForm.q || undefined,
|
||||
vehicleType: VEHICLE_TYPE_LOCK,
|
||||
carrierId: searchForm.carrierId || undefined,
|
||||
vehicleStatus: searchForm.vehicleStatus || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const vehicleExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('licensePlate')) cols.unshift('licensePlate')
|
||||
return cols
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const pasteVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
|
||||
Reference in new issue
Block a user