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
8fda0201
Commit
8fda0201
authored
Feb 04, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 合并下单字段异常
parent
e1552f7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
index.tsx
...er/orderCollect/components/mergeOrderModalTable/index.tsx
+15
-9
index.tsx
...eOrder/orderCollect/components/productTableCell/index.tsx
+4
-2
No files found.
src/pages/transaction/purchaseOrder/orderCollect/components/mergeOrderModalTable/index.tsx
View file @
8fda0201
...
@@ -13,6 +13,7 @@ import { mergeSearchSchema } from './schema'
...
@@ -13,6 +13,7 @@ import { mergeSearchSchema } from './schema'
import
NestTable
from
'@/components/NestTable'
import
NestTable
from
'@/components/NestTable'
import
{
PublicApi
}
from
'@/services/api'
import
{
PublicApi
}
from
'@/services/api'
import
{
getUnitPriceTotal
}
from
'../../model/useProductTable'
import
{
getUnitPriceTotal
}
from
'../../model/useProductTable'
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
export
interface
MergeOrderModalTableProps
{
export
interface
MergeOrderModalTableProps
{
title
:
string
,
title
:
string
,
...
@@ -23,6 +24,7 @@ export interface MergeOrderModalTableProps {
...
@@ -23,6 +24,7 @@ export interface MergeOrderModalTableProps {
handleUpdate
?:
any
,
handleUpdate
?:
any
,
}
}
// const { pageStatus } = usePageStatus()
const
formActions
=
createFormActions
();
const
formActions
=
createFormActions
();
...
@@ -188,11 +190,12 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
...
@@ -188,11 +190,12 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
message
.
error
(
"请选择待合并订单"
)
message
.
error
(
"请选择待合并订单"
)
return
;
return
;
}
}
let
_originSource
=
[...
dataSource
.
data
]
let
_selectedRows
=
dataSource
.
data
.
filter
(
item
=>
selectedRowKeys
.
includes
(
item
.
id
))
// 只选一个子级 selectedRowKeys可能为空
let
_selectedRows
=
_originSource
.
filter
(
item
=>
selectedRowKeys
.
includes
(
item
.
id
))
setSelectedRows
(()
=>
_selectedRows
)
setSelectedRows
(()
=>
_selectedRows
)
let
allchildren
=
dataSource
.
data
.
map
(
item
=>
item
[
"productDateilss"
]).
reduce
((
prev
,
next
)
=>
prev
.
concat
(
next
),
[])
let
allchildren
=
_originSource
.
map
(
item
=>
item
[
"productDateilss"
]).
reduce
((
prev
,
next
)
=>
prev
.
concat
(
next
),
[])
let
_childSelectedRows
=
allchildren
.
filter
(
item
=>
childSelectedRowKeys
.
includes
(
item
.
id
))
let
_childSelectedRows
=
allchildren
.
filter
(
item
=>
childSelectedRowKeys
.
includes
(
item
.
id
))
setChildSelectedRows
(()
=>
_childSelectedRows
)
setChildSelectedRows
(()
=>
_childSelectedRows
)
...
@@ -203,24 +206,27 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
...
@@ -203,24 +206,27 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
// 开始数量合并
// 开始数量合并
let
processOrderProductRequests
=
schemaAction
.
getFieldValue
(
"orderProductRequests"
)
let
processOrderProductRequests
=
schemaAction
.
getFieldValue
(
"orderProductRequests"
)
processOrderProductRequests
.
map
(
item
=>
{
let
__
=
processOrderProductRequests
.
map
(
item
=>
{
item
[
"productId"
]
=
item
.
id
item
[
"productId"
]
=
item
.
id
if
(
item
.
id
===
currentClickRow
.
id
)
{
if
(
item
.
id
===
currentClickRow
.
id
)
{
let
count
=
_childSelectedRows
.
length
>
1
?
_childSelectedRows
.
reduce
((
a
,
b
)
=>
a
.
purchaseCount
+
b
.
purchaseCount
)
:
_childSelectedRows
[
0
].
purchaseCount
let
count
=
_childSelectedRows
.
length
>
1
?
_childSelectedRows
.
reduce
((
a
,
b
)
=>
a
.
purchaseCount
+
b
.
purchaseCount
)
:
_childSelectedRows
[
0
].
purchaseCount
// @to fix 第一次合并无法填入采购数量 新增情况下:手工模式不累加,报价单模式累加;编辑模式都累加
item
.
purchaseCount
=
count
+
item
.
purchaseCount
||
0
item
.
purchaseCount
=
count
+
item
.
purchaseCount
||
0
item
[
'money'
]
=
getUnitPriceTotal
(
item
)
item
[
'money'
]
=
getUnitPriceTotal
(
item
)
}
}
return
item
return
item
})
})
schemaAction
.
setFieldValue
(
"orderProductRequests"
,
processOrderProductRequests
)
schemaAction
.
setFieldValue
(
"orderProductRequests"
,
__
)
console
.
log
(
_originSource
,
selectedRowKeys
,
childSelectedRowKeys
,
selectedRows
,
childSelectedRows
,
_selectedRows
,
_childSelectedRows
)
// 生成orderProducts参数
// 生成orderProducts参数
let
_orderProducts
=
_childSelectedRows
.
map
(
item
=>
{
let
_orderProducts
=
_childSelectedRows
.
map
(
item
=>
{
for
(
let
_index
in
_
selectedRows
)
{
for
(
let
_index
in
_
originSource
)
{
let
_childKey
=
_
selectedRows
[
_index
][
"productDateilss"
].
map
(
_
=>
_
.
id
)
let
_childKey
=
_
originSource
[
_index
][
"productDateilss"
].
map
(
_
=>
_
.
id
)
if
(
_childKey
.
includes
(
item
.
id
))
{
if
(
_childKey
.
includes
(
item
.
id
))
{
return
{
return
{
mergeOrderId
:
_
selectedRows
[
_index
][
"id"
],
mergeOrderId
:
_
originSource
[
_index
][
"id"
],
productId
:
item
[
"productId"
]
productId
:
item
[
"productId"
]
}
}
}
}
...
@@ -230,7 +236,7 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
...
@@ -230,7 +236,7 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
let
hasVal
=
schemaAction
.
getFieldValue
(
"ordeProducts"
)
||
[]
let
hasVal
=
schemaAction
.
getFieldValue
(
"ordeProducts"
)
||
[]
schemaAction
.
setFieldValue
(
"ordeProducts"
,
[...
_orderProducts
,
...
hasVal
])
schemaAction
.
setFieldValue
(
"ordeProducts"
,
[...
_orderProducts
,
...
hasVal
])
// console.log("开始合并", currentClickRow, schemaAction.getFieldValue("orderProductRequests"), processOrderProductRequests
, _orderProducts)
console
.
log
(
"开始合并"
,
currentClickRow
,
__
,
_orderProducts
)
// 执行update 更新总价
// 执行update 更新总价
handleUpdate
()
handleUpdate
()
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/productTableCell/index.tsx
View file @
8fda0201
...
@@ -45,7 +45,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
...
@@ -45,7 +45,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
formItemProps
=
{},
formItemProps
=
{},
...
restProps
...
restProps
})
=>
{
})
=>
{
//
const formItemRef = useRef<any>();
const
formItemRef
=
useRef
<
any
>
();
const
{
form
}
=
useContext
(
EditableContext
);
const
{
form
}
=
useContext
(
EditableContext
);
const
save
=
async
e
=>
{
const
save
=
async
e
=>
{
try
{
try
{
...
@@ -68,12 +68,13 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
...
@@ -68,12 +68,13 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
let
keyValue
=
{}
let
keyValue
=
{}
keyValue
[
dataIndex
]
=
v
keyValue
[
dataIndex
]
=
v
form
.
setFieldsValue
(
keyValue
)
form
.
setFieldsValue
(
keyValue
)
console
.
log
(
keyValue
,
'obj'
,
v
)
}
}
return
<
Input
return
<
Input
style=
{
{
width
:
140
}
}
style=
{
{
width
:
140
}
}
type=
'number'
type=
'number'
//
ref={formItemRef}
ref=
{
formItemRef
}
onChange=
{
save
}
onChange=
{
save
}
{
...
formItemProps
}
{
...
formItemProps
}
id=
{
dataIndex
+
record
.
id
}
id=
{
dataIndex
+
record
.
id
}
...
@@ -85,6 +86,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
...
@@ -85,6 +86,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
let
childNode
=
children
;
let
childNode
=
children
;
if
(
editable
)
{
if
(
editable
)
{
console
.
log
(
record
,
'record'
)
childNode
=
childNode
=
<
Form
.
Item
<
Form
.
Item
style=
{
{
margin
:
0
}
}
style=
{
{
margin
:
0
}
}
...
...
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