Commit df478ce8 by wuqian

已完成导出

parent 4ac1e4c2
...@@ -8,10 +8,16 @@ import { ...@@ -8,10 +8,16 @@ import {
ProductionClient, ProductionClient,
WarehouseListData, WarehouseListData,
LogisticsData, LogisticsData,
ExportParams
} from '@/types/api/podUsOrder' } from '@/types/api/podUsOrder'
import axios from './axios' import axios from './axios'
import { PodMakeOrderData } from '@/types/api/podMakeOrder' 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[]) { export function syncReceiverAddress(data: number[]) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
......
...@@ -3,30 +3,34 @@ export interface Tab { ...@@ -3,30 +3,34 @@ export interface Tab {
statusName?: string statusName?: string
quantity?: number quantity?: number
} }
export interface ExportParams extends SearchForm {
idList?: number[]
exportAll: boolean
}
export interface SearchForm { export interface SearchForm {
timeType: number | null timeType?: number | null
shopNumber: string shopNumber?: string
shipmentType: string shipmentType?: string
userMark: string userMark?: string
processNumber: string processNumber?: string
baseSku: string baseSku?: string
factoryOrderNumber: string factoryOrderNumber?: string
sku: string sku?: string
factorySubOrderNumber: string factorySubOrderNumber?: string
status: string status?: string
customizedQuantity: string customizedQuantity?: string
multi: boolean | null multi?: boolean | null
startTime: string | null startTime?: string | null
endTime: string | null endTime?: string | null
exceptionHandling: number | undefined exceptionHandling?: number | undefined
platform: string platform?: string
productionClient: string productionClient?: string
warehouseId: string | number warehouseId?: string | number
thirdSkuCode: string thirdSkuCode?: string
supplierProductNo: string supplierProductNo?: string
batchArrangeNumber: string batchArrangeNumber?: string
craftCode: string craftCode?: string
thirdStockSku: string thirdStockSku?: string
} }
export interface PodUsOrderListData { export interface PodUsOrderListData {
id: number id: number
......
...@@ -470,6 +470,14 @@ ...@@ -470,6 +470,14 @@
刷新素材 刷新素材
</ElButton> </ElButton>
</span> </span>
<span v-if="status === 'COMPLETE'" class="item">
<ElButton
:loading="exportLoading"
type="success"
@click="exportData"
>导出</ElButton
>
</span>
</ElFormItem> </ElFormItem>
</ElForm> </ElForm>
</div> </div>
...@@ -1803,9 +1811,33 @@ ...@@ -1803,9 +1811,33 @@
<el-button type="primary" @click="logisticsSubmit"> 确定</el-button> <el-button type="primary" @click="logisticsSubmit"> 确定</el-button>
</template> </template>
</el-dialog> </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> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getUserMarkList } from '@/api/common' import { getUserMarkList } from '@/api/common'
// import { AnyObject } from '@/types/api/warehouse'
import { import {
ArrowDown, ArrowDown,
CaretBottom, CaretBottom,
...@@ -1861,6 +1893,7 @@ import { ...@@ -1861,6 +1893,7 @@ import {
batchDownloadDeleteApi, batchDownloadDeleteApi,
batchDownloadRecomposingApi, batchDownloadRecomposingApi,
updateToWaitShipmentApi, updateToWaitShipmentApi,
exportPodUSInfo,
} from '@/api/podUsOrder' } from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api' import { BaseRespData } from '@/types/api'
...@@ -1882,6 +1915,7 @@ import { ...@@ -1882,6 +1915,7 @@ import {
LogisticsData, LogisticsData,
LogisticsFormData, LogisticsFormData,
CraftListData, CraftListData,
ExportParams,
} from '@/types/api/podUsOrder' } from '@/types/api/podUsOrder'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
...@@ -1928,7 +1962,54 @@ const currentRow = ref<AddressInfo>({ ...@@ -1928,7 +1962,54 @@ const currentRow = ref<AddressInfo>({
receiverAddress2: '', receiverAddress2: '',
receiverPostCode: '', 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 updateAddVisible = ref(false)
const initPageSize = ref(50) const initPageSize = ref(50)
const logisticsVisible = ref(false) 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