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
4572b126
Commit
4572b126
authored
May 09, 2026
by
qinjianhui
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!190
parents
e32548b9
81fe3f6a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
26 deletions
+96
-26
src/views/order/factoryOrderNew/index.vue
+96
-26
No files found.
src/views/order/factoryOrderNew/index.vue
View file @
4572b126
...
@@ -1992,14 +1992,35 @@ const printOrder = async (
...
@@ -1992,14 +1992,35 @@ const printOrder = async (
return
return
}
}
if
(
data
.
filePath
)
{
if
(
data
.
filePath
)
{
const
strURL
=
/^https
?
:/i
.
test
(
data
.
filePath
)
const
strURL
=
filePath
+
data
.
filePath
?
data
.
filePath
const
isHttpsPdf
=
/
(
https
)
:
\/\/([^/]
+
)
/i
.
test
(
strURL
)
:
filePath
+
data
.
filePath
console
.
log
(
'[printOrder] label source'
,
{
const
pdfData
=
/^https
?
:/i
.
test
(
strURL
)
id
:
data
.
id
,
?
await
downloadPDF
(
strURL
)
hasFilePath
:
!!
data
.
filePath
,
:
strURL
hasFileData
:
!!
data
.
fileData
,
lodop
.
ADD_PRINT_PDF
(
0
,
0
,
'100%'
,
'100%'
,
pdfData
)
isHttpsPdf
,
strURL
,
}
)
const
pdfPayload
=
isHttpsPdf
?
downloadPDF
(
strURL
)
:
strURL
console
.
log
(
'[printOrder] pdf payload meta'
,
{
mode
:
isHttpsPdf
?
'base64'
:
'url'
,
length
:
pdfPayload
?.
length
||
0
,
preview
:
pdfPayload
?.
slice
(
0
,
30
),
}
)
lodop
.
ADD_PRINT_PDF
(
0
,
0
,
'100%'
,
'100%'
,
pdfPayload
,
)
}
else
{
}
else
{
console
.
log
(
'[printOrder] raw payload meta'
,
{
id
:
data
.
id
,
hasFilePath
:
!!
data
.
filePath
,
fileDataLength
:
data
.
fileData
?.
length
||
0
,
fileDataPreview
:
data
.
fileData
?.
slice
(
0
,
30
),
}
)
lodop
.
SEND_PRINT_RAWDATA
(
data
.
fileData
||
''
)
lodop
.
SEND_PRINT_RAWDATA
(
data
.
fileData
||
''
)
}
}
console
.
log
(
'lodop.CVERSION'
,
lodop
.
CVERSION
)
console
.
log
(
'lodop.CVERSION'
,
lodop
.
CVERSION
)
...
@@ -2079,28 +2100,77 @@ const lodopCall = (fn: (lodop: LODOPObject) => string) => {
...
@@ -2079,28 +2100,77 @@ const lodopCall = (fn: (lodop: LODOPObject) => string) => {
_lodopCallback
[
id
]
=
resolve
_lodopCallback
[
id
]
=
resolve
}
)
}
)
}
}
const
downloadPDF
=
async
(
url
:
string
):
Promise
<
string
>
=>
{
const
downloadPDF
=
(
url
:
string
)
=>
{
if
(
!
/^https
?
:/i
.
test
(
url
))
return
url
if
(
!
/^https
?
:/i
.
test
(
url
))
return
url
let
xhr
,
const
headers
:
Record
<
string
,
string
>
=
{
}
arrybuffer
=
false
,
const
token
=
localStorage
.
getItem
(
'token'
)
dataArray
=
null
if
(
token
)
headers
[
'jwt-token'
]
=
token
if
(
window
.
XMLHttpRequest
)
{
xhr
=
new
XMLHttpRequest
()
const
response
=
await
fetch
(
url
,
{
headers
}
)
}
else
{
if
(
!
response
.
ok
)
{
xhr
=
new
window
.
ActiveXObject
(
'MSXML2.XMLHTTP'
)
console
.
error
(
}
`PDF download failed: ${response.status
}
${response.statusText
}
`
,
xhr
.
open
(
'GET'
,
url
,
false
)
//同步方式
)
if
(
xhr
.
overrideMimeType
)
return
''
try
{
xhr
.
responseType
=
'arraybuffer'
arrybuffer
=
true
}
catch
(
err
)
{
xhr
.
overrideMimeType
(
'text/plain; charset=x-user-defined'
)
}
xhr
.
send
(
null
)
console
.
log
(
'[downloadPDF] response meta'
,
{
url
,
status
:
xhr
.
status
,
readyState
:
xhr
.
readyState
,
contentType
:
xhr
.
getResponseHeader
?.(
'content-type'
),
responseType
:
xhr
.
responseType
,
}
)
const
data
=
xhr
.
response
||
xhr
.
responseBody
const
dataByteLength
=
arrybuffer
?
(
data
as
ArrayBuffer
|
null
)?.
byteLength
||
0
:
(
data
as
string
|
null
)?.
length
||
0
console
.
log
(
'[downloadPDF] data length'
,
{
url
,
arrybuffer
,
dataByteLength
,
}
)
if
(
typeof
Uint8Array
!==
'undefined'
)
{
if
(
arrybuffer
)
{
dataArray
=
new
Uint8Array
(
data
)
}
else
{
dataArray
=
new
Uint8Array
(
data
.
length
)
for
(
let
i
=
0
;
i
<
dataArray
.
length
;
i
++
)
{
dataArray
[
i
]
=
data
.
charCodeAt
(
i
)
}
}
const
arrayBuffer
=
await
response
.
arrayBuffer
()
const
bytes
=
new
Uint8Array
(
arrayBuffer
)
let
binary
=
''
for
(
let
i
=
0
;
i
<
bytes
.
byteLength
;
i
++
)
{
binary
+=
String
.
fromCharCode
(
bytes
[
i
])
}
}
return
'data:application/pdf;base64,'
+
btoa
(
binary
)
}
else
{
dataArray
=
window
.
VBS_BinaryToArray
(
data
).
toArray
()
//兼容IE低版本
}
const
digits
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
let
strData
=
''
for
(
let
i
=
0
,
ii
=
dataArray
.
length
;
i
<
ii
;
i
+=
3
)
{
if
(
isNaN
(
dataArray
[
i
]))
break
const
b1
=
dataArray
[
i
]
&
0xff
,
b2
=
dataArray
[
i
+
1
]
&
0xff
,
b3
=
dataArray
[
i
+
2
]
&
0xff
const
d1
=
b1
>>
2
,
d2
=
((
b1
&
3
)
<<
4
)
|
(
b2
>>
4
)
const
d3
=
i
+
1
<
ii
?
((
b2
&
0xf
)
<<
2
)
|
(
b3
>>
6
)
:
64
const
d4
=
i
+
2
<
ii
?
b3
&
0x3f
:
64
strData
+=
digits
.
substring
(
d1
,
d1
+
1
)
+
digits
.
substring
(
d2
,
d2
+
1
)
+
digits
.
substring
(
d3
,
d3
+
1
)
+
digits
.
substring
(
d4
,
d4
+
1
)
}
console
.
log
(
'[downloadPDF] base64 meta'
,
{
url
,
base64Length
:
strData
.
length
,
base64Preview
:
strData
.
slice
(
0
,
30
),
}
)
return
strData
}
}
const
handleDownloadMaterial
=
async
()
=>
{
const
handleDownloadMaterial
=
async
()
=>
{
if
(
!
ensureSelection
())
return
if
(
!
ensureSelection
())
return
...
...
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