Commit 51c71525 by qinjianhui

feat: NEW POD ORDER 订单导出功能开发

parent b1de8e9f
...@@ -13,6 +13,7 @@ import type { ...@@ -13,6 +13,7 @@ import type {
StatusTreeNode, StatusTreeNode,
} from '@/types/api/factoryOrderNew' } from '@/types/api/factoryOrderNew'
import { ResultInfoDataItem } from '@/types/api/order/common' import { ResultInfoDataItem } from '@/types/api/order/common'
import { ExportParams } from '@/types/api/order/factoryOrderNew'
import type { OrderData } from '@/types/api/podMakeOrder' import type { OrderData } from '@/types/api/podMakeOrder'
import type { PrintData } from '@/types/api/podOrder' import type { PrintData } from '@/types/api/podOrder'
function normalizePodOrderQueryPayload( function normalizePodOrderQueryPayload(
...@@ -582,3 +583,10 @@ export function getCustomTagListPodOrderApi() { ...@@ -582,3 +583,10 @@ export function getCustomTagListPodOrderApi() {
`factory/podOrder/getCustomTagList`, `factory/podOrder/getCustomTagList`,
) )
} }
export function exportFactoryOrderInfo(data: ExportParams) {
return axios.post<never, BaseRespData<never>>(
'factory/podOrder/exportPodOrder',
data,
)
}
...@@ -173,7 +173,11 @@ export interface operateOrderListData { ...@@ -173,7 +173,11 @@ export interface operateOrderListData {
statusName?: string statusName?: string
[key: string]: unknown [key: string]: unknown
} }
export interface ExportParams extends SearchForm {
idList?: number[]
exportAll: boolean
orderTracking?: boolean
}
export interface LogListData { export interface LogListData {
id: number id: number
bizId?: number | string bizId?: number | string
......
...@@ -351,6 +351,9 @@ ...@@ -351,6 +351,9 @@
</ElButton> </ElButton>
<ElButton @click="reset"> 重置 </ElButton> <ElButton @click="reset"> 重置 </ElButton>
</ElFormItem> </ElFormItem>
<ElFormItem v-if="status === 'ALL'">
<ElButton type="success" @click="exportData"> 导出 </ElButton>
</ElFormItem>
</ElForm> </ElForm>
</div> </div>
</div> </div>
...@@ -895,6 +898,28 @@ ...@@ -895,6 +898,28 @@
:submit-address-api="submitFactoryOrderReceiverAddress" :submit-address-api="submitFactoryOrderReceiverAddress"
@success="() => refreshCurrentView({ isRefreshTree: true })" @success="() => refreshCurrentView({ isRefreshTree: true })"
/> />
<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>
</div> </div>
</template> </template>
...@@ -914,6 +939,7 @@ import type { BaseRespData } from '@/types/api' ...@@ -914,6 +939,7 @@ import type { BaseRespData } from '@/types/api'
import type { import type {
FactoryOrderNewListData, FactoryOrderNewListData,
ProductListData, ProductListData,
ExportParams,
operateOrderListData, operateOrderListData,
} from '@/types/api/order/factoryOrderNew' } from '@/types/api/order/factoryOrderNew'
import type { AddressInfo } from '@/types/api/podCnOrder' import type { AddressInfo } from '@/types/api/podCnOrder'
...@@ -945,6 +971,7 @@ import { ...@@ -945,6 +971,7 @@ import {
getFactoryOrderNewOperateDetailApi, getFactoryOrderNewOperateDetailApi,
statusPushApi, statusPushApi,
arrangeFinishApi, arrangeFinishApi,
exportFactoryOrderInfo,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import { filePath } from '@/api/axios' import { filePath } from '@/api/axios'
...@@ -985,6 +1012,10 @@ const resultRefs = ref() ...@@ -985,6 +1012,10 @@ const resultRefs = ref()
const batchManageRef = ref<InstanceType<typeof BatchManageTable>>() const batchManageRef = ref<InstanceType<typeof BatchManageTable>>()
const waitingRestockRef = ref<InstanceType<typeof WaitingRestockTable>>() const waitingRestockRef = ref<InstanceType<typeof WaitingRestockTable>>()
const cardLayoutRef = ref<InstanceType<typeof CardLayout>>() const cardLayoutRef = ref<InstanceType<typeof CardLayout>>()
const exportVisible = ref(false)
const exportForm = ref({
resource: '',
})
const { const {
userMarkList, userMarkList,
...@@ -1071,7 +1102,59 @@ const { ...@@ -1071,7 +1102,59 @@ const {
}) })
statusCurrentPageRef.value = currentPage.value statusCurrentPageRef.value = currentPage.value
statusPageSizeRef.value = pageSize.value statusPageSizeRef.value = pageSize.value
const exportData = () => {
exportVisible.value = true
exportForm.value.resource = ''
}
const submitExportForm = async () => {
if (exportForm.value.resource === '') {
return ElMessage.error('请选择导出类型')
}
const resourceType = Number(exportForm.value.resource)
const params: ExportParams = {
exportAll: false,
idList: [],
}
const mapIds = (items: FactoryOrderNewListData[]) =>
items.map((el) => Number(el.id))
switch (resourceType) {
case 0:
params.idList = mapIds(tableData.value as FactoryOrderNewListData[])
break
case 1:
if (selectedRows.value.length === 0) {
return ElMessage.error('请选择要导出的订单')
}
params.idList = mapIds(selectedRows.value)
break
case 2:
params.exportAll = true
params.idList = undefined
break
default:
console.error('未知的资源类型:', resourceType)
}
const loading = ElLoading.service({
text: '导出中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
await exportFactoryOrderInfo({
...params,
...(resourceType === 2
? {
...searchForm.value,
}
: {}),
})
ElMessage.success('请求成功,请稍后到右上角[我的下载]中查看')
exportVisible.value = false
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const refreshCurrentView = (options?: { isRefreshTree?: boolean }) => { const refreshCurrentView = (options?: { isRefreshTree?: boolean }) => {
if (options?.isRefreshTree) void loadStatusTreeCounts() if (options?.isRefreshTree) void loadStatusTreeCounts()
if (isSpecialLayout.value) { if (isSpecialLayout.value) {
...@@ -1306,6 +1389,7 @@ const mainColumns = computed(() => [ ...@@ -1306,6 +1389,7 @@ const mainColumns = computed(() => [
label: '完成时间', label: '完成时间',
sortable: 'custom', sortable: 'custom',
minWidth: 180, minWidth: 180,
align: 'center',
}, },
{ {
prop: 'operation', prop: 'operation',
...@@ -1764,9 +1848,7 @@ const handleArrange = async () => { ...@@ -1764,9 +1848,7 @@ const handleArrange = async () => {
.map((item) => item.productMark) .map((item) => item.productMark)
.filter(Boolean) .filter(Boolean)
.map((mark) => .map((mark) =>
mark === 'custom_normal' || mark === 'normal' mark === 'custom_normal' || mark === 'normal' ? 'normal_group' : mark,
? 'normal_group'
: mark,
), ),
), ),
) )
......
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