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
6dc9c269
Commit
6dc9c269
authored
Dec 08, 2025
by
qinjianhui
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
fix: C-lodop 问题修改 See merge request
!122
parents
60fe5a89
7345d09d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
37 deletions
+59
-37
src/utils/hooks/useLodop.ts
+59
-37
No files found.
src/utils/hooks/useLodop.ts
View file @
6dc9c269
import
{
onMounted
}
from
'vue'
export
interface
LODOPObject
extends
HTMLObjectElement
{
VERSION
:
string
;
CVERSION
:
string
;
SET_LICENSES
:
(
companyName
:
string
,
licenseA
:
string
,
licenseB
:
string
,
licenseC
:
string
)
=>
void
;
GET_PRINTER_COUNT
:
()
=>
number
;
GET_PRINTER_NAME
:
(
index
:
number
)
=>
string
;
PRINT_INIT
:
(
printName
:
string
)
=>
void
;
SET_PRINTER_INDEX
:
(
printerName
:
string
)
=>
void
|
string
|
number
|
boolean
;
SET_PRINT_MODE
:
(
mode
:
string
,
value
:
boolean
)
=>
void
;
On_Return
:
(
id
:
string
,
value
:
string
)
=>
void
;
On_Return_Remain
:
boolean
;
SEND_PRINT_RAWDATA
:
(
data
:
string
)
=>
void
;
ADD_PRINT_PDF
:
(
x
:
number
,
y
:
number
,
width
:
string
,
height
:
string
,
url
:
string
)
=>
void
;
ADD_PRINT_IMAGE
:
(
x
:
number
,
y
:
number
,
width
:
string
,
height
:
string
,
url
:
string
)
=>
void
;
GET_VALUE
:
(
valueType
:
string
,
valueIndex
:
string
|
unknown
)
=>
string
;
PRINT
:
()
=>
string
;
PRINTA
:
()
=>
string
;
VERSION
:
string
CVERSION
:
string
SET_LICENSES
:
(
companyName
:
string
,
licenseA
:
string
,
licenseB
:
string
,
licenseC
:
string
,
)
=>
void
GET_PRINTER_COUNT
:
()
=>
number
GET_PRINTER_NAME
:
(
index
:
number
)
=>
string
PRINT_INIT
:
(
printName
:
string
)
=>
void
SET_PRINTER_INDEX
:
(
printerName
:
string
)
=>
void
|
string
|
number
|
boolean
SET_PRINT_MODE
:
(
mode
:
string
,
value
:
boolean
)
=>
void
On_Return
:
(
id
:
string
,
value
:
string
)
=>
void
On_Return_Remain
:
boolean
SEND_PRINT_RAWDATA
:
(
data
:
string
)
=>
void
ADD_PRINT_PDF
:
(
x
:
number
,
y
:
number
,
width
:
string
,
height
:
string
,
url
:
string
,
)
=>
void
ADD_PRINT_IMAGE
:
(
x
:
number
,
y
:
number
,
width
:
string
,
height
:
string
,
url
:
string
,
)
=>
void
GET_VALUE
:
(
valueType
:
string
,
valueIndex
:
string
|
unknown
)
=>
string
PRINT
:
()
=>
string
PRINTA
:
()
=>
string
}
export
interface
CLodopObject
{
CVERSION
:
string
;
GET_STATUS
:
()
=>
number
;
GET_VALUE
:
(
valueType
:
string
,
valueIndex
:
string
|
unknown
)
=>
string
;
CVERSION
:
string
GET_STATUS
:
()
=>
number
GET_VALUE
:
(
valueType
:
string
,
valueIndex
:
string
|
unknown
)
=>
string
}
declare
global
{
interface
Window
{
LODOP
:
new
()
=>
LODOPObject
;
_lodop
:
LODOPObject
|
null
;
_lodopCallback
:
{
[
key
:
string
]:
Function
};
CLODOP
:
CLodopObject
;
getCLodop
:
()
=>
LODOPObject
;
LODOP
:
new
()
=>
LODOPObject
_lodop
:
LODOPObject
|
null
_lodopCallback
:
{
[
key
:
string
]:
Function
}
CLODOP
:
CLodopObject
getCLodop
:
()
=>
LODOPObject
}
}
...
...
@@ -92,13 +109,13 @@ export default function useLodop() {
const
JS1
=
document
.
createElement
(
'script'
)
const
JS2
=
document
.
createElement
(
'script'
)
if
(
window
.
location
.
protocol
==
'https:'
)
{
JS1
.
src
=
'https://localhost.lodop.net:8443/CLodopfuncs.js'
JS2
.
src
=
'https://localhost.lodop.net:8444/CLodopfuncs.js'
}
else
{
JS1
.
src
=
'http://localhost:8000/CLodopfuncs.js'
JS2
.
src
=
'http://localhost:18000/CLodopfuncs.js'
}
//
if (window.location.protocol == 'https:') {
//
JS1.src = 'https://localhost.lodop.net:8443/CLodopfuncs.js'
//
JS2.src = 'https://localhost.lodop.net:8444/CLodopfuncs.js'
//
} else {
JS1
.
src
=
'http://localhost:8000/CLodopfuncs.js'
JS2
.
src
=
'http://localhost:18000/CLodopfuncs.js'
//
}
JS1
.
onload
=
JS2
.
onload
=
function
()
{
CLodopJsState
=
'complete'
}
...
...
@@ -109,7 +126,10 @@ export default function useLodop() {
head
.
insertBefore
(
JS2
,
head
.
firstChild
)
CLodopIsLocal
=
!!
(
JS1
.
src
+
JS2
.
src
).
match
(
/
\/\/
localho|
\/\/
127.0.0./i
)
}
const
getCLodop
=
(
oOBJECT
:
LODOPObject
|
null
,
oEMBED
:
LODOPObject
|
null
):
LODOPObject
|
null
=>
{
const
getCLodop
=
(
oOBJECT
:
LODOPObject
|
null
,
oEMBED
:
LODOPObject
|
null
,
):
LODOPObject
|
null
=>
{
const
strFontTag
=
'<font _#_>打印控件'
const
strLodopInstall
=
strFontTag
+
...
...
@@ -157,9 +177,11 @@ export default function useLodop() {
/Trident/i
.
test
(
navigator
.
userAgent
)
const
isWinIE64
=
isWinIE
&&
/x64/i
.
test
(
navigator
.
userAgent
)
const
isLinuxX86
=
/Linux/i
.
test
(
navigator
.
userAgent
)
&&
/x86_64/i
.
test
(
navigator
.
userAgent
)
/Linux/i
.
test
(
navigator
.
userAgent
)
&&
/x86_64/i
.
test
(
navigator
.
userAgent
)
const
isLinuxARM
=
/Linux/i
.
test
(
navigator
.
userAgent
)
&&
/aarch64/i
.
test
(
navigator
.
userAgent
)
/Linux/i
.
test
(
navigator
.
userAgent
)
&&
/aarch64/i
.
test
(
navigator
.
userAgent
)
if
(
needCLodop
||
isLinuxX86
||
isLinuxARM
)
{
try
{
...
...
@@ -168,9 +190,9 @@ export default function useLodop() {
console
.
error
(
err
)
}
if
(
!
LODOP
&&
CLodopJsState
!==
'complete'
)
{
if
(
CLodopJsState
==
'loading'
){
if
(
CLodopJsState
==
'loading'
)
{
console
.
log
(
'网页还没下载完毕,请稍等一下再操作.'
)
}
else
{
}
else
{
console
.
log
(
'未曾加载Lodop主JS文件,请先调用loadCLodop过程.'
)
}
return
null
...
...
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