Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manage
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
vanke
manage
Commits
abca0593
Commit
abca0593
authored
Jun 29, 2020
by
wangyalan-git
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增物品校验
parent
5d6954ae
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
31 deletions
+62
-31
index.js
src/router/index.js
+1
-2
WarehouseAdmin.vue
src/views/inv/WarehouseAdmin.vue
+3
-3
addGoodsModal.vue
src/views/inv/modules/addGoodsModal.vue
+0
-0
importGoodsModal.vue
src/views/inv/modules/importGoodsModal.vue
+58
-26
No files found.
src/router/index.js
View file @
abca0593
...
...
@@ -137,8 +137,7 @@ export const asyncRouterMap = [
path
:
'userList'
,
name
:
'userList'
,
component
:
()
=>
import
(
'@/views/use/UserList'
),
meta
:
{
title
:
'用户列表'
,
icon
:
'product-cate'
},
hidden
:
true
meta
:
{
title
:
'用户列表'
,
icon
:
'product-cate'
}
}]
},
{
...
...
src/views/inv/WarehouseAdmin.vue
View file @
abca0593
...
...
@@ -75,11 +75,11 @@
</el-table-column>
<el-table-column
label=
"型号"
align=
"center"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
name
}}
</
template
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
goodsNo
}}
</
template
>
</el-table-column>
<el-table-column
label=
"物品类别"
align=
"center"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
usern
ame
}}
</
template
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
goodsCategoryN
ame
}}
</
template
>
</el-table-column>
<el-table-column
label=
"数量"
align=
"center"
>
...
...
@@ -87,7 +87,7 @@
</el-table-column>
<el-table-column
label=
"申领人"
align=
"center"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
memberName
||
'--'
}}
</
template
>
<
template
slot-scope=
"scope"
>
{{
$store
.
getters
.
type
==
1
?
scope
.
row
.
backOutboundName
:
scope
.
row
.
receptOutboundName
}}
</
template
>
</el-table-column>
<el-table-column
label=
"所属部门"
align=
"center"
>
...
...
src/views/inv/modules/addGoodsModal.vue
View file @
abca0593
This diff is collapsed.
Click to expand it.
src/views/inv/modules/importGoodsModal.vue
View file @
abca0593
...
...
@@ -2,7 +2,8 @@
<el-dialog
:visible
.
sync=
"visible"
:title=
"title"
center
width=
"1000px"
>
width=
"1000px"
:close-on-click-modal=
"false"
>
<!-- excel表格上传 -->
<el-upload
:auto-upload=
"false"
...
...
@@ -21,13 +22,13 @@
<el-table
:data=
"formData.tableData"
style=
"width: 100%"
@
row-dblclick=
"dbclick"
:row-class-name=
"tableRowClassName"
>
<el-table-column
prop=
"name"
label=
"物品名称"
>
<template
slot-scope=
"scope"
>
<el-form-item
size=
"mini"
:prop=
"'tableData.' + scope.$index + '.name'"
:rules=
"[
{required: true,trigger: 'change',message: '物品名称不能为空'}]">
<el-autocomplete
:maxlength=
"30"
class=
"input-width"
v-model=
"scope.row.name"
:fetch-suggestions=
"querySearch"
...
...
@@ -64,7 +65,7 @@
<el-table-column
label=
"物品类别"
>
<
template
slot-scope=
"scope"
>
<el-form-item
size=
"mini"
:prop=
"'tableData.' + scope.$index + '.goodsCategoryId'"
:rules=
"[
{required: true,
trigger: 'change',message: '物品类别不能为空
'}]">
:rules=
"[
{required: true,
message: '请选择物品类别',trigger: 'change
'}]">
<el-select
v-if=
"scope.row.isOK"
v-model=
"scope.row.goodsCategoryId"
class=
"input-width"
clearable
...
...
@@ -82,7 +83,7 @@
<el-table-column
label=
"数量"
>
<
template
slot-scope=
"scope"
>
<el-form-item
size=
"mini"
:prop=
"'tableData.' + scope.$index + '.goodsNum'"
:rules=
"[
{
required: true,trigger: 'blur',message: '数量不能为空
'}]">
:rules=
"[
{
validator: validateNum,trigger: 'blur
'}]">
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.goodsNum"
class=
"input-width"
placeholder=
"数量"
></el-input>
<span
v-else
>
{{
scope
.
row
.
goodsNum
}}
</span>
...
...
@@ -92,7 +93,7 @@
<el-table-column
label=
"价格(元)"
>
<
template
slot-scope=
"scope"
>
<el-form-item
size=
"mini"
:prop=
"'tableData.' + scope.$index + '.prict'"
:rules=
"[
{
required: true,trigger: 'blur',message: '价格不能为空
'}]">
:rules=
"[
{
validator: validatePrice,trigger: 'blur
'}]">
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.prict"
class=
"input-width"
placeholder=
"价格"
:disabled=
"scope.row.id? true: false"
></el-input>
...
...
@@ -168,7 +169,31 @@ import XLSX from 'xlsx'
export
default
{
name
:
'importGoodsModal'
,
data
()
{
var
validatePrice
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
callback
(
new
Error
(
'价格不能为空'
))
}
else
{
let
priceReg
=
/^
[
0-9
]
+
(
.
[
0-9
]{2})?
$/
if
(
!
priceReg
.
test
(
value
))
{
callback
(
new
Error
(
'价格不符合要求'
))
}
callback
()
}
}
var
validateNum
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
callback
(
new
Error
(
'数量不能为空'
))
}
else
{
let
myReg
=
/^
\d{1,}
$/
if
(
!
myReg
.
test
(
value
))
{
callback
(
new
Error
(
'数量必须为正整数'
))
}
callback
()
}
}
return
{
validatePrice
:
validatePrice
,
validateNum
:
validateNum
,
files
:
null
,
//文件列表
visible
:
false
,
title
:
null
,
...
...
@@ -308,15 +333,15 @@ export default {
// 把每一行的索引放进row
row
.
index
=
rowIndex
;
},
dbclick
(
row
,
event
,
column
)
{
console
.
log
(
'row, event, column'
,
row
,
event
,
column
)
for
(
var
i
of
this
.
formData
.
tableData
)
{
i
.
isOK
=
false
}
row
.
isOK
=
!
row
.
isOK
this
.
formData
.
tableData
.
splice
(
row
.
index
,
1
,
row
)
console
.
log
(
'this.formData.tableData'
,
this
.
formData
.
tableData
)
},
//
dbclick(row, event, column) {
//
console.log('row, event, column',row, event, column)
//
for (var i of this.formData.tableData) {
//
i.isOK = false
//
}
//
row.isOK = !row.isOK
//
this.formData.tableData.splice(row.index,1,row)
//
console.log('this.formData.tableData',this.formData.tableData)
//
},
submit
(
formName
)
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
...
...
@@ -395,6 +420,9 @@ export default {
fs
.
splice
(
0
,
1
)
}
this
.
read
(
f
.
raw
)
this
.
$nextTick
(()
=>
{
this
.
$refs
.
formData
.
clearValidate
()
})
},
/**
* 解析
...
...
@@ -407,18 +435,12 @@ export default {
let
tables
=
[]
for
(
var
sheet
of
sheetArray
.
Sheet1
)
{
let
rowTable
=
{}
rowTable
.
isOK
=
true
rowTable
.
name
=
sheet
[
'物品名称'
]
rowTable
.
goodsNo
=
sheet
[
'型号'
]
rowTable
.
goodsNum
=
sheet
[
'数量'
]
rowTable
.
prict
=
sheet
[
'价格'
]
rowTable
.
barCode
=
sheet
[
'条形码'
]
if
(
sheet
[
'物品名称'
])
{
let
isExist
=
this
.
goodsList
.
findIndex
(
item
=>
item
.
name
===
sheet
[
'物品名称'
]
)
isExist
===
-
1
&&
(
rowTable
.
id
=
null
)
isExist
!==
-
1
&&
(
rowTable
.
id
=
this
.
goodsList
[
isExist
].
id
)
}
if
(
sheet
[
'物品类别'
])
{
let
isExist
=
this
.
categoryOptions
.
findIndex
(
item
=>
item
.
name
===
sheet
[
'物品类别'
]
...
...
@@ -440,6 +462,21 @@ export default {
isExist
===
-
1
&&
(
rowTable
.
stockRoomId
=
null
)
isExist
!==
-
1
&&
(
rowTable
.
stockRoomId
=
this
.
depotOptions
[
isExist
].
id
)
}
if
(
sheet
[
'物品名称'
])
{
let
isExist
=
this
.
goodsList
.
findIndex
(
item
=>
item
.
name
===
sheet
[
'物品名称'
]
)
isExist
===
-
1
&&
(
rowTable
.
id
=
null
)
if
(
isExist
!==
-
1
){
rowTable
.
id
=
this
.
goodsList
[
isExist
].
id
rowTable
.
prict
=
this
.
goodsList
[
isExist
].
prict
rowTable
.
goodsNo
=
this
.
goodsList
[
isExist
].
goodsNo
rowTable
.
barCode
=
this
.
goodsList
[
isExist
].
barCode
rowTable
.
goodsCategoryId
=
this
.
goodsList
[
isExist
].
goodsCategoryId
rowTable
.
stockRoomId
=
this
.
goodsList
[
isExist
].
stockRoomId
rowTable
.
supplierId
=
this
.
goodsList
[
isExist
].
supplierId
}
}
tables
.
push
(
rowTable
)
this
.
formData
.
tableData
=
tables
}
...
...
@@ -465,8 +502,3 @@ export default {
font-size
:
10px
;
}
</
style
>
<
style
>
.no-bottom
.el-form-item--mini.el-form-item
,
.el-form-item--small.el-form-item
{
margin-bottom
:
0
;
}
</
style
>
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