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
cd338a80
Commit
cd338a80
authored
Aug 10, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复无法勾选父级的问题
parent
3434c348
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
39 deletions
+44
-39
index.tsx
src/pages/afterService/components/GoodsDrawer/index.tsx
+44
-39
No files found.
src/pages/afterService/components/GoodsDrawer/index.tsx
View file @
cd338a80
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-
09 16:39:07
* @LastEditTime: 2021-08-
10 11:29:44
* @Description: 维修商品抽屉组件
*/
import
React
from
'react'
;
...
...
@@ -179,45 +179,50 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
}
this
.
setState
({
loading
:
true
});
const
orderListRes
=
await
fetchOrderList
({
current
:
`
${
page
}
`
,
pageSize
:
`
${
size
}
`
,
...
searchVal
,
});
if
(
orderListRes
)
{
const
{
data
,
...
rest
}
=
orderListRes
;
const
newData
:
{
[
key
:
string
]:
any
}[]
=
data
.
map
((
item
)
=>
({
...
item
,
products
:
item
.
products
.
map
(({
productId
,
...
rest
})
=>
({
id
:
productId
,
...
rest
,
quantity
:
+
rest
.
quantity
,
purchasePrice
:
+
rest
.
purchasePrice
,
tax
:
rest
.
tax
?
1
:
0
,
taxRate
:
+
rest
.
taxRate
,
orderNo
:
item
.
orderNo
,
orderId
:
item
.
orderId
,
payInfoList
:
item
.
payInfoList
,
orderType
:
item
.
orderType
,
contractId
:
item
.
contractId
,
contractNo
:
item
.
contractNo
,
})),
}));
newData
.
forEach
((
item
)
=>
{
item
.
products
.
forEach
((
product
)
=>
{
// 防止重复添加数据
if
(
!
this
.
flattened
.
find
(
flat
=>
flat
.
id
===
product
.
id
))
{
this
.
flattened
.
push
(
product
);
}
});
});
this
.
setState
({
dataSource
:
{
data
:
newData
,
...
rest
,
},
try
{
const
orderListRes
=
await
fetchOrderList
({
current
:
`
${
page
}
`
,
pageSize
:
`
${
size
}
`
,
...
searchVal
,
});
if
(
orderListRes
)
{
const
{
data
,
...
rest
}
=
orderListRes
;
const
newData
:
{
[
key
:
string
]:
any
}[]
=
data
.
map
((
item
)
=>
({
...
item
,
id
:
item
.
orderId
,
products
:
item
.
products
.
map
(({
productId
,
...
rest
})
=>
({
id
:
productId
,
...
rest
,
quantity
:
+
rest
.
quantity
,
purchasePrice
:
+
rest
.
purchasePrice
,
tax
:
rest
.
tax
?
1
:
0
,
taxRate
:
+
rest
.
taxRate
,
orderNo
:
item
.
orderNo
,
orderId
:
item
.
orderId
,
payInfoList
:
item
.
payInfoList
,
orderType
:
item
.
orderType
,
contractId
:
item
.
contractId
,
contractNo
:
item
.
contractNo
,
})),
}));
newData
.
forEach
((
item
)
=>
{
item
.
products
.
forEach
((
product
)
=>
{
// 防止重复添加数据
if
(
!
this
.
flattened
.
find
(
flat
=>
flat
.
id
===
product
.
id
))
{
this
.
flattened
.
push
(
product
);
}
});
});
this
.
setState
({
dataSource
:
{
data
:
newData
,
...
rest
,
},
});
}
}
catch
(
error
)
{
console
.
warn
(
'error'
,
error
);
}
this
.
setState
({
loading
:
false
});
};
...
...
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