Commit 8a21c7ac by qinjianhui

feat: 待发货商品下载素材功能

parent 8f47a2e1
......@@ -91,8 +91,8 @@ export function getFactoryOrderNewLogApi(id: number | string) {
}
export function refreshProductInfoApi(data: {
orderIds?: (number | string)[]
productIds?: (number | string)[]
orderIds?: (number | string)
productIds?: (number | string)
}) {
return axios.post<never, BaseRespData<void>>(
'factory/podOrderProduct/refreshProductInfo',
......
......@@ -1365,7 +1365,15 @@ const productColumns = computed(() => {
</span>
<span class="item">
<el-button type="primary" link size="small">
<el-button
type="primary"
link
size="small"
onClick={(e: Event) => {
e.stopPropagation()
handleDownloadMaterialByProduct(row)
}}
>
下载素材
</el-button>
</span>
......@@ -1457,8 +1465,8 @@ const handleRefreshProductInfo = async () => {
}
try {
const res = await refreshProductInfoApi({
orderIds: !isCardLayout.value ? getSelectedIds() : undefined,
productIds: isCardLayout.value ? getSelectedIds() : undefined,
orderIds: !isCardLayout.value ? getSelectedIds().join(',') : undefined,
productIds: isCardLayout.value ? getSelectedIds().join(',') : undefined,
})
if (res.code !== 200) return
ElMessage.success('刷新商品信息成功')
......@@ -1624,13 +1632,24 @@ const handleDownloadMaterial = async () => {
const res = usePodOrderDownload
? await downloadMaterialApi(ids as number[])
: await downloadOperationMaterialApi(ids as number[])
if (res.message) {
const a = document.createElement('a')
a.href = filePath + res.message
a.download = ''
a.click()
if (res.code !== 200) return
window.open(filePath + res.message, '_blank')
} catch (e) {
console.error(e)
} finally {
loading.close()
}
ElMessage.success('下载素材成功')
}
const handleDownloadMaterialByProduct = async (row: ProductListData) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try {
const res = await downloadOperationMaterialApi([row.id])
if (res.code !== 200) return
window.open(filePath + res.message, '_blank')
} catch (e) {
console.error(e)
} finally {
......@@ -1715,7 +1734,10 @@ const handleApplyReplenish = async () => {
refreshTree: true,
})
}
const adjustPickOrderSuccess = async (_: unknown, selectionOperationIds: number[]) => {
const adjustPickOrderSuccess = async (
_: unknown,
selectionOperationIds: number[],
) => {
try {
const res = await applyReplenishApi(selectionOperationIds)
if (res.code !== 200) return
......
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