Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
8fb8aecf
Commit
8fb8aecf
authored
Jul 23, 2021
by
季圣华
Browse files
优化多属性模块
parent
c7d1ea4e
Changes
5
Hide whitespace changes
Inline
Side-by-side
jshERP-web/src/api/api.js
View file @
8fb8aecf
...
@@ -122,6 +122,7 @@ const editMaterialProperty = (params)=>putAction("/materialProperty/update",para
...
@@ -122,6 +122,7 @@ const editMaterialProperty = (params)=>putAction("/materialProperty/update",para
//商品类型
//商品类型
const
queryMaterialCategoryTreeList
=
(
params
)
=>
getAction
(
"
/materialCategory/getMaterialCategoryTree
"
,
params
);
const
queryMaterialCategoryTreeList
=
(
params
)
=>
getAction
(
"
/materialCategory/getMaterialCategoryTree
"
,
params
);
const
queryMaterialCategoryById
=
(
params
)
=>
getAction
(
"
/materialCategory/findById
"
,
params
);
const
queryMaterialCategoryById
=
(
params
)
=>
getAction
(
"
/materialCategory/findById
"
,
params
);
const
checkMaterialCategory
=
(
params
)
=>
getAction
(
"
/materialCategory/checkIsNameExist
"
,
params
);
//商品管理
//商品管理
const
addMaterial
=
(
params
)
=>
postAction
(
"
/material/add
"
,
params
);
const
addMaterial
=
(
params
)
=>
postAction
(
"
/material/add
"
,
params
);
const
editMaterial
=
(
params
)
=>
putAction
(
"
/material/update
"
,
params
);
const
editMaterial
=
(
params
)
=>
putAction
(
"
/material/update
"
,
params
);
...
@@ -135,6 +136,10 @@ const addSerialNumber = (params)=>postAction("/serialNumber/add",params);
...
@@ -135,6 +136,10 @@ const addSerialNumber = (params)=>postAction("/serialNumber/add",params);
const
editSerialNumber
=
(
params
)
=>
putAction
(
"
/serialNumber/update
"
,
params
);
const
editSerialNumber
=
(
params
)
=>
putAction
(
"
/serialNumber/update
"
,
params
);
const
checkSerialNumber
=
(
params
)
=>
getAction
(
"
/serialNumber/checkIsNameExist
"
,
params
);
const
checkSerialNumber
=
(
params
)
=>
getAction
(
"
/serialNumber/checkIsNameExist
"
,
params
);
const
batAddSerialNumber
=
(
params
)
=>
postAction
(
"
/serialNumber/batAddSerialNumber
"
,
params
);
const
batAddSerialNumber
=
(
params
)
=>
postAction
(
"
/serialNumber/batAddSerialNumber
"
,
params
);
//多属性
const
addMaterialAttribute
=
(
params
)
=>
postAction
(
"
/materialAttribute/add
"
,
params
);
const
editMaterialAttribute
=
(
params
)
=>
putAction
(
"
/materialAttribute/update
"
,
params
);
const
checkMaterialAttribute
=
(
params
)
=>
getAction
(
"
/materialAttribute/checkIsNameExist
"
,
params
);
//功能管理
//功能管理
const
addFunction
=
(
params
)
=>
postAction
(
"
/function/add
"
,
params
);
const
addFunction
=
(
params
)
=>
postAction
(
"
/function/add
"
,
params
);
const
editFunction
=
(
params
)
=>
putAction
(
"
/function/update
"
,
params
);
const
editFunction
=
(
params
)
=>
putAction
(
"
/function/update
"
,
params
);
...
@@ -243,6 +248,7 @@ export {
...
@@ -243,6 +248,7 @@ export {
editMaterialProperty
,
editMaterialProperty
,
queryMaterialCategoryTreeList
,
queryMaterialCategoryTreeList
,
queryMaterialCategoryById
,
queryMaterialCategoryById
,
checkMaterialCategory
,
addMaterial
,
addMaterial
,
editMaterial
,
editMaterial
,
checkMaterial
,
checkMaterial
,
...
@@ -254,6 +260,9 @@ export {
...
@@ -254,6 +260,9 @@ export {
editSerialNumber
,
editSerialNumber
,
checkSerialNumber
,
checkSerialNumber
,
batAddSerialNumber
,
batAddSerialNumber
,
addMaterialAttribute
,
editMaterialAttribute
,
checkMaterialAttribute
,
addFunction
,
addFunction
,
editFunction
,
editFunction
,
checkFunction
,
checkFunction
,
...
...
jshERP-web/src/views/material/MaterialAttributeList.vue
View file @
8fb8aecf
...
@@ -20,17 +20,21 @@
...
@@ -20,17 +20,21 @@
</a-table>
</a-table>
</div>
</div>
<!-- table区域-end -->
<!-- table区域-end -->
<!-- 表单区域 -->
<material-attribute-modal
ref=
"modalForm"
@
ok=
"modalFormOk"
></material-attribute-modal>
</a-card>
</a-card>
</a-col>
</a-col>
</a-row>
</a-row>
</
template
>
</
template
>
<
script
>
<
script
>
import
MaterialAttributeModal
from
'
./modules/MaterialAttributeModal
'
import
{
JeecgListMixin
}
from
'
@/mixins/JeecgListMixin
'
import
{
JeecgListMixin
}
from
'
@/mixins/JeecgListMixin
'
import
JDate
from
'
@/components/jeecg/JDate
'
import
JDate
from
'
@/components/jeecg/JDate
'
export
default
{
export
default
{
name
:
"
MaterialAttributeList
"
,
name
:
"
MaterialAttributeList
"
,
mixins
:[
JeecgListMixin
],
mixins
:[
JeecgListMixin
],
components
:
{
components
:
{
MaterialAttributeModal
,
JDate
JDate
},
},
data
()
{
data
()
{
...
@@ -57,7 +61,7 @@
...
@@ -57,7 +61,7 @@
}
}
},
},
{
title
:
'
属性名
'
,
dataIndex
:
'
attributeName
'
,
width
:
100
},
{
title
:
'
属性名
'
,
dataIndex
:
'
attributeName
'
,
width
:
100
},
{
title
:
'
属性值
'
,
dataIndex
:
'
attributeValue
'
,
width
:
400
},
{
title
:
'
属性值
(用竖线隔开)
'
,
dataIndex
:
'
attributeValue
'
,
width
:
400
},
{
{
title
:
'
操作
'
,
title
:
'
操作
'
,
dataIndex
:
'
action
'
,
dataIndex
:
'
action
'
,
...
...
jshERP-web/src/views/material/MaterialCategoryList.vue
View file @
8fb8aecf
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
<
script
>
<
script
>
import
MaterialCategoryModal
from
'
../material/modules/MaterialCategoryModal
'
import
MaterialCategoryModal
from
'
../material/modules/MaterialCategoryModal
'
import
pick
from
'
lodash.pick
'
import
pick
from
'
lodash.pick
'
import
{
queryMaterialCategoryTreeList
,
queryMaterialCategoryById
}
from
'
@/api/api
'
import
{
queryMaterialCategoryTreeList
,
queryMaterialCategoryById
,
checkMaterialCategory
}
from
'
@/api/api
'
import
{
httpAction
,
deleteAction
}
from
'
@/api/manage
'
import
{
httpAction
,
deleteAction
}
from
'
@/api/manage
'
import
{
JeecgListMixin
}
from
'
@/mixins/JeecgListMixin
'
import
{
JeecgListMixin
}
from
'
@/mixins/JeecgListMixin
'
export
default
{
export
default
{
...
@@ -143,7 +143,12 @@ export default {
...
@@ -143,7 +143,12 @@ export default {
edges
:
[]
edges
:
[]
},
},
validatorRules
:{
validatorRules
:{
name
:
{
rules
:
[{
required
:
true
,
message
:
'
请输入名称!
'
}]},
name
:
{
rules
:
[
{
required
:
true
,
message
:
'
请输入名称!
'
},
{
validator
:
this
.
validateName
}
]
},
serialNo
:
{
rules
:
[{
required
:
true
,
message
:
'
请输入编号!
'
}]}
serialNo
:
{
rules
:
[{
required
:
true
,
message
:
'
请输入编号!
'
}]}
},
},
url
:
{
url
:
{
...
@@ -259,7 +264,6 @@ export default {
...
@@ -259,7 +264,6 @@ export default {
nodeModalClose
()
{
nodeModalClose
()
{
},
},
hide
()
{
hide
()
{
console
.
log
(
111
)
this
.
visible
=
false
this
.
visible
=
false
},
},
onCheck
(
checkedKeys
,
info
)
{
onCheck
(
checkedKeys
,
info
)
{
...
@@ -357,6 +361,23 @@ export default {
...
@@ -357,6 +361,23 @@ export default {
openSelect
()
{
openSelect
()
{
this
.
$refs
.
sysDirectiveModal
.
show
()
this
.
$refs
.
sysDirectiveModal
.
show
()
},
},
validateName
(
rule
,
value
,
callback
){
let
params
=
{
name
:
value
,
id
:
this
.
model
.
id
?
this
.
model
.
id
:
0
};
checkMaterialCategory
(
params
).
then
((
res
)
=>
{
if
(
res
&&
res
.
code
===
200
)
{
if
(
!
res
.
data
.
status
){
callback
();
}
else
{
callback
(
"
名称已经存在
"
);
}
}
else
{
callback
(
res
.
data
);
}
});
},
handleAdd
()
{
handleAdd
()
{
this
.
$refs
.
materialCategoryModal
.
add
()
this
.
$refs
.
materialCategoryModal
.
add
()
this
.
$refs
.
materialCategoryModal
.
title
=
'
新增
'
this
.
$refs
.
materialCategoryModal
.
title
=
'
新增
'
...
...
jshERP-web/src/views/material/modules/MaterialAttributeModal.vue
0 → 100644
View file @
8fb8aecf
<
template
>
<a-modal
:title=
"title"
:width=
"800"
:visible=
"visible"
:confirmLoading=
"confirmLoading"
@
ok=
"handleOk"
@
cancel=
"handleCancel"
cancelText=
"关闭"
wrapClassName=
"ant-modal-cust-warp"
style=
"top:20%;height: 50%;overflow-y: hidden"
>
<template
slot=
"footer"
>
<a-button
key=
"back"
v-if=
"isReadOnly"
@
click=
"handleCancel"
>
关闭
</a-button>
</
template
>
<a-spin
:spinning=
"confirmLoading"
>
<a-form
:form=
"form"
>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"属性名"
>
<a-input
placeholder=
"请输入属性名"
v-decorator.trim=
"[ 'attributeName', validatorRules.attributeName]"
/>
</a-form-item>
</a-form>
<a-form
:form=
"form"
>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"属性值"
>
<a-textarea
:rows=
"2"
placeholder=
"请输入属性值(用竖线隔开)"
v-decorator.trim=
"[ 'attributeValue', validatorRules.attributeValue]"
/>
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<
script
>
import
pick
from
'
lodash.pick
'
import
{
addMaterialAttribute
,
editMaterialAttribute
,
checkMaterialAttribute
}
from
'
@/api/api
'
export
default
{
name
:
"
MaterialAttributeModal
"
,
data
()
{
return
{
title
:
"
操作
"
,
visible
:
false
,
model
:
{},
isReadOnly
:
false
,
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
5
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
16
},
},
confirmLoading
:
false
,
form
:
this
.
$form
.
createForm
(
this
),
validatorRules
:{
attributeName
:{
rules
:
[
{
required
:
true
,
message
:
'
请输入属性名!
'
},
{
min
:
1
,
max
:
10
,
message
:
'
长度在 1 到 10 个字符
'
,
trigger
:
'
blur
'
},
{
validator
:
this
.
validateAttributeName
}
]
},
attributeValue
:{
rules
:
[
{
required
:
true
,
message
:
'
请输入属性值(用竖线隔开)!
'
}
]
}
}
}
},
created
()
{
},
methods
:
{
add
()
{
this
.
edit
({});
},
edit
(
record
)
{
this
.
form
.
resetFields
();
this
.
model
=
Object
.
assign
({},
record
);
this
.
visible
=
true
;
this
.
$nextTick
(()
=>
{
this
.
form
.
setFieldsValue
(
pick
(
this
.
model
,
'
attributeName
'
,
'
attributeValue
'
))
});
},
close
()
{
this
.
$emit
(
'
close
'
);
this
.
visible
=
false
;
},
handleOk
()
{
const
that
=
this
;
// 触发表单验证
this
.
form
.
validateFields
((
err
,
values
)
=>
{
if
(
!
err
)
{
that
.
confirmLoading
=
true
;
let
formData
=
Object
.
assign
(
this
.
model
,
values
);
let
obj
;
if
(
!
this
.
model
.
id
){
obj
=
addMaterialAttribute
(
formData
);
}
else
{
obj
=
editMaterialAttribute
(
formData
);
}
obj
.
then
((
res
)
=>
{
if
(
res
.
code
===
200
){
that
.
$emit
(
'
ok
'
);
}
else
{
that
.
$message
.
warning
(
res
.
data
.
message
);
}
}).
finally
(()
=>
{
that
.
confirmLoading
=
false
;
that
.
close
();
})
}
})
},
handleCancel
()
{
this
.
close
()
},
validateAttributeName
(
rule
,
value
,
callback
){
let
params
=
{
name
:
value
,
id
:
this
.
model
.
id
?
this
.
model
.
id
:
0
};
checkMaterialAttribute
(
params
).
then
((
res
)
=>
{
if
(
res
&&
res
.
code
===
200
)
{
if
(
!
res
.
data
.
status
){
callback
();
}
else
{
callback
(
"
名称已经存在
"
);
}
}
else
{
callback
(
res
.
data
);
}
});
}
}
}
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
jshERP-web/src/views/material/modules/MaterialCategoryModal.vue
View file @
8fb8aecf
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
<
script
>
<
script
>
import
{
httpAction
}
from
'
@/api/manage
'
import
{
httpAction
}
from
'
@/api/manage
'
import
{
queryMaterialCategoryTreeList
}
from
'
@/api/api
'
import
{
queryMaterialCategoryTreeList
,
checkMaterialCategory
}
from
'
@/api/api
'
import
pick
from
'
lodash.pick
'
import
pick
from
'
lodash.pick
'
import
ATextarea
from
'
ant-design-vue/es/input/TextArea
'
import
ATextarea
from
'
ant-design-vue/es/input/TextArea
'
export
default
{
export
default
{
...
@@ -67,7 +67,12 @@
...
@@ -67,7 +67,12 @@
confirmLoading
:
false
,
confirmLoading
:
false
,
form
:
this
.
$form
.
createForm
(
this
),
form
:
this
.
$form
.
createForm
(
this
),
validatorRules
:{
validatorRules
:{
name
:
{
rules
:
[{
required
:
true
,
message
:
'
请输入名称!
'
}]},
name
:
{
rules
:
[
{
required
:
true
,
message
:
'
请输入名称!
'
},
{
validator
:
this
.
validateName
}
]
},
serialNo
:
{
rules
:
[{
required
:
true
,
message
:
'
请输入编号!
'
}]}
serialNo
:
{
rules
:
[{
required
:
true
,
message
:
'
请输入编号!
'
}]}
},
},
url
:
{
url
:
{
...
@@ -135,6 +140,23 @@
...
@@ -135,6 +140,23 @@
},
},
handleCancel
()
{
handleCancel
()
{
this
.
close
()
this
.
close
()
},
validateName
(
rule
,
value
,
callback
){
let
params
=
{
name
:
value
,
id
:
this
.
model
.
id
?
this
.
model
.
id
:
0
};
checkMaterialCategory
(
params
).
then
((
res
)
=>
{
if
(
res
&&
res
.
code
===
200
)
{
if
(
!
res
.
data
.
status
){
callback
();
}
else
{
callback
(
"
名称已经存在
"
);
}
}
else
{
callback
(
res
.
data
);
}
});
}
}
}
}
}
}
...
...
Write
Preview
Supports
Markdown
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