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
XieZhiXiong
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 = [
...
@@ -61,12 +61,13 @@ export const orderProductColumns = [
},
},
{
{
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.assign.add.orderNum'
})}
`
,
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.assign.add.orderNum'
})}
`
,
dataIndex
:
'purchaseCount'
dataIndex
:
'purchaseCount'
,
render
:
(
text
,
record
)
=>
record
.
quantity
},
},
{
{
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.restProcessNum'
})}
`
,
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.restProcessNum'
})}
`
,
dataIndex
:
'restNum'
,
dataIndex
:
'restNum'
,
render
:
(
text
,
record
)
=>
+
record
.
purchaseCount
-
(
+
record
.
processNum
||
0
)
render
:
(
text
,
record
)
=>
+
record
.
quantity
-
(
+
record
.
enhanceCount
||
0
)
},
},
{
{
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.hasProcessNm'
})}
`
,
title
:
`
${
intl
.
formatMessage
({
id
:
'handling.hasProcessNm'
})}
`
,
...
...
src/pages/handling/assign/create/index.tsx
View file @
1f404c81
...
@@ -54,6 +54,11 @@ registerVirtualBox('MellowCardBox', (_props) => {
...
@@ -54,6 +54,11 @@ registerVirtualBox('MellowCardBox', (_props) => {
)
)
})
})
type
OrderProductType
=
GetOrderCommonEnhancePageResponseDetail
[
"products"
][
0
]
&
{
orderId
:
number
,
orderNo
:
string
}
/** @tofix 临时的,因为后端不返回只能值么临时搞着 */
/** @tofix 临时的,因为后端不返回只能值么临时搞着 */
const
MALL_NAME
=
{
const
MALL_NAME
=
{
"1"
:
intl
.
formatMessage
({
id
:
'handling.qiyeshangcheng'
}),
"1"
:
intl
.
formatMessage
({
id
:
'handling.qiyeshangcheng'
}),
...
@@ -512,13 +517,16 @@ const Create = () => {
...
@@ -512,13 +517,16 @@ const Create = () => {
/** -------------- 加工商品相关结束 --------------- */
/** -------------- 加工商品相关结束 --------------- */
/** ------- 加工订单相关 -------*/
/** ------- 加工订单相关 -------*/
const
onSelectChange
=
async
(
record
:
GetOrderCommonEnhancePageResponseDetail
[
"products"
][
0
],
selected
:
boolean
,
selectedRows
)
=>
{
const
onSelectChange
=
async
(
record
:
OrderProductType
,
selected
:
boolean
,
selectedRows
)
=>
{
const
currentOrderData
=
fetchedOrderData
?.
filter
((
_item
)
=>
_item
.
id
===
record
.
orderId
)[
0
];
console
.
log
(
record
,
"fetchedOrderData"
,
fetchedOrderData
);
const
key
=
`
${
record
.
orderId
}
_
${
record
.
id
}
`
// 父级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
)
{
if
(
!
selected
)
{
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
filter
((
_row
)
=>
(
_row
!==
key
)));
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
filter
((
_row
)
=>
(
_row
!==
key
)));
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
!==
key
))
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
orderProductI
d
}
`
!==
key
))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
i
d
!==
record
.
orderId
))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
orderI
d
!==
record
.
orderId
))
}
else
{
}
else
{
const
children
=
currentOrderData
.
products
;
const
children
=
currentOrderData
.
products
;
const
tempData
=
orderProductselectRowRecord
.
concat
(
record
);
const
tempData
=
orderProductselectRowRecord
.
concat
(
record
);
...
@@ -558,13 +566,13 @@ const Create = () => {
...
@@ -558,13 +566,13 @@ const Create = () => {
},
},
onSelectAll
:
async
(
selected
:
boolean
,
selectedRows
:
GetOrderCommonEnhancePageResponseDetail
[
'products'
],
changeRows
:
any
[])
=>
{
onSelectAll
:
async
(
selected
:
boolean
,
selectedRows
:
GetOrderCommonEnhancePageResponseDetail
[
'products'
],
changeRows
:
any
[])
=>
{
const
filterEmptyRows
=
changeRows
.
filter
(
Boolean
)
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
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
)
{
if
(
selected
)
{
const
addTempRow
=
orderProductselectRowRecord
.
concat
(
filterEmptyRows
);
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 这里逻辑重复,且要删除,让后端添加时自己判断 */
/** @toRemove 这里逻辑重复,且要删除,让后端添加时自己判断 */
const
formatData
=
addTempRow
.
map
((
_item
)
=>
{
const
formatData
=
addTempRow
.
map
((
_item
)
=>
{
...
@@ -593,9 +601,9 @@ const Create = () => {
...
@@ -593,9 +601,9 @@ const Create = () => {
const
removeKeys
=
orderProductSelectRowKeys
.
filter
((
_item
)
=>!
keys
.
includes
(
_item
))
const
removeKeys
=
orderProductSelectRowKeys
.
filter
((
_item
)
=>!
keys
.
includes
(
_item
))
// const removeRecord =
// const removeRecord =
setOrderProductSelectRowKeys
(
removeKeys
)
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
)
{
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 = () => {
...
@@ -626,18 +634,20 @@ const Create = () => {
},
[])
},
[])
const
handleBeforeOrderChecked
=
async
(
record
:
GetOrderCommonEnhancePageResponseDetail
,
checked
:
boolean
,
selectedRows
:
GetOrderCommonEnhancePageResponseDetail
[])
=>
{
const
handleBeforeOrderChecked
=
async
(
record
:
GetOrderCommonEnhancePageResponseDetail
,
checked
:
boolean
,
selectedRows
:
GetOrderCommonEnhancePageResponseDetail
[])
=>
{
const
{
products
,
orderNo
,
i
d
}
=
record
;
const
{
products
,
orderNo
,
orderI
d
}
=
record
;
const
keys
=
products
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
);
const
keys
=
products
.
map
((
_item
)
=>
`
${
orderId
}
_
${
_item
.
orderProductI
d
}
`
);
if
(
checked
)
{
if
(
checked
)
{
const
uniqueKeys
=
Array
.
from
(
new
Set
(
orderProductSelectRowKeys
.
concat
(
keys
)))
const
uniqueKeys
=
Array
.
from
(
new
Set
(
orderProductSelectRowKeys
.
concat
(
keys
)))
const
uniqueList
=
orderProductselectRowRecord
.
concat
(
const
uniqueList
=
orderProductselectRowRecord
.
concat
(
products
.
map
((
_item
)
=>
{
products
.
map
((
_item
)
=>
{
return
{
return
{
orderNo
:
orderNo
,
orderNo
:
orderNo
,
orderId
:
record
.
orderId
,
...
_item
,
...
_item
,
}
}
})
})
)
)
console
.
log
(
uniqueList
)
const
formatData
=
uniqueList
.
map
((
_item
)
=>
{
const
formatData
=
uniqueList
.
map
((
_item
)
=>
{
return
{
return
{
productId
:
_item
.
productId
,
productId
:
_item
.
productId
,
...
@@ -658,36 +668,36 @@ const Create = () => {
...
@@ -658,36 +668,36 @@ const Create = () => {
return
false
return
false
}
else
{
}
else
{
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
_row
)));
setOrderProductSelectRowKeys
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
_row
)));
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
`
${
_row
.
orderId
}
_
${
_row
.
i
d
}
`
)))
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_row
)
=>
!
keys
.
includes
(
`
${
_row
.
orderId
}
_
${
_row
.
orderProductI
d
}
`
)))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
id
!==
i
d
))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
orderId
!==
orderI
d
))
}
}
return
true
;
return
true
;
}
}
const
tiggerProcessOrderProductOk
=
()
=>
{
const
tiggerProcessOrderProductOk
=
()
=>
{
// const productOrderList = orderProductselectRowRecord.
// const productOrderList = orderProductselectRowRecord.
const
orderList
=
formActions
.
getFieldValue
(
'detail.layout1.orderList'
);
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
const
newAddList
=
orderProductselectRowRecord
.
filter
((
_item
)
=>
!
uniqueIdList
.
has
(
`
${
_item
.
orderId
}
_
${
_item
.
i
d
}
`
))
.
filter
((
_item
)
=>
!
uniqueIdList
.
has
(
`
${
_item
.
orderId
}
_
${
_item
.
orderProductI
d
}
`
))
.
map
((
_item
)
=>
{
.
map
((
_item
)
=>
{
const
surplusProcessNum
=
_item
.
purchaseCount
-
+
_item
.
processNum
const
surplusProcessNum
=
+
_item
.
quantity
-
+
_item
.
enhanceCount
return
{
return
{
orderNo
:
_item
.
orderNo
,
orderNo
:
_item
.
orderNo
,
orderId
:
_item
.
orderId
,
orderId
:
_item
.
orderId
,
/** 主键id */
/** 主键id */
id
:
_item
.
i
d
,
id
:
_item
.
orderProductI
d
,
skuid
:
_item
.
p
roductId
,
skuid
:
_item
.
orderP
roductId
,
commodityId
:
_item
.
commodityId
||
_item
.
p
roductId
,
commodityId
:
_item
.
orderP
roductId
,
mainPic
:
_item
.
imgUrl
,
mainPic
:
_item
.
imgUrl
,
name
:
_item
.
productN
ame
,
name
:
_item
.
n
ame
,
category
:
_item
.
category
,
category
:
_item
.
category
,
brand
:
_item
.
brand
,
brand
:
_item
.
brand
,
unitName
:
_item
.
unit
,
unitName
:
_item
.
unit
,
purchaseCount
:
_item
.
purchaseCount
,
purchaseCount
:
+
_item
.
quantity
,
purchaseCountAndUnit
:
`
${
_item
.
purchaseCount
}
/
${
_item
.
unit
}
`
,
purchaseCountAndUnit
:
`
${
_item
.
quantity
}
/
${
_item
.
unit
}
`
,
surplusProcessNum
:
surplusProcessNum
,
surplusProcessNum
:
surplusProcessNum
,
surplusAndProcessNum
:
`
${
surplusProcessNum
}
/
0
`
surplusAndProcessNum
:
`
${
surplusProcessNum
}
/
${
_item
.
enhanceCount
}
`
}
}
});
});
...
@@ -968,25 +978,27 @@ const Create = () => {
...
@@ -968,25 +978,27 @@ const Create = () => {
rowSelection=
{
{
rowSelection=
{
{
getCheckboxProps
:
(
_record
)
=>
{
getCheckboxProps
:
(
_record
)
=>
{
return
{
return
{
disabled
:
_record
.
products
.
every
((
_item
)
=>
_item
.
purchaseCount
-
_item
.
processNum
<=
0
)
disabled
:
_record
.
products
.
every
((
_item
)
=>
+
_item
.
quantity
-
+
_item
.
enhanceCount
<=
0
)
}
}
}
}
}
}
}
}
tableProps=
{
{
tableProps=
{
{
rowKey
:
(
record
)
=>
`${record.
i
d}`
,
rowKey
:
(
record
)
=>
`${record.
orderI
d}`
,
// disabled: products.every((_i) => ),
// disabled: products.every((_i) => ),
expandable
:
{
expandable
:
{
expandedRowRender
:
(
record
)
=>
{
expandedRowRender
:
(
record
)
=>
{
const
withOrderNo
=
record
.
products
.
map
((
_item
)
=>
{
const
withOrderNo
=
record
.
products
.
map
((
_item
)
=>
{
return
{
return
{
...
_item
,
...
_item
,
orderNo
:
record
.
orderNo
orderNo
:
record
.
orderNo
,
orderId
:
record
.
orderId
,
}
}
})
})
return
(
return
(
<
Table
<
Table
columns=
{
orderProductColumns
}
columns=
{
orderProductColumns
}
rowKey=
{
(
row
)
=>
`${row.orderId}_${row.id}`
}
// rowKey=
{(
row
)
=
>
`$
{
row
.
orderId
}
_$
{
row
.
id
}
`}
rowKey=
{
(
row
)
=>
`${row.orderId}_${row.orderProductId}`
}
dataSource=
{
withOrderNo
}
dataSource=
{
withOrderNo
}
rowSelection=
{
orderProductRowSelection
}
rowSelection=
{
orderProductRowSelection
}
pagination=
{
false
}
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