Commit e980eddb by linjinhong

podus待发货添加下载素材,tiff排版,png排版按钮

parent f3e39cc2
......@@ -465,7 +465,10 @@
<span v-if="status === 'TO_BE_ARRANGE'" class="item">
<ElButton type="warning" @click="arrangeFinish">排单完成</ElButton>
</span>
<span v-if="status !== 'BATCH_DOWNLOAD'" class="item">
<span
v-if="status !== 'BATCH_DOWNLOAD' && status !== 'WAIT_SHIPMENT'"
class="item"
>
<ElButton type="primary" @click="downloadMaterial"
>下载素材</ElButton
>
......@@ -803,6 +806,7 @@
<div
v-if="status === 'WAIT_SHIPMENT' || status === 'COMPLETE'"
class="goods-item-info-item"
style="align-items: start"
>
<span class="goods-item-info-item-label">补胚数量:</span>
<span
......@@ -811,14 +815,77 @@
>
{{ item.replenishmentSumNum || 0 }}
</span>
<el-button
<!-- <ElDropdown
v-if="status === 'WAIT_SHIPMENT'"
link
style="height: 23px"
size="small"
type="success"
@click="applyForReplenishment(item)"
>申请补胚
</el-button>
>
<span class="el-dropdown-link"
>素材接口<el-icon class="el-icon--right"
><ArrowDown /></el-icon
></span>
<template #dropdown>
<ElDropdownMenu>
<ElDropdownItem @click="applyForReplenishment(item)"
>申请补胚</ElDropdownItem
>
<ElDropdownItem @click="downloadMaterialItem(item)"
>下载素材</ElDropdownItem
>
<ElDropdownItem
@click="downloadTifItem('tiff', item.id)"
>TIF排版</ElDropdownItem
>
<ElDropdownItem
@click="downloadTifItem('png', item.id)"
>PNG排版</ElDropdownItem
>
</ElDropdownMenu>
</template>
</ElDropdown> -->
<div
v-if="status === 'WAIT_SHIPMENT'"
style="
display: flex;
flex-direction: column;
align-items: center;
"
>
<el-button
link
size="small"
type="success"
style="height: 23px"
@click="applyForReplenishment(item)"
>申请补胚
</el-button>
<el-button
link
size="small"
type="success"
style="height: 23px; margin-left: 0"
@click="downloadMaterialItem(item)"
>下载素材
</el-button>
<el-button
link
size="small"
type="success"
style="height: 23px; margin-left: 0"
@click="downloadTifItem('tiff', item.id)"
>TIF排版
</el-button>
<el-button
link
size="small"
type="success"
style="height: 23px; margin-left: 0"
@click="downloadTifItem('png', item.id)"
>PNG排版
</el-button>
</div>
<!-- f -->
</div>
<div class="goods-item-info-item">
......@@ -2825,7 +2892,51 @@ const downloadTif = async (type: string) => {
}
}
}
const downloadTifItem = async (type: string, id: number) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await composingDesignImages([id], type)
const url =
type === 'tiff'
? `https://ps.jomalls.com/tiff/` + res.message
: filePath + res.message
if (type === 'tiff') {
window.open(url, '_blank')
} else {
fetch(url)
.then((response) => {
// 确保响应是 OK
if (!response.ok) {
throw new Error('网络响应错误')
}
// 返回图片的二进制数据(Blob)
return response.blob()
})
.then((blob) => {
const a = document.createElement('a')
a.href = window.URL.createObjectURL(blob)
a.target = '_blank'
a.download = (res.message as string).split('/')[
(res.message as string).split('/').length - 1
]
a.click()
pngDownloadLoading.value = false
})
.catch((error) => {
console.error('下载图片时出错:', error)
pngDownloadLoading.value = false
})
}
} catch (e) {
console.log(e)
} finally {
loading.close()
}
}
const loadProductionClient = async () => {
try {
const res = await getProductionClientApi()
......@@ -3227,6 +3338,24 @@ const downloadMaterial = async () => {
loading.close()
}
}
// 下载单个素材
const downloadMaterialItem = async (data: PodUsOrderListData) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await downloadMaterialApi([data.id])
if (res.code !== 200) return
window.open(filePath + res.message)
} catch (e) {
// showError(e)
console.error(e)
} finally {
loading.close()
}
}
// 排单完成
const arrangeFinish = async () => {
......@@ -4484,4 +4613,11 @@ useRouter().beforeEach((to, from, next) => {
flex-wrap: wrap;
}
}
.el-dropdown-link {
cursor: pointer;
color: var(--el-color-success);
display: flex;
align-items: center;
outline: none;
}
</style>
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