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
shenshaokai
jinfa-platform
Commits
232a718a
Commit
232a718a
authored
May 10, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复分页之后点击确认无法拿到上一页填写的数据问题
parent
d20c3a2e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
6 deletions
+34
-6
index.tsx
...orderCollectSrm/components/orderMaterialsDrawer/index.tsx
+34
-6
No files found.
src/pages/transaction/purchaseOrder/orderCollectSrm/components/orderMaterialsDrawer/index.tsx
View file @
232a718a
...
@@ -96,6 +96,11 @@ type MaterialsListItem = Omit<GetContractManagePagePurchaseMaterielListResponseD
...
@@ -96,6 +96,11 @@ type MaterialsListItem = Omit<GetContractManagePagePurchaseMaterielListResponseD
children
:
RequisitionListItem
[],
children
:
RequisitionListItem
[],
}
}
export
type
FetchReponseType
=
{
data
:
MaterialsListItem
[],
totalCount
:
number
,
}
const
normalizeMaterialsList
=
(
dataSource
:
GetContractManagePagePurchaseMaterielListResponseDetail
[]):
MaterialsListItem
[]
=>
{
const
normalizeMaterialsList
=
(
dataSource
:
GetContractManagePagePurchaseMaterielListResponseDetail
[]):
MaterialsListItem
[]
=>
{
const
ret
:
MaterialsListItem
[]
=
[];
const
ret
:
MaterialsListItem
[]
=
[];
dataSource
.
forEach
(({
requisitionList
,
...
rest
})
=>
{
dataSource
.
forEach
(({
requisitionList
,
...
rest
})
=>
{
...
@@ -127,6 +132,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
@@ -127,6 +132,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
const
keyEntities
=
useRef
<
any
>
({});
const
keyEntities
=
useRef
<
any
>
({});
const
requisitionListValue
=
useRef
<
OrderMaterialsSubmitValue
[
'materials'
][
'requisitionList'
]
>
({});
const
[
form
]
=
Form
.
useForm
();
const
[
form
]
=
Form
.
useForm
();
const
intl
=
useIntl
();
const
intl
=
useIntl
();
...
@@ -222,7 +229,7 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
@@ -222,7 +229,7 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
const
{
levelMap
,
maxLevel
}
=
getLevelEntities
(
keyEntities
.
current
);
const
{
levelMap
,
maxLevel
}
=
getLevelEntities
(
keyEntities
.
current
);
if
(
selected
)
{
if
(
selected
)
{
const
keys
=
[...
checkedKeysState
,
...
selectedRows
.
map
((
item
)
=>
item
.
key
)];
const
keys
=
[...
checkedKeysState
,
...
selectedRows
.
filter
(
Boolean
).
map
((
item
)
=>
item
.
key
)];
const
{
halfCheckedKeys
,
checkedKeys
}
=
fillConductCheck
(
keys
,
levelMap
,
maxLevel
);
const
{
halfCheckedKeys
,
checkedKeys
}
=
fillConductCheck
(
keys
,
levelMap
,
maxLevel
);
setCheckedKeysState
(
checkedKeys
);
setCheckedKeysState
(
checkedKeys
);
setHalfCheckedState
(
halfCheckedKeys
);
setHalfCheckedState
(
halfCheckedKeys
);
...
@@ -323,7 +330,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
@@ -323,7 +330,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
const
{
materials
}
=
res
;
const
{
materials
}
=
res
;
const
ret
:
OrderMaterialsConfirmValue
=
[];
const
ret
:
OrderMaterialsConfirmValue
=
[];
const
checkedKeys
=
Object
.
keys
(
materials
.
requisitionList
);
// const checkedKeys = Object.keys(materials.requisitionList);
const
checkedKeys
=
Object
.
keys
(
requisitionListValue
.
current
);
for
(
let
i
=
0
;
i
<
checkedKeys
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
checkedKeys
.
length
;
i
++
)
{
const
checked
=
checkedKeys
[
i
];
const
checked
=
checkedKeys
[
i
];
const
{
parentNode
}
=
keyEntities
.
current
[
checked
];
const
{
parentNode
}
=
keyEntities
.
current
[
checked
];
...
@@ -338,7 +346,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
@@ -338,7 +346,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
restParent
,
...
restParent
,
requisitionList
:
children
.
map
((
item
)
=>
({
requisitionList
:
children
.
map
((
item
)
=>
({
...
item
,
...
item
,
orderQuantity
:
+
materials
.
requisitionList
[
checked
],
// orderQuantity: +materials.requisitionList[checked],
orderQuantity
:
+
requisitionListValue
.
current
[
checked
],
})),
})),
};
};
ret
.
push
(
material
);
ret
.
push
(
material
);
...
@@ -350,7 +359,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
@@ -350,7 +359,8 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...(
ret
[
index
]).
requisitionList
,
...(
ret
[
index
]).
requisitionList
,
...
children
.
map
((
item
)
=>
({
...
children
.
map
((
item
)
=>
({
...
item
,
...
item
,
orderQuantity
:
+
materials
.
requisitionList
[
checked
],
// orderQuantity: +materials.requisitionList[checked],
orderQuantity
:
+
requisitionListValue
.
current
[
checked
],
})),
})),
],
],
}));
}));
...
@@ -377,6 +387,23 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
@@ -377,6 +387,23 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
// });
// });
};
};
const
handleBeforePaginationChange
=
async
()
=>
{
try
{
await
form
.
validateFields
()
return
true
;
}
catch
(
error
)
{
return
false
;
}
};
const
handleFormValuesChange
=
(
_
,
allValues
:
OrderMaterialsSubmitValue
)
=>
{
const
{
materials
}
=
allValues
;
requisitionListValue
.
current
=
{
...
requisitionListValue
.
current
,
...(
materials
.
requisitionList
||
{}),
};
};
useImperativeHandle
(
ref
,
()
=>
({
useImperativeHandle
(
ref
,
()
=>
({
deleteItem
:
handleDelete
,
deleteItem
:
handleDelete
,
}));
}));
...
@@ -415,7 +442,7 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
@@ -415,7 +442,7 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
onSelect
:
handleSelectRow
,
onSelect
:
handleSelectRow
,
onSelectAll
:
handlehandleSelectAll
,
onSelectAll
:
handlehandleSelectAll
,
}
}
}
}
defaultPageSize=
{
2
0
}
defaultPageSize=
{
1
0
}
expandable=
{
isPurchaseOrderContract
?
{
expandable=
{
isPurchaseOrderContract
?
{
expandedRowRender
,
expandedRowRender
,
expandIcon
:
({
expanded
,
onExpand
,
record
})
=>
(
expandIcon
:
({
expanded
,
onExpand
,
record
})
=>
(
...
@@ -442,11 +469,12 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
...
@@ -442,11 +469,12 @@ const OrderMaterialsDrawer: React.ForwardRefRenderFunction<OrderMaterialsDrawerR
ref=
{
polymericRef
}
ref=
{
polymericRef
}
components=
{
{
components=
{
{
table
:
({
children
})
=>
(
table
:
({
children
})
=>
(
<
Form
form=
{
form
}
>
<
Form
form=
{
form
}
onValuesChange=
{
handleFormValuesChange
}
>
<
table
>
{
children
}
</
table
>
<
table
>
{
children
}
</
table
>
</
Form
>
</
Form
>
),
),
}
}
}
}
beforePaginationChange=
{
handleBeforePaginationChange
}
defaultExpandAllRows
defaultExpandAllRows
full
full
/>
/>
...
...
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