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
46350db2
Commit
46350db2
authored
Sep 27, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改加工订单接口
parent
d82bf5f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
index.tsx
src/pages/handling/assign/create/index.tsx
+20
-20
No files found.
src/pages/handling/assign/create/index.tsx
View file @
46350db2
...
...
@@ -27,11 +27,11 @@ import ProductDrawer, { productSubmitType, productInfo } from './components/Prod
import
{
priceFormat
}
from
'@/utils/numberFomat'
;
import
{
orderColumns
,
orderProductColumns
}
from
'./common/columns/orderColumn'
;
import
{
orderSchema
}
from
'./common/schemas/orderSchema'
import
{
GetOrderProcessingOrderListRequest
,
GetOrderProcessingOrderListResponseDetail
}
from
'@/services/OrderV2Api'
;
import
{
EnterpriceType
,
FileType
,
SubmitDataType
,
RestDataType
,
OtherAskType
,
SelectedProcessProductType
}
from
'./types'
;
import
{
history
}
from
'umi'
;
import
moment
from
'moment'
;
import
useFormatData
from
'./common/hooks/useFormatData'
;
import
{
GetOrderCommonEnhancePageRequest
,
GetOrderCommonEnhancePageResponseDetail
}
from
'@/services/OrderV2NewApi'
;
const
{
confirm
}
=
Modal
;
...
...
@@ -105,10 +105,10 @@ const Create = () => {
const
[
orderProductSelectRowKeys
,
setOrderProductSelectRowKeys
]
=
useState
<
string
[]
>
([])
const
[
orderProductselectRowRecord
,
setOrderProductSelectRowRecord
]
=
useState
<
{[
key
:
string
]:
any
}[]
>
([]);
/** 勾选的加工订单数据 */
const
[
processOrder
,
setProcessOrder
]
=
useState
<
GetOrder
ProcessingOrderList
ResponseDetail
[]
>
([])
const
[
processOrder
,
setProcessOrder
]
=
useState
<
GetOrder
CommonEnhancePage
ResponseDetail
[]
>
([])
/** ---- 加工订单end ------- */
/** 订单数据 */
const
[
fetchedOrderData
,
setFetchOrderData
]
=
useState
<
GetOrder
ProcessingOrderList
ResponseDetail
[]
>
([])
const
[
fetchedOrderData
,
setFetchOrderData
]
=
useState
<
GetOrder
CommonEnhancePage
ResponseDetail
[]
>
([])
const
[
productActionType
,
setProductActionType
]
=
useState
<
"view"
|
"edit"
>
(
"view"
);
const
[
submitLoading
,
setSubmitLoading
]
=
useState
<
boolean
>
(
false
);
...
...
@@ -137,8 +137,8 @@ const Create = () => {
})
setProcessProduct
(
productList
);
}
else
{
const
initialProcessOrder
=
cacheInitialValue
.
orderList
?.
map
((
_item
)
=>
({
id
:
_item
.
orderId
,
product
Dateils
s
:
_item
}))
||
[];
setProcessOrder
(
initialProcessOrder
as
unknown
as
GetOrder
ProcessingOrderList
ResponseDetail
[]);
const
initialProcessOrder
=
cacheInitialValue
.
orderList
?.
map
((
_item
)
=>
({
id
:
_item
.
orderId
,
products
:
_item
}))
||
[];
setProcessOrder
(
initialProcessOrder
as
unknown
as
GetOrder
CommonEnhancePage
ResponseDetail
[]);
setOrderProductSelectRowRecord
(
cacheInitialValue
.
orderList
?.
map
((
_item
)
=>
({...
_item
,
productId
:
_item
.
commodityId
}))
||
[]);
setOrderProductSelectRowKeys
(
cacheInitialValue
.
orderList
?.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
id
}
`
)
||
[])
}
...
...
@@ -500,7 +500,7 @@ const Create = () => {
/** -------------- 加工商品相关结束 --------------- */
/** ------- 加工订单相关 -------*/
const
onSelectChange
=
async
(
record
:
GetOrder
ProcessingOrderListResponseDetail
[
"productDateils
s"
][
0
],
selected
:
boolean
,
selectedRows
)
=>
{
const
onSelectChange
=
async
(
record
:
GetOrder
CommonEnhancePageResponseDetail
[
"product
s"
][
0
],
selected
:
boolean
,
selectedRows
)
=>
{
const
currentOrderData
=
fetchedOrderData
?.
filter
((
_item
)
=>
_item
.
id
===
record
.
orderId
)[
0
];
const
key
=
`
${
record
.
orderId
}
_
${
record
.
id
}
`
if
(
!
selected
)
{
...
...
@@ -508,7 +508,7 @@ const Create = () => {
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
id
}
`
!==
key
))
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
id
!==
record
.
orderId
))
}
else
{
const
children
=
currentOrderData
.
product
Dateils
s
;
const
children
=
currentOrderData
.
products
;
const
tempData
=
orderProductselectRowRecord
.
concat
(
record
);
const
keysList
=
tempData
.
filter
((
_item
)
=>
_item
.
orderId
===
record
.
orderId
);
/** @toRemove 这里逻辑重复,且要删除,让后端添加时自己判断 */
...
...
@@ -539,12 +539,12 @@ const Create = () => {
// type: 'checkbox',
selectedRowKeys
:
orderProductSelectRowKeys
,
onSelect
:
onSelectChange
,
getCheckboxProps
:
(
record
:
GetOrder
ProcessingOrderListResponseDetail
[
'productDateils
s'
][
0
])
=>
{
getCheckboxProps
:
(
record
:
GetOrder
CommonEnhancePageResponseDetail
[
'product
s'
][
0
])
=>
{
return
{
disabled
:
record
.
purchaseCount
-
record
.
processNum
<=
0
,
// Column configuration not to be checked
}
},
onSelectAll
:
async
(
selected
:
boolean
,
selectedRows
:
GetOrder
ProcessingOrderListResponseDetail
[
'productDateils
s'
],
changeRows
:
any
[])
=>
{
onSelectAll
:
async
(
selected
:
boolean
,
selectedRows
:
GetOrder
CommonEnhancePageResponseDetail
[
'product
s'
],
changeRows
:
any
[])
=>
{
const
filterEmptyRows
=
changeRows
.
filter
(
Boolean
)
const
keys
=
filterEmptyRows
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
id
}
`
);
const
orderId
=
changeRows
[
0
].
orderId
;
...
...
@@ -572,7 +572,7 @@ const Create = () => {
setOrderProductSelectRowRecord
(
addTempRow
)
const
keysLength
=
addTempRowKeys
.
filter
((
_item
)
=>
_item
.
includes
(
orderId
));
if
(
currentOrderData
.
product
Dateils
s
.
length
===
keysLength
.
length
)
{
if
(
currentOrderData
.
products
.
length
===
keysLength
.
length
)
{
setProcessOrder
((
prev
)
=>
prev
.
concat
(
currentOrderData
))
}
return
;
...
...
@@ -582,7 +582,7 @@ const Create = () => {
// const removeRecord =
setOrderProductSelectRowKeys
(
removeKeys
)
setOrderProductSelectRowRecord
((
prev
)
=>
prev
.
filter
((
_item
)
=>
!
keys
.
includes
(
`
${
_item
.
orderId
}
_
${
_item
.
id
}
`
)))
if
(
currentOrderData
.
product
Dateils
s
.
length
!==
removeKeys
.
length
)
{
if
(
currentOrderData
.
products
.
length
!==
removeKeys
.
length
)
{
setProcessOrder
((
prev
)
=>
prev
.
filter
((
_item
)
=>
_item
.
id
!==
currentOrderData
.
id
))
}
}
...
...
@@ -590,7 +590,7 @@ const Create = () => {
// onSelectAll: onSelectAll
}
const
handleFetchOrderList
=
useCallback
(
async
(
params
:
GetOrder
ProcessingOrderList
Request
)
=>
{
const
handleFetchOrderList
=
useCallback
(
async
(
params
:
GetOrder
CommonEnhancePage
Request
)
=>
{
const
{
startCreateTime
,
endCreateTime
,
...
rest
}
=
params
as
any
;
let
postData
=
rest
;
if
(
startCreateTime
)
{
...
...
@@ -602,7 +602,7 @@ const Create = () => {
}
}
const
{
data
,
code
}
=
await
PublicApi
.
getOrder
ProcessingOrderList
(
postData
as
GetOrderProcessingOrderList
Request
);
const
{
data
,
code
}
=
await
PublicApi
.
getOrder
CommonEnhancePage
(
postData
as
GetOrderCommonEnhancePage
Request
);
if
(
code
===
1000
)
{
setFetchOrderData
(
data
.
data
);
return
data
...
...
@@ -613,13 +613,13 @@ const Create = () => {
}
},
[])
const
handleBeforeOrderChecked
=
async
(
record
:
GetOrder
ProcessingOrderListResponseDetail
,
checked
:
boolean
,
selectedRows
:
GetOrderProcessingOrderList
ResponseDetail
[])
=>
{
const
{
product
Dateils
s
,
orderNo
,
id
}
=
record
;
const
keys
=
product
Dateils
s
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
id
}
`
);
const
handleBeforeOrderChecked
=
async
(
record
:
GetOrder
CommonEnhancePageResponseDetail
,
checked
:
boolean
,
selectedRows
:
GetOrderCommonEnhancePage
ResponseDetail
[])
=>
{
const
{
products
,
orderNo
,
id
}
=
record
;
const
keys
=
products
.
map
((
_item
)
=>
`
${
_item
.
orderId
}
_
${
_item
.
id
}
`
);
if
(
checked
)
{
const
uniqueKeys
=
Array
.
from
(
new
Set
(
orderProductSelectRowKeys
.
concat
(
keys
)))
const
uniqueList
=
orderProductselectRowRecord
.
concat
(
product
Dateils
s
.
map
((
_item
)
=>
{
products
.
map
((
_item
)
=>
{
return
{
orderNo
:
orderNo
,
...
_item
,
...
...
@@ -956,16 +956,16 @@ const Create = () => {
rowSelection=
{
{
getCheckboxProps
:
(
_record
)
=>
{
return
{
disabled
:
_record
.
product
Dateils
s
.
every
((
_item
)
=>
_item
.
purchaseCount
-
_item
.
processNum
<=
0
)
disabled
:
_record
.
products
.
every
((
_item
)
=>
_item
.
purchaseCount
-
_item
.
processNum
<=
0
)
}
}
}
}
tableProps=
{
{
rowKey
:
(
record
)
=>
`${record.id}`
,
// disabled: product
Dateils
s.every((_i) => ),
// disabled: products.every((_i) => ),
expandable
:
{
expandedRowRender
:
(
record
)
=>
{
const
withOrderNo
=
record
.
product
Dateils
s
.
map
((
_item
)
=>
{
const
withOrderNo
=
record
.
products
.
map
((
_item
)
=>
{
return
{
...
_item
,
orderNo
:
record
.
orderNo
...
...
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