Commit b366404d by wusiyi

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

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