Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-web-h5app-drs
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
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
zhuxiaomei
patzn-cloud-web-h5app-drs
Commits
749744fb
Commit
749744fb
authored
Nov 06, 2020
by
zhuxiaomei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app扫码bug处理
parent
11456cb3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
200 additions
and
45 deletions
+200
-45
SamplingListAdd.vue
src/page/sampling-list/SamplingListAdd.vue
+88
-45
SamplingListAddNet.vue
src/page/sampling-list/SamplingListAddNet.vue
+0
-0
ScanBar.vue
src/page/sampling-list/ScanBar.vue
+110
-0
sampling-list-routes.js
src/router/sampling-list-routes.js
+2
-0
No files found.
src/page/sampling-list/SamplingListAdd.vue
View file @
749744fb
...
...
@@ -1072,17 +1072,46 @@
}
},
mounted
()
{
mui
.
init
({
beforeback
:
function
()
{
localStorage
.
removeItem
(
'summary'
)
localStorage
.
removeItem
(
'sample'
)
return
true
}
})
this
.
_open
()
},
beforeDestroy
(){
localStorage
.
removeItem
(
'summary'
)
localStorage
.
removeItem
(
'sample'
)
},
methods
:
{
_open
()
{
if
(
this
.
$route
.
query
.
id
)
{
//编辑
this
.
id
=
this
.
$route
.
query
.
id
this
.
_getData
()
//localStorage.getItem('summary')有值 是扫码进来的
console
.
log
(
localStorage
.
getItem
(
'summary'
),
'localStorage.getItem(
\'
summary
\'
)'
)
if
(
localStorage
.
getItem
(
'summary'
))
{
this
.
_initData
(
JSON
.
parse
(
localStorage
.
getItem
(
'summary'
)))
if
(
localStorage
.
getItem
(
'sample'
))
{
this
.
_scanResult
(
JSON
.
parse
(
localStorage
.
getItem
(
'sample'
)))
}
}
else
{
this
.
_getData
()
}
}
else
{
//添加
this
.
id
=
''
this
.
formObj
.
testMembers
=
this
.
$global
.
getUserInfo
().
realname
this
.
_getLastTester
()
//localStorage.getItem('summary')有值 是扫码进来的
console
.
log
(
localStorage
.
getItem
(
'summary'
),
'localStorage.getItem(
\'
summary
\'
)'
)
if
(
localStorage
.
getItem
(
'summary'
))
{
this
.
_initData
(
JSON
.
parse
(
localStorage
.
getItem
(
'summary'
)))
if
(
localStorage
.
getItem
(
'sample'
))
{
this
.
_scanResult
(
JSON
.
parse
(
localStorage
.
getItem
(
'sample'
)))
}
}
else
{
this
.
formObj
.
testMembers
=
this
.
$global
.
getUserInfo
().
realname
this
.
_getLastTester
()
}
}
},
_companySelect
(
type
)
{
...
...
@@ -1127,7 +1156,10 @@
this
.
nonNetTested
.
tel
=
res
.
tel
?
res
.
tel
:
''
},
_scan
()
{
this
.
$refs
.
scan
.
_open
()
//将已经填写过的存起来
localStorage
.
setItem
(
'summary'
,
JSON
.
stringify
(
this
.
_getSaveObj
()))
// this.$refs.scan._open()
this
.
$router
.
push
(
'/sampling_list/scan_bar'
)
},
_scanResult
(
result
)
{
for
(
let
key
in
this
.
sample
)
{
...
...
@@ -1208,50 +1240,53 @@
_getData
:
async
function
()
{
let
result
=
await
samplingSummary
.
getById
(
this
.
id
)
if
(
result
)
{
for
(
let
key
in
this
.
formObj
)
{
if
(
result
[
key
]
!==
''
)
{
if
(
key
===
'samplingDate'
)
{
this
.
formObj
[
key
]
=
result
[
key
]
?
this
.
$dateformat
(
result
[
key
],
'yyyy-mm-dd'
)
:
''
}
else
{
this
.
formObj
[
key
]
=
result
[
key
]
}
this
.
_initData
(
result
)
}
},
_initData
(
result
)
{
for
(
let
key
in
this
.
formObj
)
{
if
(
result
[
key
]
!==
''
)
{
if
(
key
===
'samplingDate'
)
{
this
.
formObj
[
key
]
=
result
[
key
]
?
this
.
$dateformat
(
result
[
key
],
'yyyy-mm-dd'
)
:
''
}
else
{
this
.
formObj
[
key
]
=
result
[
key
]
}
}
for
(
let
key
in
this
.
nonNetTested
)
{
if
(
result
.
nonNetTested
[
key
]
!==
''
)
{
if
(
key
===
'placeLink'
)
{
this
.
place
=
result
.
nonNetTested
.
placeLink
+
','
+
result
.
nonNetTested
.
place
switch
(
result
.
nonNetTested
.
placeLink
)
{
case
'1'
:
this
.
placeRemark1
=
result
.
nonNetTested
.
placeRemark
?
result
.
nonNetTested
.
placeRemark
:
''
break
case
'2'
:
this
.
placeRemark2
=
result
.
nonNetTested
.
placeRemark
?
result
.
nonNetTested
.
placeRemark
:
''
break
case
'3'
:
this
.
placeRemark3
=
result
.
nonNetTested
.
placeRemark
?
result
.
nonNetTested
.
placeRemark
:
''
break
}
}
else
{
this
.
nonNetTested
[
key
]
=
result
.
nonNetTested
[
key
]
}
for
(
let
key
in
this
.
nonNetTested
)
{
if
(
result
.
nonNetTested
[
key
]
!==
''
)
{
if
(
key
===
'placeLink'
)
{
this
.
place
=
result
.
nonNetTested
.
placeLink
+
','
+
result
.
nonNetTested
.
place
switch
(
result
.
nonNetTested
.
placeLink
)
{
case
'1'
:
this
.
placeRemark1
=
result
.
nonNetTested
.
placeRemark
?
result
.
nonNetTested
.
placeRemark
:
''
break
case
'2'
:
this
.
placeRemark2
=
result
.
nonNetTested
.
placeRemark
?
result
.
nonNetTested
.
placeRemark
:
''
break
case
'3'
:
this
.
placeRemark3
=
result
.
nonNetTested
.
placeRemark
?
result
.
nonNetTested
.
placeRemark
:
''
break
}
}
else
{
this
.
nonNetTested
[
key
]
=
result
.
nonNetTested
[
key
]
}
}
for
(
let
key
in
this
.
sample
)
{
if
(
result
.
sample
[
key
]
!==
''
)
{
if
(
key
===
'sampleDate
'
)
{
this
.
sample
[
key
]
=
result
.
sample
[
key
]
?
this
.
$dateformat
(
result
.
sample
[
key
],
'yyyy-mm-dd'
)
:
''
}
else
if
(
key
===
'storageCondition'
)
{
this
.
storageCondition
=
result
.
sample
[
key
].
split
(
','
)
this
.
sample
[
key
]
=
result
.
sample
[
key
]
}
else
{
this
.
sample
[
key
]
=
result
.
sample
[
key
]
}
}
for
(
let
key
in
this
.
sample
)
{
if
(
result
.
sample
[
key
]
!==
'
'
)
{
if
(
key
===
'sampleDate'
)
{
this
.
sample
[
key
]
=
result
.
sample
[
key
]
?
this
.
$dateformat
(
result
.
sample
[
key
],
'yyyy-mm-dd'
)
:
''
}
else
if
(
key
===
'storageCondition'
)
{
this
.
storageCondition
=
result
.
sample
[
key
].
split
(
','
)
this
.
sample
[
key
]
=
result
.
sample
[
key
]
}
else
{
this
.
sample
[
key
]
=
result
.
sample
[
key
]
}
}
this
.
testedType
=
result
.
testedType
this
.
shelfId
=
result
.
shelfId
}
this
.
testedType
=
result
.
testedType
this
.
shelfId
=
result
.
shelfId
},
_valParams
()
{
if
(
this
.
formObj
.
samplingNum
===
''
)
{
...
...
@@ -1280,6 +1315,14 @@
if
(
this
.
_valParams
())
{
return
}
let
data
=
this
.
_getSaveObj
()
if
(
this
.
id
)
{
this
.
_editSave
(
data
)
}
else
{
this
.
_addSave
(
data
)
}
},
_getSaveObj
()
{
let
data
=
Object
.
assign
({},
this
.
formObj
,
{
nonNetTested
:
this
.
nonNetTested
},
{
sample
:
this
.
sample
})
data
.
sample
.
storageCondition
=
this
.
storageCondition
.
join
(
','
)
if
(
this
.
place
)
{
...
...
@@ -1299,16 +1342,14 @@
}
data
.
shelfId
=
this
.
shelfId
data
.
testedType
=
this
.
testedType
if
(
this
.
id
)
{
this
.
_editSave
(
data
)
}
else
{
this
.
_addSave
(
data
)
}
return
data
},
_addSave
:
async
function
(
data
)
{
let
result
=
await
samplingSummary
.
add
(
data
)
if
(
result
)
{
this
.
$toast
(
'添加成功!'
)
localStorage
.
removeItem
(
'summary'
)
localStorage
.
removeItem
(
'sample'
)
this
.
$router
.
go
(
-
1
)
}
},
...
...
@@ -1317,6 +1358,8 @@
let
result
=
await
samplingSummary
.
edit
(
data
)
if
(
result
)
{
this
.
$toast
(
'编辑成功!'
)
localStorage
.
removeItem
(
'summary'
)
localStorage
.
removeItem
(
'sample'
)
this
.
$router
.
go
(
-
1
)
}
},
...
...
src/page/sampling-list/SamplingListAddNet.vue
View file @
749744fb
This diff is collapsed.
Click to expand it.
src/page/sampling-list/ScanBar.vue
0 → 100644
View file @
749744fb
<
template
>
<customer-navBar-layout>
<template
#
navBar
>
<van-nav-bar
title=
"扫码"
left-arrow
@
click-left=
"_cancelScan"
></van-nav-bar>
</
template
>
<
template
#
content
>
<div
id=
"bcid"
>
<div
style=
"height:40%"
></div>
</div>
<div
class=
"bottom-btn"
>
<van-button
block
type=
"default"
@
click=
"_cancelScan"
>
取消
</van-button>
</div>
</
template
>
</customer-navBar-layout>
</template>
<
style
scoped
>
#bcid
{
width
:
100%
;
height
:
calc
(
100%
-
42px
);
text-align
:
center
;
}
</
style
>
<
script
>
import
{
samplingSample
}
from
'../../api'
var
barcode
=
null
;
//扫码对象
export
default
{
data
()
{
return
{
num
:
''
,
}
},
mounted
()
{
this
.
_open
()
//返回键操作
mui
.
init
({
beforeback
:
function
()
{
barcode
.
close
();
return
true
;
}
});
},
methods
:
{
_open
()
{
barcode
=
null
;
let
that
=
this
;
if
(
!
barcode
)
{
barcode
=
new
plus
.
barcode
.
Barcode
(
'bcid'
,
[
plus
.
barcode
.
EAN13
,
plus
.
barcode
.
EAN8
],
{
frameColor
:
'#00FF00'
,
scanbarColor
:
'#00FF00'
});
barcode
.
onmarked
=
function
(
type
,
result
)
{
if
(
type
===
plus
.
barcode
.
EAN13
||
type
===
plus
.
barcode
.
EAN8
)
{
that
.
_getSample
(
result
)
}
else
{
that
.
$toast
(
'扫描失败!'
)
barcode
.
close
();
that
.
$router
.
go
(
-
1
);
}
};
plus
.
webview
.
currentWebview
().
append
(
barcode
);
}
barcode
.
start
();
},
_getSample
:
async
function
(
qrcode
)
{
let
res
=
await
samplingSample
.
scanSample
({
qrcode
:
qrcode
})
if
(
res
)
{
localStorage
.
setItem
(
'sample'
,
JSON
.
stringify
(
res
))
barcode
.
close
();
this
.
$router
.
go
(
-
1
)
}
else
{
localStorage
.
setItem
(
'sample'
,
JSON
.
stringify
({
qrcode
:
qrcode
}))
barcode
.
close
();
this
.
$router
.
go
(
-
1
)
}
},
_cancelScan
()
{
barcode
.
close
();
this
.
$router
.
go
(
-
1
)
},
// _scanPicture() {
// let that = this;
// plus.gallery.pick(function (path) {
// plus.barcode.scan(path, function (type, result) {
// var text = '未知: ';
// switch (type) {
// case plus.barcode.CODE128:
// text = 'CODE128: ';
// break;
// }
// that.$store.dispatch('EnvSample/scanReceive', {num: result}).then(() => {
// if (that.$store.state.EnvSample.success) {
// barcode.close();
// that.$router.go(-1);
// }
// });
// }, function (error) {
// plus.nativeUI.alert('无法识别此图片');
// }, [plus.barcode.CODE128]);
// }, function (err) {
// console.log('Failed: ' + err.message);
// });
// },
}
}
</
script
>
src/router/sampling-list-routes.js
View file @
749744fb
...
...
@@ -7,6 +7,7 @@ import SamplingListDetailNet from '@/page/sampling-list/SamplingListDetailNet.vu
import
File
from
'@/page/sampling-list/file/File.vue'
import
FileUpload
from
'@/page/sampling-list/file/FileUpload.vue'
import
FileDownLoad
from
'@/page/sampling-list/file/FileDownLoad.vue'
import
ScanBar
from
'@/page/sampling-list/ScanBar.vue'
export
default
[
{
path
:
'sampling_task'
,
component
:
SamplingTask
,
meta
:
{
title
:
'抽样任务'
}},
...
...
@@ -18,4 +19,5 @@ export default [
{
path
:
'file'
,
component
:
File
,
meta
:
{
title
:
'附件'
}},
{
path
:
'file_upload'
,
component
:
FileUpload
,
meta
:
{
title
:
'添加附件'
}},
{
path
:
'file_download'
,
component
:
FileDownLoad
,
meta
:
{
title
:
'预览附件'
}},
{
path
:
'scan_bar'
,
component
:
ScanBar
,
meta
:
{
title
:
'扫码'
,
hideNavBar
:
true
}},
]
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