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
1f404c81
Commit
1f404c81
authored
Feb 17, 2022
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改加工订单数据
parent
a4b90600
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
30 deletions
+43
-30
orderColumn.tsx
...ges/handling/assign/create/common/columns/orderColumn.tsx
+3
-2
index.tsx
src/pages/handling/assign/create/index.tsx
+40
-28
No files found.
src/pages/handling/assign/create/common/columns/orderColumn.tsx
View file @
1f404c81
...
...
@@ -61,12 +61,13 @@ export const orderProductColumns = [
},
{
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.assign.add.orderNum'
})}
`
,
dataIndex
:
'purchaseCount'
dataIndex
:
'purchaseCount'
,
render
:
(
text
,
record
)
=>
record
.
quantity
},
{
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.restProcessNum'
})}
`
,
dataIndex
:
'restNum'
,
render
:
(
text
,
record
)
=>
+
record
.
purchaseCount
-
(
+
record
.
processNum
||
0
)
render
:
(
text
,
record
)
=>
+
record
.
quantity
-
(
+
record
.
enhanceCount
||
0
)
},
{
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.hasProcessNm'
})}
`
,
...
...
src/pages/handling/assign/create/index.tsx
View file @
1f404c81
...
...
@@ -54,6 +54,11 @@ registerVirtualBox('MellowCardBox', (_props) => {
)
})
type
OrderProductType
=
GetOrderCommonEnhancePageResponseDetail
[
"products"
][
0
]
&
{
orderId
:
number
,
orderNo
:
string
}
/** @tofix 临时的,因为后端不返回只能值么临时搞着 */
const
MALL_NAME
=
{
"1"
:
intl
.
formatMessage
({
id
:
'handling.qiyeshangcheng'
}),
...
...
@@ -512,13 +517,16 @@ const Create = () => {
/** -------------- 加工商品相关结束 --------------- */
/** ------- 加工订单相关 -------*/
const
onSelectChange
=
async
(
record
:
GetOrderCommonEnhancePageResponseDetail
[
"products"
][
0
],
selected
:
boolean
,
selectedRows
)
=>
{
const
currentOrderData
=
fetchedOrderData
?.
filter
((
_item
)
=>
_item
.
id
===
record
.
orderId
)[
0
];
const
key
=
`
${
record
.
orderId
}
_
${
record
.
id
}
`
const
onSelectChange
=
async
(
record
:
OrderProductType
,
selected
:
boolean
,
selectedRows
)
=>
{
console
.
log
(
record
,
"fetchedOrderData"
,
fetchedOrderData
);
// 父级order 存储信息
const
currentOrderData
=
fetchedOrderData
?.
find
((
_item
)
=>
_item
.
orderId
===
record
.
orderId
)
console
.
log
(
"orderProductselectRowRecord"
,
orderProductselectRowRecord
,
"orderProductSelectRowKeys"
,
orderProductSelectRowKeys
,
"setProcessOrder"
,
processOrder
)
const
key
=
`
${
record
.
orderId
}
_
${
record
.
orderProductId
}
`
if
(
!
selected
)
{
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
filter
((
_row
)
=>
(
_row
!==
key
)));
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
!==
key
))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
i
d
!==
record
.
orderId
))
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
orderProductI
d
}
`
!==
key
))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
orderI
d
!==
record
.
orderId
))
}
else
{
const
children
=
currentOrderData
.
products
;
const
tempData
=
orderProductselectRowRecord
.
concat
(
record
);
...
...
@@ -558,13 +566,13 @@ const Create = () => {
},
onSelectAll
:
async
(
selected
:
boolean
,
selectedRows
:
GetOrderCommonEnhancePageResponseDetail
[
'products'
],
changeRows
:
any
[])
=>
{
const
filterEmptyRows
=
changeRows
.
filter
(
Boolean
)
const
keys
=
filterEmptyRows
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
);
const
keys
=
filterEmptyRows
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
orderProductI
d
}
`
);
const
orderId
=
changeRows
[
0
].
orderId
;
const
currentOrderData
=
fetchedOrderData
?.
fi
lter
((
_item
)
=>
_item
.
id
===
orderId
)[
0
];
const
currentOrderData
=
fetchedOrderData
?.
fi
nd
((
_item
)
=>
_item
.
orderId
===
orderId
)
if
(
selected
)
{
const
addTempRow
=
orderProductselectRowRecord
.
concat
(
filterEmptyRows
);
const
addTempRowKeys
=
addTempRow
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
)
const
addTempRowKeys
=
addTempRow
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
orderProductI
d
}
`
)
/** @toRemove 这里逻辑重复,且要删除,让后端添加时自己判断 */
const
formatData
=
addTempRow
.
map
((
_item
)
=>
{
...
...
@@ -593,9 +601,9 @@ const Create = () => {
const
removeKeys
=
orderProductSelectRowKeys
.
filter
((
_item
)
=>!
keys
.
includes
(
_item
))
// const removeRecord =
setOrderProductSelectRowKeys
(
removeKeys
)
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
!
keys
.
includes
(
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
)))
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
!
keys
.
includes
(
`
${
_item
.
orderId
}
_
${
_item
.
orderProductI
d
}
`
)))
if
(
currentOrderData
.
products
.
length
!==
removeKeys
.
length
)
{
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
id
!==
currentOrderData
.
i
d
))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
orderId
!==
currentOrderData
.
orderI
d
))
}
}
}
...
...
@@ -626,18 +634,20 @@ const Create = () => {
},
[])
const
handleBeforeOrderChecked
=
async
(
record
:
GetOrderCommonEnhancePageResponseDetail
,
checked
:
boolean
,
selectedRows
:
GetOrderCommonEnhancePageResponseDetail
[])
=>
{
const
{
products
,
orderNo
,
i
d
}
=
record
;
const
keys
=
products
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
);
const
{
products
,
orderNo
,
orderI
d
}
=
record
;
const
keys
=
products
.
map
((
_item
)
=>
`
${
orderId
}
_
${
_item
.
orderProductI
d
}
`
);
if
(
checked
)
{
const
uniqueKeys
=
Array
.
from
(
new
Set
(
orderProductSelectRowKeys
.
concat
(
keys
)))
const
uniqueList
=
orderProductselectRowRecord
.
concat
(
products
.
map
((
_item
)
=>
{
return
{
orderNo
:
orderNo
,
orderId
:
record
.
orderId
,
...
_item
,
}
})
)
console
.
log
(
uniqueList
)
const
formatData
=
uniqueList
.
map
((
_item
)
=>
{
return
{
productId
:
_item
.
productId
,
...
...
@@ -658,36 +668,36 @@ const Create = () => {
return
false
}
else
{
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
_row
)));
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
`
${
_row
.
orderId
}
_
${
_row
.
i
d
}
`
)))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
id
!==
i
d
))
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
`
${
_row
.
orderId
}
_
${
_row
.
orderProductI
d
}
`
)))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
orderId
!==
orderI
d
))
}
return
true
;
}
const
tiggerProcessOrderProductOk
=
()
=>
{
// const productOrderList = orderProductselectRowRecord.
const
orderList
=
formActions
.
getFieldValue
(
'detail.layout1.orderList'
);
const
uniqueIdList
=
new
Set
(
orderList
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
));
const
uniqueIdList
=
new
Set
(
orderList
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
orderProductI
d
}
`
));
/** 获取新增数列 */
const
newAddList
=
orderProductselectRowRecord
.
filter
((
_item
)
=>
!
uniqueIdList
.
has
(
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
))
.
filter
((
_item
)
=>
!
uniqueIdList
.
has
(
`
${
_item
.
orderId
}
_
${
_item
.
orderProductI
d
}
`
))
.
map
((
_item
)
=>
{
const
surplusProcessNum
=
_item
.
purchaseCount
-
+
_item
.
processNum
const
surplusProcessNum
=
+
_item
.
quantity
-
+
_item
.
enhanceCount
return
{
orderNo
:
_item
.
orderNo
,
orderId
:
_item
.
orderId
,
/** 主键id */
id
:
_item
.
i
d
,
skuid
:
_item
.
p
roductId
,
commodityId
:
_item
.
commodityId
||
_item
.
p
roductId
,
id
:
_item
.
orderProductI
d
,
skuid
:
_item
.
orderP
roductId
,
commodityId
:
_item
.
orderP
roductId
,
mainPic
:
_item
.
imgUrl
,
name
:
_item
.
productN
ame
,
name
:
_item
.
n
ame
,
category
:
_item
.
category
,
brand
:
_item
.
brand
,
unitName
:
_item
.
unit
,
purchaseCount
:
_item
.
purchaseCount
,
purchaseCountAndUnit
:
`
${
_item
.
purchaseCount
}
/
${
_item
.
unit
}
`
,
purchaseCount
:
+
_item
.
quantity
,
purchaseCountAndUnit
:
`
${
_item
.
quantity
}
/
${
_item
.
unit
}
`
,
surplusProcessNum
:
surplusProcessNum
,
surplusAndProcessNum
:
`
${
surplusProcessNum
}
/
0
`
surplusAndProcessNum
:
`
${
surplusProcessNum
}
/
${
_item
.
enhanceCount
}
`
}
});
...
...
@@ -968,25 +978,27 @@ const Create = () => {
rowSelection=
{
{
getCheckboxProps
:
(
_record
)
=>
{
return
{
disabled
:
_record
.
products
.
every
((
_item
)
=>
_item
.
purchaseCount
-
_item
.
processNum
<=
0
)
disabled
:
_record
.
products
.
every
((
_item
)
=>
+
_item
.
quantity
-
+
_item
.
enhanceCount
<=
0
)
}
}
}
}
tableProps=
{
{
rowKey
:
(
record
)
=>
`${record.
i
d}`
,
rowKey
:
(
record
)
=>
`${record.
orderI
d}`
,
// disabled: products.every((_i) => ),
expandable
:
{
expandedRowRender
:
(
record
)
=>
{
const
withOrderNo
=
record
.
products
.
map
((
_item
)
=>
{
return
{
...
_item
,
orderNo
:
record
.
orderNo
orderNo
:
record
.
orderNo
,
orderId
:
record
.
orderId
,
}
})
return
(
<
Table
columns=
{
orderProductColumns
}
rowKey=
{
(
row
)
=>
`${row.orderId}_${row.id}`
}
// rowKey=
{(
row
)
=
>
`$
{
row
.
orderId
}
_$
{
row
.
id
}
`}
rowKey=
{
(
row
)
=>
`${row.orderId}_${row.orderProductId}`
}
dataSource=
{
withOrderNo
}
rowSelection=
{
orderProductRowSelection
}
pagination=
{
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