Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
8dd73048
Commit
8dd73048
authored
Aug 27, 2025
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修改排版下载问题
parent
ec5291a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
163 additions
and
37 deletions
+163
-37
src/views/order/podUs/index.vue
+163
-37
No files found.
src/views/order/podUs/index.vue
View file @
8dd73048
...
...
@@ -1560,7 +1560,7 @@
<
/span
>
<
span
class
=
"operate-item"
>
<
ElButton
disabled
:
disabled
=
"!row.tiffUrl"
link
type
=
"primary"
@
click
=
"handleDownload(row, 'tiff')"
...
...
@@ -3654,50 +3654,176 @@ const downloadTifItem = async () => {
background
:
'rgba(0, 0, 0, 0.3)'
,
}
)
const
type
=
(
typesettingForm
.
value
?.
typeArr
?.
join
(
','
)
as
string
)
||
''
const
templateWidth
=
(
typesettingForm
.
value
?.
templateWidth
as
number
)
||
undefined
typesettingVisible
.
value
=
false
try
{
const
res
=
await
composingDesignImages
([
row
.
id
],
type
,
templateWidth
)
const
url
=
type
===
'tiff'
?
`https://ps.jomalls.com/tiff/`
+
res
.
message
:
filePath
+
res
.
message
if
(
type
===
'tiff'
)
{
window
.
open
(
url
,
'_blank'
)
const
{
templateWidth
,
typeArr
}
=
typesettingForm
.
value
const
type
=
typeArr
?.
join
(
','
)
||
''
typesettingVisible
.
value
=
false
// 处理下载逻辑
if
((
typeArr
as
string
[]).
length
>
1
)
{
// 并行处理多个类型
await
Promise
.
allSettled
(
(
typeArr
as
string
[]).
map
((
el
)
=>
downloadSingleType
(
row
.
id
,
el
,
templateWidth
),
),
)
}
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
}
)
// 处理单个类型
await
downloadSingleType
(
row
.
id
,
type
,
templateWidth
)
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
catch
(
e
rror
)
{
console
.
error
(
'下载过程中出错:'
,
error
)
}
finally
{
typesettingRow
.
value
=
undefined
loading
.
close
()
}
}
// 提取下载单个类型的逻辑为独立函数
const
downloadSingleType
=
async
(
id
:
number
,
type
:
string
,
templateWidth
?:
number
,
)
=>
{
try
{
const
res
=
await
composingDesignImages
([
id
],
type
,
templateWidth
)
const
isTiff
=
type
===
'tiff'
const
url
=
isTiff
?
`https://ps.jomalls.com/tiff/${res.message
}
`
:
`${filePath
}
${res.message
}
`
if
(
isTiff
)
{
// 对于tiff类型,直接在新窗口打开
window
.
open
(
url
,
'_blank'
)
}
else
{
// 对于其他类型,使用下载方式
await
downloadFile
(
url
,
res
.
message
as
string
)
}
}
catch
(
error
)
{
console
.
error
(
`下载类型 ${type
}
时出错:`
,
error
)
throw
error
// 重新抛出错误以便外部捕获
}
}
// 提取文件下载逻辑为独立函数
const
downloadFile
=
async
(
url
:
string
,
message
:
string
)
=>
{
try
{
const
response
=
await
fetch
(
url
)
const
blob
=
await
response
.
blob
()
const
filename
=
message
.
split
(
'/'
).
pop
()
||
'download'
// 创建下载链接
const
a
=
document
.
createElement
(
'a'
)
a
.
href
=
URL
.
createObjectURL
(
blob
)
a
.
download
=
filename
a
.
target
=
'_blank'
// 模拟点击下载
document
.
body
.
appendChild
(
a
)
a
.
click
()
// 清理
setTimeout
(()
=>
{
document
.
body
.
removeChild
(
a
)
URL
.
revokeObjectURL
(
a
.
href
)
}
,
100
)
}
catch
(
error
)
{
console
.
error
(
'下载文件时出错:'
,
error
)
throw
error
// 重新抛出错误
}
finally
{
pngDownloadLoading
.
value
=
false
}
}
// const downloadTifItem = async () =>
{
// const row =
{
...(
typesettingRow
.
value
as
PodUsOrderListData
)
}
// const loading = ElLoading.service(
{
// fullscreen: true,
// text: '操作中...',
// background: 'rgba(0, 0, 0, 0.3)',
//
}
)
// const
{
templateWidth
,
typeArr
}
=
typesettingForm
.
value
// const type = (typeArr?.join(',') as string) || ''
// typesettingVisible.value = false
// try
{
// if ((typeArr as string[]).length > 1)
{
// typeArr?.forEach(async (el) =>
{
// const res = await composingDesignImages([row.id], el, templateWidth)
// const url =
// type === 'tiff'
// ? `https://ps.jomalls.com/tiff/` + res.message
// : filePath + res.message
// if (el === '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
//
}
)
//
}
//
}
)
//
}
else
{
// const res = await composingDesignImages([row.id], type, templateWidth)
// 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
{
// typesettingRow.value = undefined
// loading.close()
//
}
//
}
const
loadProductionClient
=
async
()
=>
{
try
{
const
res
=
await
getProductionClientApi
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment