feat(pl): add Excel export for carrier list
Add backend /transport/carrier/export and wire ListExportDropdown on the carrier page. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
e72bcc67bc
commit
85c96f0a5d
3 files changed
+132
-1
No files matched your search
@@ -46,6 +46,8 @@ export interface CarrierQuery {
|
||||
export const carrierApi = {
|
||||
list: (params?: CarrierQuery) =>
|
||||
request.get<PlListResponse<Carrier>>('/transport/carrier', { params }),
|
||||
export: (data: Record<string, any>) =>
|
||||
request.post('/transport/carrier/export', data, { responseType: 'blob' }),
|
||||
get: (id: string) => request.get<Carrier>(`/transport/carrier/${id}`),
|
||||
create: (data: Partial<Carrier>) => request.post<Carrier>('/transport/carrier', data),
|
||||
update: (id: string, data: Partial<Carrier>) => request.put<Carrier>(`/transport/carrier/${id}`, data),
|
||||
|
||||
@@ -63,6 +63,15 @@
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="carrierApi.export"
|
||||
:get-filter-params="getCarrierExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="carrierExportColumns"
|
||||
filename="承运商列表.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -320,6 +329,7 @@ import AttachmentUploadField from '@/components/business/attachment-upload-field
|
||||
import PlCarrierListAttachmentCell from '@/components/business/pl-carrier-list-attachment-cell/index.vue'
|
||||
import PlCarrierViewDialog from '@/components/business/pl-carrier-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'
|
||||
@@ -352,6 +362,21 @@ const {
|
||||
const submitLoading = ref(false)
|
||||
const carrierList = ref<Carrier[]>([])
|
||||
const selectedRows = ref<Carrier[]>([])
|
||||
|
||||
function getCarrierExportFilterParams() {
|
||||
const quick = quickSearchKeyword.value?.trim()
|
||||
return {
|
||||
q: quick || searchForm.q || undefined,
|
||||
status: searchForm.status || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const carrierExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('carrierName')) cols.unshift('carrierName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formRef = ref()
|
||||
|
||||
Reference in new issue
Block a user