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
56b33a1b
Commit
56b33a1b
authored
May 05, 2024
by
qinjianhui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 清空拣货数量、滚动至当前扫码的sku
parent
8c147350
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
21 deletions
+60
-21
src/views/order/Shipment.vue
+40
-5
src/views/order/hook/useShipment.ts
+18
-16
src/views/order/index.vue
+2
-0
No files found.
src/views/order/Shipment.vue
View file @
56b33a1b
<
template
>
<
template
>
<div
v-if=
"orderList.length"
class=
"shipment-order"
>
<div
v-if=
"orderList.length"
class=
"shipment-order"
>
<div
ref=
"
shipmentOrder
Ref"
class=
"shipment-info"
>
<div
ref=
"
list
Ref"
class=
"shipment-info"
>
<div
v-for=
"o in orderList"
:key=
"o.id"
class=
"shipment-info-item"
>
<div
v-for=
"o in orderList"
:key=
"o.id"
class=
"shipment-info-item"
>
<div
class=
"shipment-info-item-header"
>
<div
class=
"shipment-info-item-header"
>
<div
class=
"shipment-info-item-header--title"
>
<div
class=
"shipment-info-item-header--title"
>
...
@@ -70,10 +70,20 @@
...
@@ -70,10 +70,20 @@
</div>
</div>
<div
<div
class=
"shipment-info-item-content-item--info"
class=
"shipment-info-item-content-item--info"
style=
"width:
9
0px; flex: none"
style=
"width:
10
0px; flex: none"
>
>
<span
class=
"label"
>
拣货数:
</span>
<span
class=
"label"
>
拣货数:
</span>
<span
class=
"value"
>
{{
item
.
count
}}
</span>
<span
class=
"value"
>
{{
item
.
count
}}
</span>
<span
v-if=
"item.subOrderNumber === currentRow.subOrderNumber"
title=
"清空拣货数量"
style=
"margin: 6px; cursor: pointer; display: flex"
@
click
.
stop=
"onShipment(item)"
>
<el-icon
style=
"vertical-align: middle"
><CircleCloseFilled
/></el-icon>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -112,8 +122,9 @@
...
@@ -112,8 +122,9 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
OrderData
,
ProductList
}
from
'@/types/api/order'
import
{
OrderData
,
ProductList
}
from
'@/types/api/order'
import
{
PropType
}
from
'vue'
import
{
PropType
,
ref
}
from
'vue'
import
useShipment
from
'./hook/useShipment'
import
{
CircleCloseFilled
}
from
'@element-plus/icons-vue'
import
{
showConfirm
}
from
'@/utils/ui'
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
(
e
:
'changeCurrentRow'
,
v
:
ProductList
):
void
(
e
:
'changeCurrentRow'
,
v
:
ProductList
):
void
}
>
()
}
>
()
...
@@ -127,10 +138,34 @@ defineProps({
...
@@ -127,10 +138,34 @@ defineProps({
default
:
()
=>
{},
default
:
()
=>
{},
},
},
})
})
const
{
shipmentOrderRef
}
=
useShipment
()
const
listRef
=
ref
<
HTMLDivElement
>
()
export
interface
ShipmentType
{
listRef
:
HTMLDivElement
|
undefined
}
defineExpose
<
ShipmentType
>
({
get
listRef
()
{
return
listRef
.
value
},
})
const
onRowClick
=
(
item
:
ProductList
)
=>
{
const
onRowClick
=
(
item
:
ProductList
)
=>
{
emit
(
'changeCurrentRow'
,
item
)
emit
(
'changeCurrentRow'
,
item
)
}
}
const
onShipment
=
async
(
item
:
ProductList
)
=>
{
try
{
await
showConfirm
(
'是否确认清空拣货数量'
,
{
confirmButtonText
:
'确认'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
})
}
catch
{
return
}
item
.
count
=
0
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.shipment-order
{
.shipment-order
{
...
...
src/views/order/hook/useShipment.ts
View file @
56b33a1b
...
@@ -7,16 +7,17 @@ import {
...
@@ -7,16 +7,17 @@ import {
}
from
'@/types/api/order'
}
from
'@/types/api/order'
import
{
useValue
}
from
'@/utils/hooks/useValue'
import
{
useValue
}
from
'@/utils/hooks/useValue'
import
{
showError
}
from
'@/utils/ui'
import
{
showError
}
from
'@/utils/ui'
import
{
ref
}
from
'vue'
import
{
nextTick
,
ref
}
from
'vue'
const
[
orderList
,
resetOrderList
]
=
useValue
<
OrderData
[]
>
([])
import
{
ShipmentType
}
from
'../Shipment.vue'
const
[
shipmentForm
,
resetShipmentForm
]
=
useValue
<
ShipmentForm
>
({
export
default
function
useShipment
(
callback
?:
()
=>
void
)
{
const
[
orderList
,
resetOrderList
]
=
useValue
<
OrderData
[]
>
([])
const
[
shipmentForm
,
resetShipmentForm
]
=
useValue
<
ShipmentForm
>
({
shippingWay
:
''
,
shippingWay
:
''
,
carriageName
:
''
,
carriageName
:
''
,
logisticsTracking
:
''
,
logisticsTracking
:
''
,
carriageAmount
:
''
,
carriageAmount
:
''
,
namespace
:
''
,
namespace
:
''
,
})
})
export
default
function
useShipment
(
callback
?:
()
=>
void
)
{
const
shipmentFormRef
=
ref
()
const
shipmentFormRef
=
ref
()
const
productionOrderNumber
=
ref
(
''
)
const
productionOrderNumber
=
ref
(
''
)
const
shipmentVisible
=
ref
(
false
)
const
shipmentVisible
=
ref
(
false
)
...
@@ -24,7 +25,7 @@ export default function useShipment(callback?: () => void) {
...
@@ -24,7 +25,7 @@ export default function useShipment(callback?: () => void) {
const
inputRef
=
ref
()
const
inputRef
=
ref
()
const
currentRow
=
ref
<
ProductList
>
()
const
currentRow
=
ref
<
ProductList
>
()
const
shipmentLoading
=
ref
(
false
)
const
shipmentLoading
=
ref
(
false
)
const
shipmentOrderRef
=
ref
()
const
shipmentOrderRef
=
ref
<
ShipmentType
>
()
const
searchShipmentByOrderNumber
=
async
()
=>
{
const
searchShipmentByOrderNumber
=
async
()
=>
{
const
code
=
productionOrderNumber
.
value
const
code
=
productionOrderNumber
.
value
shipmentVisible
.
value
=
true
shipmentVisible
.
value
=
true
...
@@ -67,9 +68,9 @@ export default function useShipment(callback?: () => void) {
...
@@ -67,9 +68,9 @@ export default function useShipment(callback?: () => void) {
inputRef
.
value
.
focus
()
inputRef
.
value
.
focus
()
productionOrderNumber
.
value
=
''
productionOrderNumber
.
value
=
''
isLock
.
value
=
false
isLock
.
value
=
false
await
nextTick
()
if
(
shipmentOrderRef
.
value
)
{
if
(
shipmentOrderRef
.
value
)
{
const
rowEl
=
shipmentOrderRef
.
value
.
querySelector
(
const
rowEl
=
shipmentOrderRef
.
value
.
listRef
?.
querySelector
(
`div[data-id="
${
rowData
.
id
}
"]`
,
`div[data-id="
${
rowData
.
id
}
"]`
,
)
)
if
(
!
rowEl
)
return
if
(
!
rowEl
)
return
...
@@ -103,14 +104,6 @@ export default function useShipment(callback?: () => void) {
...
@@ -103,14 +104,6 @@ export default function useShipment(callback?: () => void) {
).
catch
(()
=>
{})
).
catch
(()
=>
{})
}
}
currentRow
.
value
=
item
currentRow
.
value
=
item
if
(
shipmentOrderRef
.
value
)
{
const
rowEl
=
shipmentOrderRef
.
value
.
querySelector
(
`div[data-id="
${
item
.
id
}
"]`
,
)
if
(
!
rowEl
)
return
rowEl
.
scrollIntoView
()
}
}
}
}
}
const
index
=
orderList
.
value
.
findIndex
(
const
index
=
orderList
.
value
.
findIndex
(
...
@@ -119,6 +112,15 @@ export default function useShipment(callback?: () => void) {
...
@@ -119,6 +112,15 @@ export default function useShipment(callback?: () => void) {
if
(
index
===
-
1
)
{
if
(
index
===
-
1
)
{
orderList
.
value
.
unshift
(
res
.
data
)
orderList
.
value
.
unshift
(
res
.
data
)
}
}
await
nextTick
()
if
(
shipmentOrderRef
.
value
)
{
const
rowEl
=
shipmentOrderRef
.
value
.
listRef
?.
querySelector
(
`div[data-id="
${
currentRow
.
value
?.
id
}
"]`,
)
if (!rowEl) return
rowEl.scrollIntoView()
}
}
}
inputRef.value.focus()
inputRef.value.focus()
productionOrderNumber.value = ''
productionOrderNumber.value = ''
...
...
src/views/order/index.vue
View file @
56b33a1b
...
@@ -397,6 +397,7 @@
...
@@ -397,6 +397,7 @@
<
/el-button
>
<
/el-button
>
<
/div
>
<
/div
>
<
Shipment
<
Shipment
ref
=
"shipmentOrderRef"
v
-
loading
=
"shipmentLoading"
v
-
loading
=
"shipmentLoading"
:
order
-
list
=
"orderList"
:
order
-
list
=
"orderList"
:
current
-
row
=
"currentRow"
:
current
-
row
=
"currentRow"
...
@@ -644,6 +645,7 @@ const {
...
@@ -644,6 +645,7 @@ const {
currentRow
,
currentRow
,
shipmentLoading
,
shipmentLoading
,
orderList
,
orderList
,
shipmentOrderRef
,
searchShipmentByOrderNumber
,
searchShipmentByOrderNumber
,
saveShipment
,
saveShipment
,
confirmDelivery
,
confirmDelivery
,
...
...
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