Commit b366404d by wusiyi

feat: podus批量下载添加tif下载

parent 306c9c3e
......@@ -456,7 +456,7 @@ export function batchDownloadApi(currentPage: number, pageSize: number) {
}
// 批量下载 下载
export function batchDownloadDownloadApi(params: { id: number }) {
export function batchDownloadDownloadApi(params: { id: number; type: string }) {
return axios.get<never, BaseRespData<never>>(
`factory/podUsBatchDownload/download`,
{
......
......@@ -69,6 +69,8 @@ export interface PodUsOrderListData {
orderNumber?: string
logisticsWayId?: number | null
logisticsWayName?: string
url?: string | null
tiffUrl?: string | null
}
export interface ProductList {
id: number
......
......@@ -956,16 +956,10 @@
</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>
<el-tag v-if="row.downloadStatus" type="success">已下载</el-tag>
<el-tag v-else type="danger">未下载</el-tag>
</div>
</template>
<template #createTime="{ row }">
......@@ -984,8 +978,23 @@
class="operate-box-vertical"
>
<span class="operate-item">
<ElButton link type="primary" @click="handleDownload(row)">
下载
<ElButton
:disabled="!row.url"
link
type="primary"
@click="handleDownload(row, 'png')"
>
PNG下载
</ElButton>
</span>
<span class="operate-item">
<ElButton
:disabled="!row.tiffUrl"
link
type="primary"
@click="handleDownload(row, 'tiff')"
>
TIF下载
</ElButton>
</span>
<span class="operate-item">
......@@ -1896,7 +1905,7 @@ const handleUpdateAddress = async (row: PodUsOrderListData) => {
updateAddVisible.value = true
}
// 批量下载 下载
const handleDownload = async (row: PodUsOrderListData) => {
const handleDownload = async (row: PodUsOrderListData, type: string) => {
try {
await showConfirm('确定下载吗?', {
confirmButtonText: '确认',
......@@ -1906,11 +1915,13 @@ const handleDownload = async (row: PodUsOrderListData) => {
} catch {
return
}
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await batchDownloadDownloadApi({ id: row.id })
if (res.code !== 200 || !res.message) return
const url = filePath + res.message
const url = filePath + (type === 'png' ? row.url : row.tiffUrl)
fetch(url)
.then((res) => res.blob())
......@@ -1920,11 +1931,16 @@ const handleDownload = async (row: PodUsOrderListData) => {
link.download = url ? url.split('/').pop() || 'download' : 'download'
link.click()
})
ElMessage.success('操作成功')
.then(() => {
batchDownloadDownloadApi({ id: row.id, type })
ElMessage.success('操作成功')
search()
loadTabData()
})
} catch (e) {
console.error(e)
} finally {
search()
loading.close()
}
}
// 批量下载 删除
......@@ -1938,11 +1954,21 @@ const handleBatchDelete = async (row: PodUsOrderListData) => {
} catch {
return
}
const res = await batchDownloadDeleteApi({ id: row.id })
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await batchDownloadDeleteApi({ id: row.id })
if (res.code !== 200) return
ElMessage.success(res.message)
search()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
// 批量下载 重新排版
const handleReComposingDesign = async (row: PodUsOrderListData) => {
......@@ -1955,10 +1981,22 @@ const handleReComposingDesign = async (row: PodUsOrderListData) => {
} catch {
return
}
const res = await batchDownloadRecomposingApi({ id: row.id })
if (res.code !== 200) return
ElMessage.success(res.message)
search()
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await batchDownloadRecomposingApi({ id: row.id })
if (res.code !== 200) return
ElMessage.success('操作成功')
search()
loadTabData()
} catch (e) {
console.error(e)
} finally {
loading.close()
}
}
const tableColumns = computed(() => {
if (status.value === 'BATCH_DOWNLOAD') {
......@@ -1970,13 +2008,6 @@ const tableColumns = computed(() => {
align: 'center',
},
{
label: '合成状态',
prop: 'syntheticStatus',
slot: 'syntheticStatus',
width: 150,
align: 'center',
},
{
label: '下载状态',
slot: 'downloadStatus',
width: 150,
......@@ -2018,7 +2049,7 @@ const tableColumns = computed(() => {
{
label: '操作',
slot: 'operate',
width: 200,
width: 300,
align: 'center',
fixed: 'right',
prop: 'operate',
......
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