Commit df478ce8 by wuqian

已完成导出

parent 4ac1e4c2
......@@ -8,10 +8,16 @@ import {
ProductionClient,
WarehouseListData,
LogisticsData,
ExportParams
} from '@/types/api/podUsOrder'
import axios from './axios'
import { PodMakeOrderData } from '@/types/api/podMakeOrder'
export function exportPodUSInfo(data: ExportParams) {
return axios.post<never, BasePaginationData<never>>(
'factory/podJomallOrderUs/exportPodUsOrder',
data,
)
}
// 同步收货地址
export function syncReceiverAddress(data: number[]) {
return axios.post<never, BaseRespData<never>>(
......
......@@ -3,30 +3,34 @@ export interface Tab {
statusName?: string
quantity?: number
}
export interface ExportParams extends SearchForm {
idList?: number[]
exportAll: boolean
}
export interface SearchForm {
timeType: number | null
shopNumber: string
shipmentType: string
userMark: string
processNumber: string
baseSku: string
factoryOrderNumber: string
sku: string
factorySubOrderNumber: string
status: string
customizedQuantity: string
multi: boolean | null
startTime: string | null
endTime: string | null
exceptionHandling: number | undefined
platform: string
productionClient: string
warehouseId: string | number
thirdSkuCode: string
supplierProductNo: string
batchArrangeNumber: string
craftCode: string
thirdStockSku: string
timeType?: number | null
shopNumber?: string
shipmentType?: string
userMark?: string
processNumber?: string
baseSku?: string
factoryOrderNumber?: string
sku?: string
factorySubOrderNumber?: string
status?: string
customizedQuantity?: string
multi?: boolean | null
startTime?: string | null
endTime?: string | null
exceptionHandling?: number | undefined
platform?: string
productionClient?: string
warehouseId?: string | number
thirdSkuCode?: string
supplierProductNo?: string
batchArrangeNumber?: string
craftCode?: string
thirdStockSku?: string
}
export interface PodUsOrderListData {
id: number
......
......@@ -470,6 +470,14 @@
刷新素材
</ElButton>
</span>
<span v-if="status === 'COMPLETE'" class="item">
<ElButton
:loading="exportLoading"
type="success"
@click="exportData"
>导出</ElButton
>
</span>
</ElFormItem>
</ElForm>
</div>
......@@ -1803,9 +1811,33 @@
<el-button type="primary" @click="logisticsSubmit"> 确定</el-button>
</template>
</el-dialog>
<!-- 导出 -->
<ElDialog
v-model="exportVisible"
title="导出选项"
width="500px"
:close-on-click-modal="false"
>
<el-form :model="exportForm" label-width="80px">
<el-form-item label="" prop="resource">
<el-radio-group v-model="exportForm.resource">
<el-radio :label="0">导出本页</el-radio>
<el-radio :label="1">导出选中</el-radio>
<el-radio :label="2">全部</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="exportVisible = false">取消</el-button>
<el-button type="primary" @click="submitExportForm">确认</el-button>
</span>
</template>
</ElDialog>
</template>
<script setup lang="ts">
import { getUserMarkList } from '@/api/common'
// import { AnyObject } from '@/types/api/warehouse'
import {
ArrowDown,
CaretBottom,
......@@ -1861,6 +1893,7 @@ import {
batchDownloadDeleteApi,
batchDownloadRecomposingApi,
updateToWaitShipmentApi,
exportPodUSInfo,
} from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api'
......@@ -1882,6 +1915,7 @@ import {
LogisticsData,
LogisticsFormData,
CraftListData,
ExportParams,
} from '@/types/api/podUsOrder'
import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue'
......@@ -1928,7 +1962,54 @@ const currentRow = ref<AddressInfo>({
receiverAddress2: '',
receiverPostCode: '',
})
const exportLoading = ref(false)
const exportVisible = ref(false)
const exportForm = ref({
resource: '',
})
const exportData = () => {
exportVisible.value = true
}
const submitExportForm = async () => {
if (exportForm.value.resource === '') {
return ElMessage.error('请选择导出类型')
}
exportLoading.value = true
const resourceType = Number(exportForm.value.resource)
const params: ExportParams = {
exportAll: false,
idList: [],
}
// 使用函数封装映射逻辑
const mapIds = (items: PodUsOrderListData[]) =>
items.map((el) => Number(el.id))
switch (resourceType) {
case 0:
params.idList = mapIds(tableData.value as PodUsOrderListData[])
break
case 1:
params.idList = mapIds(selection.value)
break
case 2:
params.exportAll = true
params.idList = undefined
break
default:
console.error('未知的资源类型:', resourceType)
}
try {
const res = await exportPodUSInfo({
...params,
...(resourceType === 2 ? searchForm.value : {}),
})
window.open(filePath + res.message, '_blank')
exportVisible.value = false
exportLoading.value = false
} catch (e) {
exportVisible.value = false
exportLoading.value = false
}
}
const updateAddVisible = ref(false)
const initPageSize = ref(50)
const logisticsVisible = ref(false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment