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
cad56126
Commit
cad56126
authored
Nov 09, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 处理调整仓位后切换切换无法实时更新库存问题
parent
10bc76c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
adjustRepository.tsx
src/pages/repositories/adjustRepository.tsx
+10
-6
index.tsx
src/pages/repositories/schema/index.tsx
+4
-1
index.tsx
...Order/orderCollect/components/productModalTable/index.tsx
+2
-0
No files found.
src/pages/repositories/adjustRepository.tsx
View file @
cad56126
...
@@ -34,7 +34,8 @@ const AddRepository:React.FC<{}> = (props) => {
...
@@ -34,7 +34,8 @@ const AddRepository:React.FC<{}> = (props) => {
const
[
forceRender
,
setForceRender
]
=
useState
(
0
)
const
[
forceRender
,
setForceRender
]
=
useState
(
0
)
// 获取到的所有仓库, 用于选中后获得仓库库存
// 获取到的所有仓库, 用于选中后获得仓库库存
const
[
reposits
,
setReposits
]
=
useState
<
any
>
([])
// const [reposits, setReposits] = useState<any>([])
const
reposits
=
useRef
<
any
>
([])
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
)
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
)
const
{
data
:
foldValue
,
loading
:
foldLoading
,
run
:
foldFn
}
=
useHttpRequest
(
PublicApi
.
postWarehouseFreightSpaceAllotFold
)
const
{
data
:
foldValue
,
loading
:
foldLoading
,
run
:
foldFn
}
=
useHttpRequest
(
PublicApi
.
postWarehouseFreightSpaceAllotFold
)
...
@@ -59,7 +60,8 @@ const AddRepository:React.FC<{}> = (props) => {
...
@@ -59,7 +60,8 @@ const AddRepository:React.FC<{}> = (props) => {
productId
:
initValue
.
productId
productId
:
initValue
.
productId
}).
then
(({
data
,
code
})
=>
{
}).
then
(({
data
,
code
})
=>
{
if
(
code
===
1000
)
{
if
(
code
===
1000
)
{
setReposits
(
data
)
// setReposits(data)
reposits
.
current
=
data
}
}
})
})
}
}
...
@@ -231,13 +233,13 @@ const AddRepository:React.FC<{}> = (props) => {
...
@@ -231,13 +233,13 @@ const AddRepository:React.FC<{}> = (props) => {
//
})
//
})
FormEffectHooks
.
onFormMount$
().
subscribe
(()
=>
{
FormEffectHooks
.
onFormMount$
().
subscribe
(()
=>
{
const
name
=
spyForm
.
getFieldValue
(
'name'
)
const
name
=
spyForm
.
getFieldValue
(
'name'
)
const
asyncEnums
=
reposits
.
map
(
v
=>
({
const
asyncEnums
=
reposits
.
current
.
map
(
v
=>
({
label
:
v
.
name
,
label
:
v
.
name
,
value
:
v
.
id
value
:
v
.
id
}))
}))
utils
.
enum
(
'freightSpaceId'
,
asyncEnums
)
utils
.
enum
(
'freightSpaceId'
,
asyncEnums
)
$
(
'onFieldInputChange'
,
'freightSpaceId'
).
subscribe
(
state
=>
{
$
(
'onFieldInputChange'
,
'freightSpaceId'
).
subscribe
(
state
=>
{
const
repositValue
=
reposits
.
find
(
v
=>
v
.
id
===
state
.
value
)
const
repositValue
=
reposits
.
current
.
find
(
v
=>
v
.
id
===
state
.
value
)
const
numberValue
=
repositValue
.
inventory
||
0
const
numberValue
=
repositValue
.
inventory
||
0
utils
.
value
(
'NO_SUBMIT1'
,
numberValue
)
utils
.
value
(
'NO_SUBMIT1'
,
numberValue
)
setFieldState
(
'NO_SUBMIT1'
,
state
=>
{
setFieldState
(
'NO_SUBMIT1'
,
state
=>
{
...
@@ -247,6 +249,7 @@ const AddRepository:React.FC<{}> = (props) => {
...
@@ -247,6 +249,7 @@ const AddRepository:React.FC<{}> = (props) => {
state
.
props
[
"x-component-props"
].
max
=
numberValue
state
.
props
[
"x-component-props"
].
max
=
numberValue
state
.
props
[
"x-component-props"
].
marks
=
getStepNumber
(
numberValue
)
state
.
props
[
"x-component-props"
].
marks
=
getStepNumber
(
numberValue
)
})
})
setForceRender
(
forceRender
+
1
)
})
})
// 调入仓位信息
// 调入仓位信息
utils
.
enum
(
'foldFreightSpaceId'
,
[
utils
.
enum
(
'foldFreightSpaceId'
,
[
...
@@ -287,18 +290,19 @@ const AddRepository:React.FC<{}> = (props) => {
...
@@ -287,18 +290,19 @@ const AddRepository:React.FC<{}> = (props) => {
console
.
log
(
'mount'
)
console
.
log
(
'mount'
)
const
name
=
spyForm
.
getFieldValue
(
'name'
)
const
name
=
spyForm
.
getFieldValue
(
'name'
)
const
inventoryNumber
=
spyForm
.
getFieldValue
(
'inventory'
)
const
inventoryNumber
=
spyForm
.
getFieldValue
(
'inventory'
)
const
asyncEnums
=
reposits
.
map
(
v
=>
({
const
asyncEnums
=
reposits
.
current
.
map
(
v
=>
({
label
:
v
.
name
,
label
:
v
.
name
,
value
:
v
.
id
value
:
v
.
id
}))
}))
utils
.
enum
(
'foldFreightSpaceId'
,
asyncEnums
)
utils
.
enum
(
'foldFreightSpaceId'
,
asyncEnums
)
$
(
'onFieldInputChange'
,
'foldFreightSpaceId'
).
subscribe
(
state
=>
{
$
(
'onFieldInputChange'
,
'foldFreightSpaceId'
).
subscribe
(
state
=>
{
const
repositValue
=
reposits
.
find
(
v
=>
v
.
id
===
state
.
value
)
const
repositValue
=
reposits
.
current
.
find
(
v
=>
v
.
id
===
state
.
value
)
const
numberValue
=
repositValue
.
inventory
||
0
const
numberValue
=
repositValue
.
inventory
||
0
utils
.
value
(
'NO_SUBMIT2'
,
numberValue
)
utils
.
value
(
'NO_SUBMIT2'
,
numberValue
)
setFieldState
(
'NO_SUBMIT2'
,
state
=>
{
setFieldState
(
'NO_SUBMIT2'
,
state
=>
{
state
.
props
.
title
=
`当前仓位库存(${repositValue.unit})`
state
.
props
.
title
=
`当前仓位库存(${repositValue.unit})`
})
})
setForceRender
(
forceRender
+
1
)
})
})
setFieldState
(
'foldInventory'
,
state
=>
{
setFieldState
(
'foldInventory'
,
state
=>
{
state
.
props
[
"x-component-props"
].
max
=
initValue
.
inventory
state
.
props
[
"x-component-props"
].
max
=
initValue
.
inventory
...
...
src/pages/repositories/schema/index.tsx
View file @
cad56126
...
@@ -608,7 +608,10 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
...
@@ -608,7 +608,10 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
type
:
'string'
,
type
:
'string'
,
enum
:
getShopTypeMap
,
enum
:
getShopTypeMap
,
title
:
'商城类型'
,
title
:
'商城类型'
,
required
:
true
required
:
true
,
"x-component-props"
:
{
disabled
:
true
}
},
},
productName
:
{
productName
:
{
type
:
'string'
,
type
:
'string'
,
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/productModalTable/index.tsx
View file @
cad56126
...
@@ -161,6 +161,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
...
@@ -161,6 +161,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
}
}
return
fetchOrderApi
.
getProductList
(
params
)
return
fetchOrderApi
.
getProductList
(
params
)
}
}
return
(
return
(
<
ModalTable
<
ModalTable
modalTitle=
'选择订单商品'
modalTitle=
'选择订单商品'
...
@@ -171,6 +172,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
...
@@ -171,6 +172,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
cancel=
{
()
=>
setVisible
(
false
)
}
cancel=
{
()
=>
setVisible
(
false
)
}
fetchTableData=
{
fetchProductList
}
fetchTableData=
{
fetchProductList
}
rowSelection=
{
rowSelection
}
rowSelection=
{
rowSelection
}
resetModal=
{
{
destroyOnClose
:
true
,
forceRender
:
true
}
}
modalType=
'productByDefault'
modalType=
'productByDefault'
tableProps=
{
{
tableProps=
{
{
rowKey
:
'id'
,
rowKey
:
'id'
,
...
...
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