feat(pl): add Excel export for inventory ledger and inbound/outbound lists
Allow filtered and selected row export on inventory and shared IO order pages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
89e8d6e65c
commit
8f1f08b284
5 files changed
+241
-3
No files matched your search
@@ -963,6 +963,8 @@ export interface PlIoOrderListResponse {
|
||||
export const inboundOrderApi = {
|
||||
list: (params?: PlIoOrderQuery) =>
|
||||
request.get<PlIoOrderListResponse>('/transport/inbound/', { params }),
|
||||
export: (data: Record<string, any>) =>
|
||||
request.post('/transport/inbound/export', data, { responseType: 'blob' }),
|
||||
get: (id: string) => request.get<PlIoOrder>(`/transport/inbound/${id}`),
|
||||
getByPlan: (planId: string) =>
|
||||
request.get<PlIoOrder | null>(`/transport/inbound/by-plan/${planId}`),
|
||||
@@ -975,6 +977,8 @@ export const inboundOrderApi = {
|
||||
export const outboundOrderApi = {
|
||||
list: (params?: PlIoOrderQuery) =>
|
||||
request.get<PlIoOrderListResponse>('/transport/outbound/', { params }),
|
||||
export: (data: Record<string, any>) =>
|
||||
request.post('/transport/outbound/export', data, { responseType: 'blob' }),
|
||||
get: (id: string) => request.get<PlIoOrder>(`/transport/outbound/${id}`),
|
||||
getByPlan: (planId: string) =>
|
||||
request.get<PlIoOrder | null>(`/transport/outbound/by-plan/${planId}`),
|
||||
@@ -1288,6 +1292,8 @@ export interface InventoryLedgerResponse {
|
||||
export const inventoryApi = {
|
||||
ledger: (params?: InventoryLedgerQuery) =>
|
||||
request.get<InventoryLedgerResponse>('/transport/inventory/ledger', { params }),
|
||||
exportLedger: (data: Record<string, any>) =>
|
||||
request.post('/transport/inventory/ledger/export', data, { responseType: 'blob' }),
|
||||
transactions: (params?: any) =>
|
||||
request.get<{ total: number; list: InventoryTransaction[] }>('/transport/inventory/transactions', { params }),
|
||||
summary: (params: { groupBy: string; dateFrom: string; dateTo: string; productId?: string }) =>
|
||||
|
||||
@@ -54,6 +54,14 @@
|
||||
@search="handleQuickSearch"
|
||||
@clear="handleQuickSearchClear"
|
||||
/>
|
||||
<ListExportDropdown
|
||||
:export-fn="api.export"
|
||||
:get-filter-params="getIoOrderExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="ioOrderExportColumns"
|
||||
:filename="kind === 'inbound' ? '入库单.xlsx' : '出库单.xlsx'"
|
||||
/>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@@ -426,6 +434,7 @@
|
||||
type BrandQtyRow
|
||||
} from '@/components/business/brand-qty-chips-field/index.vue'
|
||||
import ListQuickSearchInput from '@/components/business/list-quick-search-input/index.vue'
|
||||
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
|
||||
import ListToolbarDateShortcuts from '@/components/core/list-toolbar-date-shortcuts/index.vue'
|
||||
import ListColumnStatsRow from '@/components/business/list-column-stats-row/index.vue'
|
||||
import type { StatsRowColumn } from '@/utils/list-column-stats'
|
||||
@@ -584,6 +593,34 @@
|
||||
const saving = ref(false)
|
||||
const rows = ref<PlIoOrder[]>([])
|
||||
const selectedRows = ref<PlIoOrder[]>([])
|
||||
|
||||
function getIoOrderExportFilterParams() {
|
||||
const keyword = quickSearch.value.trim()
|
||||
return {
|
||||
orderNo: keyword ? undefined : searchForm.orderNo || undefined,
|
||||
planNo: keyword ? undefined : searchForm.planNo || undefined,
|
||||
partnerCompany: keyword ? undefined : searchForm.partnerCompany || undefined,
|
||||
status: searchForm.status || undefined,
|
||||
vehicleNo: searchForm.vehicleNo || undefined,
|
||||
q: keyword || undefined,
|
||||
planDateFrom: dateRange.value?.[0] || undefined,
|
||||
planDateTo: dateRange.value?.[1] || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const ioOrderExportColumns = [
|
||||
'orderNo',
|
||||
'status',
|
||||
'planNo',
|
||||
'partnerCompany',
|
||||
'vehicleNo',
|
||||
'pickupAddress',
|
||||
'destinationAddress',
|
||||
'planDate',
|
||||
'actualQtyTotal',
|
||||
'siteFeedbackTime'
|
||||
]
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const editForm = ref<(Omit<PlIoOrder, 'items'> & { items: IoOrderEditItem[] }) | null>(null)
|
||||
const editImagesCsv = ref('')
|
||||
|
||||
@@ -36,6 +36,15 @@
|
||||
@clear="handleQuickSearchClear"
|
||||
/>
|
||||
|
||||
<ListExportDropdown
|
||||
:export-fn="inventoryApi.exportLedger"
|
||||
:get-filter-params="getLedgerExportFilterParams"
|
||||
:has-selection="true"
|
||||
:selected-ids="selectedRows.map((r) => r.id)"
|
||||
:visible-columns="ledgerExportColumns"
|
||||
filename="库存台账.xlsx"
|
||||
/>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
@@ -177,6 +186,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 { RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { inventoryApi, type InventoryRecord } from '@/api/pl'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
@@ -202,6 +212,20 @@ const {
|
||||
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<any[]>([])
|
||||
|
||||
function getLedgerExportFilterParams() {
|
||||
const keyword = quickSearchKeyword.value.trim()
|
||||
return {
|
||||
productName: keyword || searchForm.productName || undefined
|
||||
}
|
||||
}
|
||||
|
||||
const ledgerExportColumns = computed(() => {
|
||||
const cols = [...visibleColumns.value]
|
||||
if (!cols.includes('productName')) cols.unshift('productName')
|
||||
return cols
|
||||
})
|
||||
|
||||
const inventoryList = ref<InventoryRecord[]>([])
|
||||
const quickSearchKeyword = ref('')
|
||||
|
||||
|
||||
Reference in new issue
Block a user