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
c5f0903e
Commit
c5f0903e
authored
Aug 11, 2025
by
wusiyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 打印物流面单优化
parent
bad6a312
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
16 deletions
+80
-16
src/api/common.ts
+2
-2
src/assets/images/printer.png
+0
-0
src/components/NavMenu.vue
+78
-14
No files found.
src/api/common.ts
View file @
c5f0903e
...
...
@@ -34,14 +34,14 @@ export function uploadFileApi(data: FormData) {
)
}
//
获取
物流面单 US
//
打印
物流面单 US
export
function
getLogisticUSApi
(
content
:
string
)
{
return
axios
.
get
<
never
,
BaseRespData
<
{
documentUrl
:
string
}
>>
(
`factory/podJomallOrderUs/getDocument?content=
${
content
}
`
,
)
}
//
获取
物流面单 CN
//
打印
物流面单 CN
export
function
getLogisticCNApi
(
content
:
string
)
{
return
axios
.
get
<
never
,
BaseRespData
<
{
documentUrl
:
string
}
>>
(
`factory/podJomallOrder/getDocument?content=
${
content
}
`
,
...
...
src/assets/images/printer.png
0 → 100644
View file @
c5f0903e
20 KB
src/components/NavMenu.vue
View file @
c5f0903e
...
...
@@ -117,11 +117,11 @@
<img
src=
"../assets/images/brush-no.png"
width=
"24"
height=
"24"
/>
</div>
<div
title=
"
获取
物流面单"
title=
"
打印
物流面单"
class=
"tool-item"
@
click=
"getLogisticDrawer = true"
>
<img
src=
"../assets/images/p
ackage
.png"
width=
"24"
height=
"24"
/>
<img
src=
"../assets/images/p
rinter
.png"
width=
"24"
height=
"24"
/>
</div>
</div>
</div>
...
...
@@ -206,17 +206,31 @@
</el-drawer>
<el-drawer
v-model=
"getLogisticDrawer"
direction=
"btt"
class=
"get-logistic-drawer"
title=
"
获取
物流面单"
title=
"
打印
物流面单"
@
close=
"content = ''"
>
<el-input
v-model=
"content"
placeholder=
"请输入单号"
clearable
/>
<
template
#
footer
>
<span
style=
"display: flex; justify-content: center"
>
<el-button
@
click=
"getLogisticDrawer = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"getLogistic"
>
查 询
</el-button>
</span>
</
template
>
<ElSelect
v-model=
"sheetPrinter"
placeholder=
"请选择打印机"
@
change=
"handlePrinterChange"
style=
"width: 200px; margin-right: 10px"
>
<ElOption
v-for=
"item in printDeviceList"
:key=
"item"
:label=
"item"
:value=
"item"
/>
</ElSelect>
<el-input
v-model=
"content"
placeholder=
"请输入单号"
style=
"width: 300px; margin-right: 10px"
clearable
/>
<el-button
type=
"primary"
@
click=
"getLogistic"
>
查 询
</el-button>
</el-drawer>
</span>
</template>
...
...
@@ -240,8 +254,11 @@ import {
import
{
useRoute
,
useRouter
}
from
'vue-router'
import
Menu
from
'@/router/menu'
import
userUserStore
from
'@/store/user'
import
type
{
FormRules
}
from
'element-plus'
import
{
useValue
}
from
'@/utils/hooks/useValue'
import
useLodop
from
'@/utils/hooks/useLodop'
import
{
changePasswordApi
}
from
'@/api/auth'
import
{
getLogisticUSApi
,
getLogisticCNApi
}
from
'@/api/common'
import
{
filePath
,
FileCnPath
}
from
'@/api/axios'
...
...
@@ -272,6 +289,9 @@ const userInfo = userStore.user
const
dialogVisible
=
ref
(
false
)
const
formatDrawer
=
ref
(
false
)
const
getLogisticDrawer
=
ref
(
false
)
const
printDeviceList
=
ref
<
string
[]
>
([])
const
sheetPrinter
=
ref
(
''
)
const
textareaT
=
ref
(
''
)
const
newTextareaT
=
ref
(
''
)
const
content
=
ref
(
''
)
...
...
@@ -504,7 +524,31 @@ const copy = () => {
})
}
// 获取物流面单
const
{
getCLodop
}
=
useLodop
()
const
initPrintDevice
=
()
=>
{
const
lodop
=
getCLodop
(
null
,
null
)
if
(
!
lodop
)
return
const
arr
=
[]
// 获取打印机数量
const
length
=
lodop
.
GET_PRINTER_COUNT
()
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
// 根据设备序号获取设备名
const
name
=
lodop
.
GET_PRINTER_NAME
(
i
)
arr
.
push
(
name
)
}
// 获取默认打印机
sheetPrinter
.
value
=
lodop
.
GET_PRINTER_NAME
(
0
)
printDeviceList
.
value
=
arr
}
// 处理打印机选择变化,保存到 localStorage
const
handlePrinterChange
=
(
value
:
string
)
=>
{
sheetPrinter
.
value
=
value
localStorage
.
setItem
(
'sheetPrinter'
,
JSON
.
stringify
(
value
))
}
// 打印物流面单
const
getLogistic
=
()
=>
{
if
(
!
content
.
value
)
{
ElMessage
.
warning
(
'请输入单号'
)
...
...
@@ -547,6 +591,24 @@ watch(
{
immediate
:
true
},
)
watch
(
getLogisticDrawer
,
async
(
value
:
boolean
)
=>
{
if
(
value
)
{
initPrintDevice
()
const
locaclPrinter
=
localStorage
.
getItem
(
'sheetPrinter'
)
if
(
locaclPrinter
)
{
const
savedPrinter
=
JSON
.
parse
(
locaclPrinter
)
// 检查保存的打印机是否在当前打印机列表中
if
(
printDeviceList
.
value
.
includes
(
savedPrinter
))
{
sheetPrinter
.
value
=
savedPrinter
}
else
{
// 如果保存的打印机不在当前列表中,清空 localStorage 并设置为空
localStorage
.
removeItem
(
'sheetPrinter'
)
sheetPrinter
.
value
=
''
}
}
}
})
// 点击标签时切换路由
watch
(
activeTab
,
(
newTab
)
=>
{
if
(
newTab
)
{
...
...
@@ -700,9 +762,11 @@ onUnmounted(() => {
top
:
calc
(
50%
-
325px
)
!important
;
}
::v-deep
(
.get-logistic-drawer.el-drawer.rtl
)
{
height
:
200px
!important
;
top
:
calc
(
50%
-
100px
)
!important
;
::v-deep
(
.get-logistic-drawer.el-drawer.btt
)
{
height
:
120px
!important
;
width
:
700px
!important
;
top
:
calc
(
50%
-
60px
)
!important
;
left
:
calc
(
50%
-
350px
)
!important
;
}
.tool-item
{
...
...
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