Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiangyang-PDA
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xujian
xiangyang-PDA
Commits
799be948
Commit
799be948
authored
Apr 02, 2026
by
wangwenjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口对接
parent
091ea1b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
19 deletions
+45
-19
index.vue
src/views/ManualOperation/ScanResults/index.vue
+45
-19
No files found.
src/views/ManualOperation/ScanResults/index.vue
View file @
799be948
...
...
@@ -71,7 +71,7 @@
:key=
"item.BrandId || index"
:class=
"{
'selected-item': fieldValue && item.boxBarProductLineDeviceCode === fieldValue,
'scanned-item': isScannedItem(item
, index
)
'scanned-item': isScannedItem(item)
}"
>
<p
class=
"item-index"
>
{{ (currentPage - 1) * pageSize + index + 1 }}
</p>
...
...
@@ -132,16 +132,17 @@ export default {
[
Field
.
name
]:
Field
,
},
mounted
()
{
// 实际使用时,打开下方注释,关闭硬编码的测试调用
// 扫码回调函数
this
.
$nativeQRCode
.
setCallBackFun
((
res
)
=>
{
let
qrCode
=
getStringByTwo
(
res
)
this
.
queryQrCodeMap
(
qrCode
);
if
(
!
this
.
scanned
){
this
.
queryQrCodeMap
(
qrCode
);
}
else
{
this
.
handleScannedQrCode
(
qrCode
);
}
});
ScanOverlay
.
show
(
'请扫描二维码'
)
// 测试调用:传入固定二维码,实际使用时删除这行
// this.queryQrCodeMap("HTTPS://T2DC.CN/99.1000.1/AC3093876203700016901028075206220260
3240016460168A00296K16LRN1YQUVLOWZHHZMOVJ2C
");
// this.queryQrCodeMap("HTTPS://T2DC.CN/99.1000.1/AC3093876203700016901028075206220260
4020016460168A00296L4DUJDGOLTNA38RAN5XBRJ7T
");
},
data
()
{
...
...
@@ -152,6 +153,7 @@ export default {
pickerValue
:
""
,
showPicker
:
false
,
scanned
:
false
,
scannedCodes
:
[],
// 新增:存储已扫描的条码
// 仅保留基础结构,无静态数据
data
:
{
qrCode
:
""
,
...
...
@@ -191,11 +193,6 @@ export default {
const
start
=
(
this
.
currentPage
-
1
)
*
this
.
pageSize
;
const
end
=
start
+
this
.
pageSize
;
return
list
.
slice
(
start
,
end
);
},
// 选中机台号对应的所有条码项(匹配 boxBarProductLineDeviceCode 字段)
targetItems
()
{
if
(
!
this
.
fieldValue
)
return
[];
return
(
this
.
data
.
childrenList
||
[]).
filter
(
item
=>
item
.
boxBarProductLineDeviceCode
===
this
.
fieldValue
);
}
},
methods
:
{
...
...
@@ -227,6 +224,7 @@ export default {
}
else
{
Notify
({
type
:
'danger'
,
message
:
response
.
msg
||
'查询件码失败'
});
}
}).
catch
(
error
=>
{
console
.
error
(
"查询接口异常:"
,
error
);
Notify
({
type
:
'danger'
,
message
:
'网络异常或服务错误'
});
...
...
@@ -253,6 +251,7 @@ export default {
Reset
()
{
this
.
fieldValue
=
""
;
this
.
scanned
=
false
;
this
.
scannedCodes
=
[];
// 清空已扫描的条码
this
.
currentPage
=
1
;
// 重置回到第一页
},
// 格式化条码:截取后10位,前面拼接...
...
...
@@ -268,19 +267,46 @@ export default {
return
;
}
this
.
scanned
=
true
;
Notify
({
type
:
'success'
,
message
:
'扫码确认成功'
});
// 显示扫码提示
ScanOverlay
.
show
(
'请扫描条码'
);
Notify
({
type
:
'success'
,
message
:
'请扫描条码'
});
},
// 处理扫描到的条码
handleScannedQrCode
(
scannedQrCode
)
{
if
(
!
this
.
scanned
)
{
Notify
({
type
:
'warning'
,
message
:
'请先点击扫码确认按钮'
});
return
;
}
console
.
log
(
"扫描到的条码:"
,
scannedQrCode
);
// 检查条码是否属于当前选择的机台号
const
scannedItem
=
this
.
data
.
childrenList
.
find
(
item
=>
item
.
qrCode
===
scannedQrCode
&&
item
.
boxBarProductLineDeviceCode
===
this
.
fieldValue
);
if
(
!
scannedItem
)
{
Notify
({
type
:
'warning'
,
message
:
'条码不属于当前机台号'
});
return
;
}
// 检查是否已扫描过
if
(
!
this
.
scannedCodes
.
includes
(
scannedQrCode
))
{
this
.
scannedCodes
.
push
(
scannedQrCode
);
Notify
({
type
:
'success'
,
message
:
'扫描成功'
});
}
else
{
Notify
({
type
:
'warning'
,
message
:
'条码已扫描'
});
}
},
// 判断是否高亮:扫码后选中机台号的前8个项(匹配 boxBarProductLineDeviceCode 字段)
isScannedItem
(
item
,
index
)
{
if
(
!
this
.
scanned
||
item
.
boxBarProductLineDeviceCode
!==
this
.
fieldValue
)
return
false
;
const
targetIndex
=
this
.
targetItems
.
findIndex
(
i
=>
i
.
BrandId
===
item
.
BrandId
);
return
targetIndex
>=
0
&&
targetIndex
<
8
;
// 判断是否高亮:条码是否在已扫描列表中
isScannedItem
(
item
)
{
return
this
.
scannedCodes
.
includes
(
item
.
qrCode
);
}
},
};
</
script
>
<
style
scoped
>
/* CSS样式保持不变 */
:deep
(
.van-nav-bar__right
)
{
font-size
:
0.45rem
;
color
:
#ffffff
;
...
...
@@ -467,4 +493,4 @@ export default {
.query-btns
{
bottom
:
1.2rem
;
}
</
style
>
</
style
>
\ No newline at end of file
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