Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
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
陈智峰
jinfa-platform
Commits
f7678690
Commit
f7678690
authored
Feb 19, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复商品可以重复选择的问题
parent
9a13a004
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
useBusinessEffects.ts
.../bills/components/BillsForm/effects/useBusinessEffects.ts
+12
-3
No files found.
src/pages/transaction/stockSellStorage/bills/components/BillsForm/effects/useBusinessEffects.ts
View file @
f7678690
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-0
1-26 19:31:37
* @LastEditTime: 2021-0
2-19 17:42:55
* @Description: 联动逻辑相关
*/
import
{
Modal
}
from
'antd'
;
...
...
@@ -317,6 +317,7 @@ export const useBusinessEffects = (context, actions) => {
// 关联单据改变
onFieldValueChange$
(
'orderNo'
).
subscribe
(
fieldState
=>
{
const
invoicesTypeIdVal
=
getFieldValue
(
'invoicesTypeId'
);
const
invoicesDetailsRequestsValue
=
getFieldValue
(
'invoicesDetailsRequests'
);
const
first
=
fieldState
.
value
&&
fieldState
.
value
[
0
];
// 设置单据公用的数据相关
...
...
@@ -352,6 +353,7 @@ export const useBusinessEffects = (context, actions) => {
const
goodOptions
=
res
.
data
.
map
(
item
=>
({
label
:
item
.
productName
,
value
:
item
.
id
,
disabled
:
!!
invoicesDetailsRequestsValue
.
find
(
val
=>
val
.
product
===
item
.
id
),
}));
setFieldState
(
'invoicesDetailsRequests.*.product'
,
state
=>
{
FormPath
.
setIn
(
state
,
'originAsyncData'
,
res
.
data
);
...
...
@@ -381,6 +383,7 @@ export const useBusinessEffects = (context, actions) => {
const
goodOptions
=
details
.
map
(
item
=>
({
label
:
`
${
item
.
productName
}${
item
.
orderNo
?
'---'
+
item
.
orderNo
:
''
}
`
,
value
:
item
.
id
,
disabled
:
!!
invoicesDetailsRequestsValue
.
find
(
val
=>
val
.
product
===
item
.
id
),
}));
setFieldState
(
'invoicesDetailsRequests.*.product'
,
state
=>
{
FormPath
.
setIn
(
state
,
'originAsyncData'
,
details
.
map
(
item
=>
({
...
...
@@ -414,6 +417,7 @@ export const useBusinessEffects = (context, actions) => {
const
goodOptions
=
details
.
map
(
item
=>
({
label
:
`
${
item
.
productName
}${
item
.
orderNo
?
'---订单号:'
+
item
.
orderNo
:
''
}
`
,
value
:
item
.
id
,
disabled
:
!!
invoicesDetailsRequestsValue
.
find
(
val
=>
val
.
product
===
item
.
id
),
}));
setFieldState
(
'invoicesDetailsRequests.*.product'
,
state
=>
{
FormPath
.
setIn
(
state
,
'originAsyncData'
,
details
);
...
...
@@ -450,6 +454,7 @@ export const useBusinessEffects = (context, actions) => {
const
goodOptions
=
data
.
map
(
item
=>
({
label
:
`
${
item
.
productName
}
---订单号:
${
item
.
orderNo
}
`
,
value
:
item
.
orderRecordId
,
disabled
:
!!
invoicesDetailsRequestsValue
.
find
(
val
=>
val
.
product
===
item
.
orderRecordId
),
}));
setFieldState
(
'invoicesDetailsRequests.*.product'
,
state
=>
{
FormPath
.
setIn
(
state
,
'originAsyncData'
,
data
.
map
(
item
=>
({
...
...
@@ -486,6 +491,7 @@ export const useBusinessEffects = (context, actions) => {
const
goodOptions
=
data
.
map
(
item
=>
({
label
:
`
${
item
.
productName
}
---订单号:
${
item
.
orderNo
}
`
,
value
:
item
.
orderRecordId
,
disabled
:
!!
invoicesDetailsRequestsValue
.
find
(
val
=>
val
.
product
===
item
.
orderRecordId
),
}));
setFieldState
(
'invoicesDetailsRequests.*.product'
,
state
=>
{
FormPath
.
setIn
(
state
,
'originAsyncData'
,
data
.
map
(
item
=>
({
...
...
@@ -523,11 +529,15 @@ export const useBusinessEffects = (context, actions) => {
setFieldValue
(
'transport'
,
''
);
setFieldValue
(
'deliveryType'
,
null
);
}
// 已选的数据需要禁用掉,不可以重复选择
setFieldState
(
'invoicesDetailsRequests.*.product'
,
state
=>
{
state
.
props
.
enum
=
state
.
props
.
enum
.
map
((
item
)
=>
({...
item
,
disabled
:
!!
value
.
find
(
val
=>
val
.
product
===
item
.
value
)}));
});
});
// 关联明细 商品下拉框 联动商品ID、单价
onFieldInputChange$
(
'invoicesDetailsRequests.*.product'
).
subscribe
(
fieldState
=>
{
const
{
name
,
originAsyncData
,
value
}
=
fieldState
;
const
{
name
,
originAsyncData
,
value
,
props
}
=
fieldState
;
const
current
=
originAsyncData
.
find
(
item
=>
item
.
id
===
value
);
const
invoicesTypeIdVal
=
getFieldValue
(
'invoicesTypeId'
);
...
...
@@ -767,7 +777,6 @@ export const useBusinessEffects = (context, actions) => {
};
}
);
});
// 关联明细 商品数量 联动计算商品金额
...
...
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