Commit 2b736fd9 by wusiyi

feat: podus添加批量下载

parent 37d1f4b9
......@@ -355,7 +355,7 @@ export function updateSelfLogistics(params: {
}
// 更改物流
export function composingDesignImages(data: number[],type:string) {
export function composingDesignImages(data: number[], type: string) {
return axios.post<never, BaseRespData<never>>(
`factory/podJomallOrderUs/composingDesignImages?type=${type}`,
data,
......@@ -443,3 +443,44 @@ export function getListCraftApi() {
`factory/podJomallOrderProductUs/listCraft`,
)
}
// 批量下载 列表
export function batchDownloadApi(currentPage: number, pageSize: number) {
return axios.post<never, BaseRespData<never>>(
`factory/podUsBatchDownload/list_page`,
{
currentPage,
pageSize,
},
)
}
// 批量下载 下载
export function batchDownloadDownloadApi(params: { id: number }) {
return axios.get<never, BaseRespData<never>>(
`factory/podUsBatchDownload/download`,
{
params,
},
)
}
// 批量下载 删除
export function batchDownloadDeleteApi(params: { id: number }) {
return axios.get<never, BaseRespData<never>>(
`factory/podUsBatchDownload/delete`,
{
params,
},
)
}
// 批量下载 重新排版
export function batchDownloadRecomposingApi(params: { id: number }) {
return axios.get<never, BaseRespData<never>>(
`factory/podUsBatchDownload/reComposingDesignImages`,
{
params,
},
)
}
......@@ -257,6 +257,7 @@
>
<span class="tabs-node_label">{{ item.statusName }}</span>
<span
v-if="item.quantity"
class="tabs-node_count"
:class="{
blue: item.quantity && item.quantity > 0,
......@@ -476,7 +477,7 @@
<span v-if="status === 'TO_BE_ARRANGE'" class="item">
<ElButton type="warning" @click="arrangeFinish">排单完成</ElButton>
</span>
<span class="item">
<span v-if="status !== 'BATCH_DOWNLOAD'" class="item">
<ElButton type="primary" @click="downloadMaterial">下载素材</ElButton>
</span>
<span
......@@ -951,17 +952,64 @@
</div>
</div>
</template>
<template #syntheticStatus="{ row }">
<div style="white-space: pre-line">
<el-tag v-if="row.syntheticStatus" type="success">完成</el-tag>
<el-tag v-else type="danger">未完成</el-tag>
</div>
</template>
<template #downloadStatus="{ row }">
<div style="white-space: pre-line">
<el-tag v-if="row.downloadStatus" type="success"></el-tag>
<el-tag v-else type="danger"></el-tag>
</div>
</template>
<template #createTime="{ row }">
<div style="white-space: pre-line">
{{ row.createTime.replace('T', ' ') }}
</div>
</template>
<template #finishTime="{ row }">
<div style="white-space: pre-line">
{{ row.finishTime?.replace('T', ' ') }}
</div>
</template>
<template #operate="{ row }">
<div class="operate-box">
<div
v-if="status === 'BATCH_DOWNLOAD'"
class="operate-box-vertical"
>
<span class="operate-item">
<ElButton link type="primary" @click="handleDownload(row)">
下载
</ElButton>
</span>
<span class="operate-item">
<ElButton
link
type="warning"
@click="handleReComposingDesign(row)"
>
重新排版
</ElButton>
</span>
<span class="operate-item">
<ElButton link type="danger" @click="handleBatchDelete(row)">
删除
</ElButton>
</span>
</div>
<div v-else class="operate-box">
<span v-if="status !== 'BATCH_DOWNLOAD'" class="operate-item">
<ElButton
link
type="primary"
@click="operationLog(row.id, null)"
>
操作日志
</ElButton>
</span>
<!-- <span
v-if="!row.expressSheet && row.status === 'TO_BE_CONFIRMED'"
class="operate-item"
......@@ -1624,6 +1672,10 @@ import {
toOutOfStockApi,
arrangeFinishApi,
getListCraftApi,
batchDownloadApi,
batchDownloadDownloadApi,
batchDownloadDeleteApi,
batchDownloadRecomposingApi,
} from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api'
......@@ -1839,55 +1891,187 @@ const handleUpdateAddress = async (row: PodUsOrderListData) => {
currentRow.value = JSON.parse(JSON.stringify(row))
updateAddVisible.value = true
}
const tableColumns = computed(() => [
{
label: '商品',
prop: 'goods',
slot: 'goods',
minWidth: 920,
},
{
label: '订单详情',
prop: 'orderDetail',
slot: 'orderDetail',
width: 300,
},
{
label: '单价',
slot: 'price',
width: 160,
prop: 'price',
align: 'left',
},
{
label: '时间',
slot: 'time',
width: 180,
prop: 'time',
align: 'left',
},
// {
// label: '内部便签',
// slot: 'innerLabel',
// width: 300,
// prop: 'innerLabel',
// },
{
label: '异常原因',
width: 300,
prop: 'exceptionReason',
slot: 'exceptionReason',
align: 'left',
},
{
label: '操作',
slot: 'operate',
width: 180,
align: 'center',
fixed: 'right',
prop: 'operate',
},
])
// 批量下载 下载
const handleDownload = async (row: PodUsOrderListData) => {
try {
await showConfirm('确定下载吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
try {
const res = await batchDownloadDownloadApi({ id: row.id })
if (res.code !== 200 || !res.message) return
fetch(res.message)
.then((res) => res.blob())
.then((blob) => {
const link = document.createElement('a')
link.href = URL.createObjectURL(blob)
link.download = res.message
? res.message.split('/').pop() || 'download'
: 'download'
link.click()
})
ElMessage.success('操作成功')
} catch (e) {
console.error(e)
} finally {
search()
}
}
// 批量下载 删除
const handleBatchDelete = async (row: PodUsOrderListData) => {
try {
await showConfirm('确定删除吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const res = await batchDownloadDeleteApi({ id: row.id })
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
}
// 批量下载 重新排版
const handleReComposingDesign = async (row: PodUsOrderListData) => {
try {
await showConfirm('确定重新排版吗?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
const res = await batchDownloadRecomposingApi({ id: row.id })
if (res.code !== 200) return
ElMessage.success(res.message)
search()
}
const tableColumns = computed(() => {
if (status.value === 'BATCH_DOWNLOAD') {
return [
{
label: '批次号',
prop: 'batchArrangeNum',
minWidth: 200,
align: 'center',
},
{
label: '合成状态',
prop: 'syntheticStatus',
slot: 'syntheticStatus',
width: 150,
align: 'center',
},
{
label: '下载状态',
slot: 'downloadStatus',
width: 150,
prop: 'downloadStatus',
align: 'center',
},
{
label: '订单数量',
prop: 'productNum',
width: 120,
align: 'center',
},
{
label: '素材数量',
width: 120,
prop: 'materialNum',
align: 'center',
},
{
label: '创建人',
width: 200,
prop: 'employeeAccount',
align: 'center',
},
{
label: '创建时间',
width: 250,
prop: 'createTime',
slot: 'createTime',
align: 'center',
},
{
label: '完成时间',
width: 250,
prop: 'finishTime',
slot: 'finishTime',
align: 'center',
},
{
label: '操作',
slot: 'operate',
width: 200,
align: 'center',
fixed: 'right',
prop: 'operate',
},
]
}
return [
{
label: '商品',
prop: 'goods',
slot: 'goods',
minWidth: 920,
},
{
label: '订单详情',
prop: 'orderDetail',
slot: 'orderDetail',
width: 300,
},
{
label: '单价',
slot: 'price',
width: 160,
prop: 'price',
align: 'left',
},
{
label: '时间',
slot: 'time',
width: 180,
prop: 'time',
align: 'left',
},
// {
// label: '内部便签',
// slot: 'innerLabel',
// width: 300,
// prop: 'innerLabel',
// },
{
label: '异常原因',
width: 300,
prop: 'exceptionReason',
slot: 'exceptionReason',
align: 'left',
},
{
label: '操作',
slot: 'operate',
width: 180,
align: 'center',
fixed: 'right',
prop: 'operate',
},
]
})
const rightMenuRef = ref()
const rightClick = (e: MouseEvent) => {
rightMenuRef.value.setPosition({
......@@ -1995,7 +2179,12 @@ const {
} = usePageList({
initPageSize: initPageSize.value,
query: (page, pageSize) => {
if (
// 批量下载
if (status.value === 'BATCH_DOWNLOAD') {
return batchDownloadApi(page, pageSize).then((res) => {
return res.data
}) as never
} else if (
status.value !== 'IN_PRODUCTION' &&
status.value !== 'PICKING' &&
status.value !== 'TO_BE_REPLENISHMENT' &&
......@@ -3725,6 +3914,12 @@ const replenishmentSuccess = async () => {
gap: 10px;
}
.operate-box-vertical {
display: flex;
justify-content: space-around;
gap: 10px;
}
.file {
position: relative;
top: -5px;
......
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