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
5df31c1e
Commit
5df31c1e
authored
Dec 01, 2021
by
季圣华
Browse files
给多单位再增加两个副单位
parent
5df71b26
Changes
5
Hide whitespace changes
Inline
Side-by-side
jshERP-web/src/components/jeecgbiz/modal/JSelectMaterialModal.vue
View file @
5df31c1e
...
...
@@ -107,14 +107,14 @@
{
dataIndex
:
'
standard
'
,
title
:
'
规格
'
,
width
:
80
},
{
dataIndex
:
'
model
'
,
title
:
'
型号
'
,
width
:
80
},
{
dataIndex
:
'
color
'
,
title
:
'
颜色
'
,
width
:
80
},
{
dataIndex
:
'
unit
'
,
title
:
'
单位
'
,
width
:
60
},
{
dataIndex
:
'
unit
'
,
title
:
'
单位
'
,
width
:
70
,
ellipsis
:
true
},
{
dataIndex
:
'
sku
'
,
title
:
'
多属性
'
,
width
:
80
},
{
dataIndex
:
'
stock
'
,
title
:
'
库存
'
,
width
:
60
},
{
dataIndex
:
'
expand
'
,
title
:
'
扩展信息
'
,
width
:
80
},
{
dataIndex
:
'
enableSerialNumber
'
,
title
:
'
序列号
'
,
width
:
60
,
align
:
"
center
"
,
scopedSlots
:
{
customRender
:
'
customRenderEnableSerialNumber
'
}
},
{
dataIndex
:
'
enableBatchNumber
'
,
title
:
'
批号
'
,
width
:
6
0
,
align
:
"
center
"
,
{
dataIndex
:
'
enableBatchNumber
'
,
title
:
'
批号
'
,
width
:
5
0
,
align
:
"
center
"
,
scopedSlots
:
{
customRender
:
'
customRenderEnableBatchNumber
'
}
}
],
...
...
jshERP-web/src/views/material/MaterialList.vue
View file @
5df31c1e
...
...
@@ -95,10 +95,6 @@
<a>
删除
</a>
</a-popconfirm>
</span>
<span
slot=
"customRenderUnit"
slot-scope=
"text, record"
>
{{text?text:record.unitName}}
<a-tag
v-if=
"record.sku"
>
SKU
</a-tag>
</span>
<
template
slot=
"customRenderEnabled"
slot-scope=
"enabled"
>
<a-tag
v-if=
"enabled"
color=
"green"
>
启用
</a-tag>
<a-tag
v-if=
"!enabled"
color=
"orange"
>
禁用
</a-tag>
...
...
@@ -165,8 +161,17 @@
{
title
:
'
颜色
'
,
dataIndex
:
'
color
'
,
width
:
'
4%
'
},
{
title
:
'
类别
'
,
dataIndex
:
'
categoryName
'
,
width
:
'
6%
'
},
{
title
:
'
扩展信息
'
,
dataIndex
:
'
materialOther
'
,
width
:
'
6%
'
},
{
title
:
'
单位
'
,
dataIndex
:
'
unit
'
,
width
:
'
6%
'
,
scopedSlots
:
{
customRender
:
'
customRenderUnit
'
}
{
title
:
'
单位
'
,
dataIndex
:
'
unit
'
,
width
:
'
6%
'
,
ellipsis
:
true
,
customRender
:
function
(
t
,
r
,
index
)
{
if
(
r
)
{
let
name
=
t
?
t
:
r
.
unitName
if
(
r
.
sku
)
{
return
name
+
'
[SKU]
'
;
}
else
{
return
name
;
}
}
}
},
{
title
:
'
保质期
'
,
dataIndex
:
'
expiryNum
'
,
width
:
'
4%
'
},
{
title
:
'
库存
'
,
dataIndex
:
'
stock
'
,
width
:
'
5%
'
},
...
...
jshERP-web/src/views/material/modules/MaterialModal.vue
View file @
5df31c1e
...
...
@@ -590,30 +590,36 @@
return
;
}
else
{
//进一步校验单位
let
manyUnitselected
=
''
let
basicUnit
=
''
,
otherUnit
=
''
,
otherUnitTwo
=
''
,
otherUnitThree
=
''
if
(
formData
.
unitId
)
{
for
(
let
i
=
0
;
i
<
this
.
unitList
.
length
;
i
++
)
{
if
(
this
.
unitList
[
i
].
id
==
formData
.
unitId
)
{
manyUnitselected
=
this
.
unitList
[
i
].
name
let
unitArr
=
this
.
unitList
for
(
let
i
=
0
;
i
<
unitArr
.
length
;
i
++
)
{
if
(
unitArr
[
i
].
id
==
formData
.
unitId
)
{
basicUnit
=
unitArr
[
i
].
basicUnit
otherUnit
=
unitArr
[
i
].
otherUnit
if
(
unitArr
[
i
].
otherUnitTwo
)
{
otherUnitTwo
=
unitArr
[
i
].
otherUnitTwo
}
if
(
unitArr
[
i
].
otherUnitThree
)
{
otherUnitThree
=
unitArr
[
i
].
otherUnitThree
}
}
}
}
let
manyUnitInfo
=
manyUnitselected
.
substring
(
0
,
manyUnitselected
.
indexOf
(
"
(
"
));
let
unitArr
=
manyUnitInfo
.
split
(
"
,
"
);
if
(
!
formData
.
unit
)
{
//此时为多单位
if
(
formData
.
meList
.
length
<
2
){
this
.
$message
.
warning
(
'
多单位的商品条码行数至少要有两行,请再新增一行条码信息!
'
);
return
;
}
if
(
formData
.
meList
[
0
].
commodityUnit
!=
unitArr
[
0
]
)
{
if
(
formData
.
meList
[
0
].
commodityUnit
!=
basicUnit
)
{
this
.
$message
.
warning
(
'
条码之后的单位填写有误,单位【
'
+
formData
.
meList
[
0
].
commodityUnit
+
'
】请修改为【
'
+
unitArr
[
0
]
+
'
】!
'
);
+
'
】请修改为【
'
+
basicUnit
+
'
】!
'
);
return
;
}
if
(
formData
.
meList
[
1
].
commodityUnit
!=
unitArr
[
1
]
)
{
if
(
formData
.
meList
[
1
].
commodityUnit
!=
otherUnit
)
{
this
.
$message
.
warning
(
'
条码之后的单位填写有误,单位【
'
+
formData
.
meList
[
1
].
commodityUnit
+
'
】请修改为【
'
+
unitArr
[
1
]
+
'
】!
'
);
+
'
】请修改为【
'
+
otherUnit
+
'
】!
'
);
return
;
}
}
...
...
@@ -625,10 +631,10 @@
+
formData
.
unit
+
'
】!
'
);
return
;
}
}
else
if
(
manyUnitselecte
d
)
{
if
(
commodityUnit
!=
unitArr
[
0
]
&&
commodityUnit
!=
unitArr
[
1
]
)
{
}
else
if
(
formData
.
unitI
d
)
{
if
(
commodityUnit
!=
basicUnit
&&
commodityUnit
!=
otherUnit
&&
commodityUnit
!=
otherUnitTwo
&&
commodityUnit
!=
otherUnitThree
)
{
this
.
$message
.
warning
(
'
条码之后的单位填写有误,单位【
'
+
commodityUnit
+
'
】请修改为【
'
+
unitArr
[
0
]
+
'
】或【
'
+
unitArr
[
1
]
+
'
】!
'
);
+
basicUnit
+
'
】或【
'
+
otherUnit
+
'
】或【
'
+
otherUnitTwo
+
'
】或【
'
+
otherUnitThree
+
'
】!
'
);
return
;
}
}
...
...
@@ -810,12 +816,20 @@
//修改商品明细中的价格触发计算
changeDecimalByValue
(
row
)
{
let
unitArr
=
this
.
unitList
let
basicUnit
=
''
,
otherUnit
=
''
,
ratio
=
1
let
basicUnit
=
''
,
otherUnit
=
''
,
ratio
=
1
,
otherUnitTwo
=
''
,
ratioTwo
=
1
,
otherUnitThree
=
''
,
ratioThree
=
1
for
(
let
i
=
0
;
i
<
unitArr
.
length
;
i
++
)
{
if
(
unitArr
[
i
].
id
===
this
.
form
.
getFieldValue
(
'
unitId
'
))
{
basicUnit
=
unitArr
[
i
].
basicUnit
otherUnit
=
unitArr
[
i
].
otherUnit
ratio
=
unitArr
[
i
].
ratio
if
(
unitArr
[
i
].
otherUnitTwo
)
{
otherUnitTwo
=
unitArr
[
i
].
otherUnitTwo
ratioTwo
=
unitArr
[
i
].
ratioTwo
}
if
(
unitArr
[
i
].
otherUnitThree
)
{
otherUnitThree
=
unitArr
[
i
].
otherUnitThree
ratioThree
=
unitArr
[
i
].
ratioThree
}
}
}
if
(
row
.
commodityUnit
===
basicUnit
)
{
...
...
@@ -829,10 +843,23 @@
basicWholesaleDecimal
=
mInfo
.
wholesaleDecimal
basicLowDecimal
=
mInfo
.
lowDecimal
}
else
{
//副单位进行换算
if
(
basicPurchaseDecimal
)
{
mInfo
.
purchaseDecimal
=
basicPurchaseDecimal
*
ratio
}
if
(
basicCommodityDecimal
)
{
mInfo
.
commodityDecimal
=
basicCommodityDecimal
*
ratio
}
if
(
basicWholesaleDecimal
)
{
mInfo
.
wholesaleDecimal
=
basicWholesaleDecimal
*
ratio
}
if
(
basicLowDecimal
)
{
mInfo
.
lowDecimal
=
basicLowDecimal
*
ratio
}
if
(
otherUnitTwo
&&
i
===
2
)
{
if
(
basicPurchaseDecimal
)
{
mInfo
.
purchaseDecimal
=
basicPurchaseDecimal
*
ratioTwo
}
if
(
basicCommodityDecimal
)
{
mInfo
.
commodityDecimal
=
basicCommodityDecimal
*
ratioTwo
}
if
(
basicWholesaleDecimal
)
{
mInfo
.
wholesaleDecimal
=
basicWholesaleDecimal
*
ratioTwo
}
if
(
basicLowDecimal
)
{
mInfo
.
lowDecimal
=
basicLowDecimal
*
ratioTwo
}
}
if
(
otherUnitThree
&&
i
===
3
)
{
if
(
basicPurchaseDecimal
)
{
mInfo
.
purchaseDecimal
=
basicPurchaseDecimal
*
ratioThree
}
if
(
basicCommodityDecimal
)
{
mInfo
.
commodityDecimal
=
basicCommodityDecimal
*
ratioThree
}
if
(
basicWholesaleDecimal
)
{
mInfo
.
wholesaleDecimal
=
basicWholesaleDecimal
*
ratioThree
}
if
(
basicLowDecimal
)
{
mInfo
.
lowDecimal
=
basicLowDecimal
*
ratioThree
}
}
}
}
this
.
meTable
.
dataSource
=
mArr
...
...
@@ -949,12 +976,20 @@
},
manyUnitOnChange
(
value
)
{
let
unitArr
=
this
.
unitList
let
basicUnit
=
''
,
otherUnit
=
''
,
ratio
=
1
let
basicUnit
=
''
,
otherUnit
=
''
,
ratio
=
1
,
otherUnitTwo
=
''
,
ratioTwo
=
1
,
otherUnitThree
=
''
,
ratioThree
=
1
for
(
let
i
=
0
;
i
<
unitArr
.
length
;
i
++
)
{
if
(
unitArr
[
i
].
id
===
value
)
{
basicUnit
=
unitArr
[
i
].
basicUnit
otherUnit
=
unitArr
[
i
].
otherUnit
ratio
=
unitArr
[
i
].
ratio
if
(
unitArr
[
i
].
otherUnitTwo
)
{
otherUnitTwo
=
unitArr
[
i
].
otherUnitTwo
ratioTwo
=
unitArr
[
i
].
ratioTwo
}
if
(
unitArr
[
i
].
otherUnitThree
)
{
otherUnitThree
=
unitArr
[
i
].
otherUnitThree
ratioThree
=
unitArr
[
i
].
ratioThree
}
}
}
this
.
$refs
.
editableMeTable
.
getValues
((
error
,
values
)
=>
{
...
...
@@ -968,11 +1003,26 @@
basicWholesaleDecimal
=
mInfo
.
wholesaleDecimal
basicLowDecimal
=
mInfo
.
lowDecimal
}
else
{
//副单位进行换算
mInfo
.
commodityUnit
=
otherUnit
if
(
basicPurchaseDecimal
)
{
mInfo
.
purchaseDecimal
=
basicPurchaseDecimal
*
ratio
}
if
(
basicCommodityDecimal
)
{
mInfo
.
commodityDecimal
=
basicCommodityDecimal
*
ratio
}
if
(
basicWholesaleDecimal
)
{
mInfo
.
wholesaleDecimal
=
basicWholesaleDecimal
*
ratio
}
if
(
basicLowDecimal
)
{
mInfo
.
lowDecimal
=
basicLowDecimal
*
ratio
}
if
(
otherUnitTwo
&&
i
===
2
)
{
mInfo
.
commodityUnit
=
otherUnitTwo
if
(
basicPurchaseDecimal
)
{
mInfo
.
purchaseDecimal
=
basicPurchaseDecimal
*
ratioTwo
}
if
(
basicCommodityDecimal
)
{
mInfo
.
commodityDecimal
=
basicCommodityDecimal
*
ratioTwo
}
if
(
basicWholesaleDecimal
)
{
mInfo
.
wholesaleDecimal
=
basicWholesaleDecimal
*
ratioTwo
}
if
(
basicLowDecimal
)
{
mInfo
.
lowDecimal
=
basicLowDecimal
*
ratioTwo
}
}
if
(
otherUnitThree
&&
i
===
3
)
{
mInfo
.
commodityUnit
=
otherUnitThree
if
(
basicPurchaseDecimal
)
{
mInfo
.
purchaseDecimal
=
basicPurchaseDecimal
*
ratioThree
}
if
(
basicCommodityDecimal
)
{
mInfo
.
commodityDecimal
=
basicCommodityDecimal
*
ratioThree
}
if
(
basicWholesaleDecimal
)
{
mInfo
.
wholesaleDecimal
=
basicWholesaleDecimal
*
ratioThree
}
if
(
basicLowDecimal
)
{
mInfo
.
lowDecimal
=
basicLowDecimal
*
ratioThree
}
}
}
}
this
.
meTable
.
dataSource
=
mArr
...
...
jshERP-web/src/views/system/UnitList.vue
View file @
5df31c1e
...
...
@@ -98,10 +98,33 @@
return
parseInt
(
index
)
+
1
;
}
},
{
title
:
'
计量单位
'
,
align
:
"
center
"
,
dataIndex
:
'
name
'
,
width
:
1
0
0
},
{
title
:
'
计量单位
'
,
align
:
"
center
"
,
dataIndex
:
'
name
'
,
width
:
1
5
0
},
{
title
:
'
基本单位
'
,
align
:
"
center
"
,
dataIndex
:
'
basicUnit
'
,
width
:
100
},
{
title
:
'
副单位
'
,
align
:
"
center
"
,
dataIndex
:
'
otherUnit
'
,
width
:
100
},
{
title
:
'
比例
'
,
align
:
"
center
"
,
dataIndex
:
'
ratio
'
,
width
:
100
},
{
title
:
'
副单位
'
,
align
:
"
center
"
,
dataIndex
:
'
otherUnit
'
,
width
:
100
,
customRender
:
function
(
t
,
r
,
index
)
{
if
(
r
)
{
return
r
.
otherUnit
+
'
=
'
+
r
.
ratio
+
r
.
basicUnit
;
}
}
},
{
title
:
'
副单位2
'
,
align
:
"
center
"
,
dataIndex
:
'
otherUnitTwo
'
,
width
:
100
,
customRender
:
function
(
t
,
r
,
index
)
{
if
(
r
)
{
if
(
r
.
otherUnitTwo
)
{
return
r
.
otherUnitTwo
+
'
=
'
+
r
.
ratioTwo
+
r
.
basicUnit
;
}
}
}
},
{
title
:
'
副单位3
'
,
align
:
"
center
"
,
dataIndex
:
'
otherUnitThree
'
,
width
:
100
,
customRender
:
function
(
t
,
r
,
index
)
{
if
(
r
)
{
if
(
r
.
otherUnitThree
)
{
return
r
.
otherUnitThree
+
'
=
'
+
r
.
ratioThree
+
r
.
basicUnit
;
}
}
}
},
{
title
:
'
操作
'
,
dataIndex
:
'
action
'
,
...
...
jshERP-web/src/views/system/modules/UnitModal.vue
View file @
5df31c1e
<
template
>
<a-modal
:title=
"title"
:width=
"
8
00"
:width=
"
7
00"
:visible=
"visible"
:confirmLoading=
"confirmLoading"
@
ok=
"handleOk"
@
cancel=
"handleCancel"
cancelText=
"关闭"
wrapClassName=
"ant-modal-cust-warp"
style=
"top:25%;height:
50%;overflow-y:
hidden"
>
style=
"top:25%;
height:50%;
overflow-y:hidden"
>
<template
slot=
"footer"
>
<a-button
key=
"back"
v-if=
"isReadOnly"
@
click=
"handleCancel"
>
关闭
...
...
@@ -22,12 +22,23 @@
</a-form>
<a-form
:form=
"form"
>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"副单位"
>
<a-input
placeholder=
"请输入副单位(大单位)"
v-decorator.trim=
"[ 'otherUnit', validatorRules.otherUnit]"
/>
<a-input
placeholder=
"请输入副单位(大单位)"
style=
"width:48%"
v-decorator.trim=
"[ 'otherUnit' ]"
/>
=
<a-input
suffix=
"基本单位"
placeholder=
"请输入比例"
style=
"width:48%"
v-decorator.trim=
"[ 'ratio' ]"
/>
</a-form-item>
</a-form>
<a-form
:form=
"form"
>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"比例"
>
<a-input
addon-before=
"基本单位 : 副单位=1 :"
placeholder=
"请输入比例"
v-decorator.trim=
"[ 'ratio', validatorRules.ratio]"
/>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"副单位2"
>
<a-input
placeholder=
"请输入副单位2(大单位)"
style=
"width:48%"
v-decorator.trim=
"[ 'otherUnitTwo' ]"
/>
=
<a-input
suffix=
"基本单位"
placeholder=
"请输入比例2"
style=
"width:48%"
v-decorator.trim=
"[ 'ratioTwo' ]"
/>
</a-form-item>
</a-form>
<a-form
:form=
"form"
>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"副单位3"
>
<a-input
placeholder=
"请输入副单位3(大单位)"
style=
"width:48%"
v-decorator.trim=
"[ 'otherUnitThree' ]"
/>
=
<a-input
suffix=
"基本单位"
placeholder=
"请输入比例3"
style=
"width:48%"
v-decorator.trim=
"[ 'ratioThree' ]"
/>
</a-form-item>
</a-form>
</a-spin>
...
...
@@ -85,7 +96,7 @@
this
.
model
=
Object
.
assign
({},
record
);
this
.
visible
=
true
;
this
.
$nextTick
(()
=>
{
this
.
form
.
setFieldsValue
(
pick
(
this
.
model
,
'
basicUnit
'
,
'
otherUnit
'
,
'
ratio
'
))
this
.
form
.
setFieldsValue
(
pick
(
this
.
model
,
'
basicUnit
'
,
'
otherUnit
'
,
'
ratio
'
,
'
otherUnitTwo
'
,
'
ratioTwo
'
,
'
otherUnitThree
'
,
'
ratioThree
'
))
autoJumpNextInput
(
'
unitModal
'
)
});
},
...
...
@@ -100,27 +111,57 @@
if
(
!
err
)
{
that
.
confirmLoading
=
true
;
let
formData
=
Object
.
assign
(
this
.
model
,
values
);
if
(
!
formData
.
otherUnit
)
{
that
.
$message
.
warning
(
'
抱歉,副单位不能为空!
'
);
that
.
confirmLoading
=
false
;
return
;
}
if
(
!
formData
.
ratio
)
{
that
.
$message
.
warning
(
'
抱歉,此时比例不能为空!
'
);
that
.
confirmLoading
=
false
;
return
;
}
if
(
formData
.
otherUnitTwo
&&
!
formData
.
ratioTwo
)
{
that
.
$message
.
warning
(
'
抱歉,此时比例2不能为空!
'
);
that
.
confirmLoading
=
false
;
return
;
}
if
(
formData
.
otherUnitThree
&&
!
formData
.
ratioThree
)
{
that
.
$message
.
warning
(
'
抱歉,此时比例3不能为空!
'
);
that
.
confirmLoading
=
false
;
return
;
}
if
(
formData
.
basicUnit
===
formData
.
otherUnit
)
{
that
.
$message
.
warning
(
'
抱歉,基本单位与副单位不能相同!
'
);
that
.
confirmLoading
=
false
;
}
else
{
let
obj
;
if
(
!
this
.
model
.
id
){
obj
=
addUnit
(
formData
);
return
;
}
if
(
formData
.
basicUnit
===
formData
.
otherUnitTwo
)
{
that
.
$message
.
warning
(
'
抱歉,基本单位与副单位2不能相同!
'
);
that
.
confirmLoading
=
false
;
return
;
}
if
(
formData
.
basicUnit
===
formData
.
otherUnitThree
)
{
that
.
$message
.
warning
(
'
抱歉,基本单位与副单位3不能相同!
'
);
that
.
confirmLoading
=
false
;
return
;
}
let
obj
;
if
(
!
this
.
model
.
id
){
obj
=
addUnit
(
formData
);
}
else
{
obj
=
editUnit
(
formData
);
}
obj
.
then
((
res
)
=>
{
if
(
res
.
code
===
200
){
that
.
$emit
(
'
ok
'
);
}
else
{
obj
=
editUnit
(
formData
);
that
.
$message
.
warning
(
res
.
data
.
message
);
}
obj
.
then
((
res
)
=>
{
if
(
res
.
code
===
200
){
that
.
$emit
(
'
ok
'
);
}
else
{
that
.
$message
.
warning
(
res
.
data
.
message
);
}
}).
finally
(()
=>
{
that
.
confirmLoading
=
false
;
that
.
close
();
})
}
}).
finally
(()
=>
{
that
.
confirmLoading
=
false
;
that
.
close
();
})
}
})
},
...
...
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