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
cc3370a8
Commit
cc3370a8
authored
Jun 23, 2020
by
wangyalan-git
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品
parent
9062f9ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
46 deletions
+113
-46
inventory.js
src/api/inventory.js
+8
-0
addGoodsModal.vue
src/views/inv/modules/addGoodsModal.vue
+105
-46
No files found.
src/api/inventory.js
View file @
cc3370a8
...
@@ -82,3 +82,11 @@ export function getGoodsList(params) {
...
@@ -82,3 +82,11 @@ export function getGoodsList(params) {
params
params
})
})
}
}
// 万科后台_物品插入操作
export
function
addGoods
(
params
)
{
return
request
({
url
:
'vankeGoods/insertGoods'
,
method
:
'post'
,
params
})
}
src/views/inv/modules/addGoodsModal.vue
View file @
cc3370a8
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<el-row
style=
"padding: 10px 0;text-align: left;"
>
<el-row
style=
"padding: 10px 0;text-align: left;"
>
<el-button
type=
"primary"
size=
"medium"
@
click=
"handleAdd"
>
新增
</el-button>
<el-button
type=
"primary"
size=
"medium"
@
click=
"handleAdd"
>
新增
</el-button>
</el-row>
</el-row>
<div
class=
"scroll-container"
<div
class=
"scroll-container
no-bottom
"
ref=
"scrollContainer"
>
ref=
"scrollContainer"
>
<el-table
<el-table
:data=
"tableData"
:data=
"tableData"
...
@@ -16,8 +16,10 @@
...
@@ -16,8 +16,10 @@
<el-table-column
prop=
"name"
label=
"物品名称"
>
<el-table-column
prop=
"name"
label=
"物品名称"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<el-form
:model=
"scope.row"
>
<el-form
:model=
"scope.row"
>
<el-form-item
size=
"mini"
>
<el-form-item
size=
"mini"
prop=
"name"
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.name"
class=
"input-width"
placeholder=
"请输入物品名称"
></el-input>
:rules=
"[
{required: true,trigger: 'blur',message: '物品名称不能为空'}]">
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.name"
class=
"input-width"
placeholder=
"物品名称"
></el-input>
<span
v-else
>
{{
scope
.
row
.
name
}}
</span>
<span
v-else
>
{{
scope
.
row
.
name
}}
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
...
@@ -26,9 +28,10 @@
...
@@ -26,9 +28,10 @@
<el-table-column
prop=
"name"
label=
"型号"
>
<el-table-column
prop=
"name"
label=
"型号"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-form
:model=
"scope.row"
>
<el-form
:model=
"scope.row"
>
<el-form-item
size=
"mini"
>
<el-form-item
size=
"mini"
prop=
"goodsNo"
:rules=
"[
{required: true,trigger: 'blur',message: '型号不能为空'}]">
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.model"
class=
"input-width"
placeholder=
"请输入型号"
></el-input>
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.goodsNo"
class=
"input-width"
<span
v-else
>
{{
scope
.
row
.
model
}}
</span>
placeholder=
"型号"
></el-input>
<span
v-else
>
{{
scope
.
row
.
goodsNo
}}
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</
template
>
</
template
>
...
@@ -36,27 +39,27 @@
...
@@ -36,27 +39,27 @@
<el-table-column
prop=
"name"
label=
"物品类别"
>
<el-table-column
prop=
"name"
label=
"物品类别"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-form
:model=
"scope.row"
>
<el-form
:model=
"scope.row"
>
<el-form-item
size=
"mini"
>
<el-form-item
size=
"mini"
prop=
"goodsCategoryId"
:rules=
"[
{required: true,trigger: 'change',message: '物品类别不能为空'}]"
>
<el-select
v-if=
"scope.row.isOK"
v-model=
"scope.row.cate
"
<el-select
v-if=
"scope.row.isOK"
v-model=
"scope.row.goodsCategoryId
"
class=
"input-width"
class=
"input-width"
clearable
clearable
placeholder=
"请选择物品类型
"
>
placeholder=
"物品类别
"
>
<el-option
v-for=
"item in status
Options"
<el-option
v-for=
"item in category
Options"
:key=
"item.value
"
:key=
"item.id
"
:label=
"item.label
"
:label=
"item.name
"
:value=
"item.value
"
></el-option>
:value=
"item.id
"
></el-option>
</el-select>
</el-select>
<span
v-else
>
{{
scope
.
row
.
mcht
}}
</span>
<span
v-else
>
{{
getName
(
scope
.
row
.
goodsCategoryId
,
categoryOptions
)
}}
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
prop=
"name"
label=
"数量"
>
<el-table-column
prop=
"name"
label=
"数量"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-form
:model=
"scope.row"
>
<el-form
:model=
"scope.row"
>
<el-form-item
size=
"mini"
>
<el-form-item
size=
"mini"
prop=
"goodsNum"
:rules=
"[
{required: true,trigger: 'blur',message: '数量不能为空'}]"
>
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.
num"
class=
"input-width"
placeholder=
"请输入
数量"
></el-input>
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.
goodsNum"
class=
"input-width"
placeholder=
"
数量"
></el-input>
<span
v-else
>
{{
scope
.
row
.
n
um
}}
</span>
<span
v-else
>
{{
scope
.
row
.
goodsN
um
}}
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</
template
>
</
template
>
...
@@ -64,9 +67,10 @@
...
@@ -64,9 +67,10 @@
<el-table-column
prop=
"name"
label=
"价格(元)"
>
<el-table-column
prop=
"name"
label=
"价格(元)"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-form
:model=
"scope.row"
>
<el-form
:model=
"scope.row"
>
<el-form-item
size=
"mini"
>
<el-form-item
size=
"mini"
prop=
"prict"
:rules=
"[
{required: true,trigger: 'blur',message: '价格不能为空'}]">
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.price"
class=
"input-width"
placeholder=
"请输入价格"
></el-input>
<el-input
v-if=
"scope.row.isOK"
v-model=
"scope.row.prict"
class=
"input-width"
<span
v-else
>
{{
scope
.
row
.
price
}}
</span>
placeholder=
"价格"
></el-input>
<span
v-else
>
{{
scope
.
row
.
prict
}}
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</
template
>
</
template
>
...
@@ -74,32 +78,33 @@
...
@@ -74,32 +78,33 @@
<el-table-column
prop=
"name"
label=
"供应商"
>
<el-table-column
prop=
"name"
label=
"供应商"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-form
:model=
"scope.row"
>
<el-form
:model=
"scope.row"
>
<el-form-item
size=
"mini"
>
<el-form-item
size=
"mini"
prop=
"supplierId"
:rules=
"[
{required: true,trigger: 'change',message: '供应商不能为空'}]"
>
<el-select
v-if=
"scope.row.isOK"
v-model=
"scope.row.
mcht
"
<el-select
v-if=
"scope.row.isOK"
v-model=
"scope.row.
supplierId
"
class=
"input-width"
class=
"input-width"
clearable
clearable
placeholder=
"
请选择
供应商"
>
placeholder=
"供应商"
>
<el-option
v-for=
"item in s
tatus
Options"
<el-option
v-for=
"item in s
upplier
Options"
:key=
"item.
value
"
:key=
"item.
id
"
:label=
"item.
label
"
:label=
"item.
supplierName
"
:value=
"item.
value
"
></el-option>
:value=
"item.
id
"
></el-option>
</el-select>
</el-select>
<span
v-else
>
{{
scope
.
row
.
mcht
}}
</span>
<span
v-else
>
{{
getName
(
scope
.
row
.
supplierId
,
supplierOptions
,
1
)
}}
</span>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
<el-table-column
label=
"操作"
align=
"center"
>
align=
"center"
width=
"100"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-button
type=
"danger"
icon=
"el-icon-delete"
circle
>
</el-button>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleDelete(scope.$index)"
>
删除
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
</div>
</div>
<div
slot=
"footer"
>
<div
slot=
"footer"
>
<el-button
type=
"primary"
<el-button
type=
"primary"
@
click=
"
close
"
>
确认
@
click=
"
submit
"
>
确认
</el-button>
</el-button>
<el-button
<el-button
@
click=
"close"
>
返回
@
click=
"close"
>
返回
...
@@ -109,49 +114,97 @@
...
@@ -109,49 +114,97 @@
</el-dialog>
</el-dialog>
</template>
</template>
<
script
>
<
script
>
import
{
addMember
,
updateMcht
}
from
'@/api/audit'
import
{
getGoodsCategoryList
,
addGoods
}
from
'@/api/inventory'
import
{
getSuppliersList
}
from
'@/api/supplier'
// 添加编辑属性
// 添加编辑属性
export
default
{
export
default
{
name
:
'addGoodsModal'
,
name
:
'addGoodsModal'
,
data
()
{
data
()
{
return
{
return
{
statusOptions
:
[{
label
:
'物品'
,
value
:
1
}],
visible
:
false
,
visible
:
false
,
title
:
null
,
title
:
null
,
loading
:
false
,
loading
:
false
,
tableData
:
[]
tableData
:
[],
categoryOptions
:
[],
supplierOptions
:
[]
}
}
},
},
methods
:
{
methods
:
{
// 物品类别
getGoodsCategoryList
()
{
getGoodsCategoryList
().
then
(
res
=>
{
this
.
categoryOptions
=
res
.
data
.
list
})
},
// 供应商
getSuppliersList
()
{
getSuppliersList
().
then
(
res
=>
{
this
.
supplierOptions
=
res
.
data
.
list
})
},
init
()
{
init
()
{
this
.
getGoodsCategoryList
()
this
.
getSuppliersList
()
this
.
tableData
=
[]
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
scrollContainer
.
scrollTop
=
0
this
.
$refs
.
scrollContainer
.
scrollTop
=
0
})
})
},
},
add
(){
add
()
{
this
.
visible
=
true
this
.
visible
=
true
this
.
title
=
"新增物品"
this
.
title
=
'新增物品'
this
.
init
()
this
.
init
()
},
},
close
()
{
close
()
{
this
.
visible
=
false
this
.
visible
=
false
},
},
handleAdd
(){
handleAdd
()
{
for
(
var
i
of
this
.
tableData
){
i
.
isOK
=
false
}
this
.
tableData
.
push
({
this
.
tableData
.
push
({
name
:
''
,
name
:
''
,
num
:
''
,
goodsNo
:
''
,
cate
:
''
,
goodsNum
:
''
,
model
:
''
,
prict
:
''
,
price
:
''
,
supplierId
:
''
,
mcht
:
''
,
goodsCategoryId
:
''
,
isOK
:
true
isOK
:
true
},)
},)
},
},
dbclick
(
row
,
event
,
column
){
dbclick
(
row
,
event
,
column
)
{
for
(
var
i
of
this
.
tableData
){
i
.
isOK
=
false
}
console
.
log
(
row
,
event
,
column
)
console
.
log
(
row
,
event
,
column
)
row
.
isOK
=!
row
.
isOK
row
.
isOK
=
!
row
.
isOK
},
submit
()
{
addGoods
(
this
.
tableData
).
then
(
res
=>
{
this
.
$emit
(
'ok'
)
this
.
visible
=
false
})
},
// 删除
handleDelete
(
index
){
this
.
tableData
.
splice
(
index
,
1
)
},
// 获取名称
getName
(
id
,
arr
,
type
){
if
(
!
id
){
return
''
}
console
.
log
(
'arr'
,
id
,
arr
)
let
name
=
null
if
(
type
){
name
=
arr
.
filter
(
item
=>
item
.
id
==
id
)[
0
].
supplierName
}
else
{
name
=
arr
.
filter
(
item
=>
item
.
id
==
id
)[
0
].
name
}
return
name
}
}
}
}
}
}
...
@@ -162,7 +215,13 @@ export default {
...
@@ -162,7 +215,13 @@ export default {
overflow
:
hidden
;
overflow
:
hidden
;
overflow-y
:
auto
;
overflow-y
:
auto
;
}
}
.input-width
{
.input-width
{
width
:
100px
;
width
:
110px
;
}
</
style
>
<
style
>
.no-bottom
.el-form-item--mini.el-form-item
,
.el-form-item--small.el-form-item
{
margin-bottom
:
0
;
}
}
</
style
>
</
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