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
25129ac6
Commit
25129ac6
authored
Aug 12, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加新增单据逻辑
parent
dcb5e192
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
useBusinessEffects.ts
...ls/components/BillsFormPage/effects/useBusinessEffects.ts
+24
-3
No files found.
src/pages/transaction/stockSellStorage/bills/components/BillsFormPage/effects/useBusinessEffects.ts
View file @
25129ac6
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-04 14:43:14
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-
04 18:00:12
* @LastEditTime: 2021-08-
12 17:08:09
* @Description:
*/
import
{
FormEffectHooks
,
FormPath
,
IFormActions
}
from
'@formily/antd'
;
...
...
@@ -18,12 +18,32 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
const
linkage
=
useLinkageUtils
();
// 对应仓库改变
onFieldInputChange$
(
'inventoryId'
).
subscribe
(
fieldState
=>
{
onFieldInputChange$
(
'inventoryId'
).
subscribe
(
(
fieldState
)
=>
{
const
current
=
fieldState
.
originAsyncData
.
find
(
item
=>
item
.
id
===
fieldState
.
value
);
if
(
current
)
{
linkage
.
value
(
'inventoryRole'
,
current
.
principal
);
}
if
(
current
)
{
setFieldValue
(
'inventoryName'
,
current
.
name
);
}
});
// 相关单据明细 数量 改变计算相关 单据金额
onFieldInputChange$
(
'billDetails.*.count'
).
subscribe
((
fieldState
)
=>
{
const
{
name
,
value
}
=
fieldState
;
const
priceValue
=
getFieldValue
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`billDetails.
${
$1
}
.price`
})
);
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`billDetails.
${
$1
}
.amount`
}),
state
=>
{
state
.
value
=
value
?
+
`
${(
+
value
*
+
priceValue
).
toFixed
(
2
)}
`
:
undefined
;
}
);
});
}
\ No newline at end of file
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